main. Route handler or application helper. This docstring was expanded to make future maintenance easier. Returns: Varies.
()
| 17157 | """ |
| 17158 | self.__dict__.update(d) |
| 17159 | return render_template( |
| 17160 | "profiler_view_only.html", |
| 17161 | title="Profiler view", |
| 17162 | e=Obj(entry), |
| 17163 | attachments=[Obj(a) for a in atts], |
| 17164 | ) |
| 17165 | |
| 17166 | @app.route("/profiler/<int:eid>/update", methods=["POST"]) |
| 17167 | @login_required |
| 17168 | def profiler_update(eid: int): |
| 17169 | """profiler_update. |
| 17170 | |
| 17171 | Route handler or application helper. |
| 17172 | |
| 17173 | This docstring was expanded to make future maintenance easier. |
| 17174 | |
| 17175 | Args: |
| 17176 | eid: Parameter. |
| 17177 | |
| 17178 | Returns: |
| 17179 | Varies. |
| 17180 | """ |
| 17181 | owner = current_user() |
| 17182 | first = (request.form.get("first") or "").strip() |
| 17183 | last = (request.form.get("last") or "").strip() |
| 17184 | info = (request.form.get("info") or "").strip() |
| 17185 | opt = profiler_collect_optional(request.form) |
| 17186 | att = request.files.get("att") |
| 17187 | |
| 17188 | conn = db_connect() |
| 17189 | row = conn.execute("SELECT 1 FROM profiler_entries WHERE id=? AND owner=?", (eid, owner)).fetchone() |
| 17190 | if not row: |
| 17191 | conn.close() |
| 17192 | abort(404) |
| 17193 | |
| 17194 | conn.execute(""" |
| 17195 | UPDATE profiler_entries SET first_enc=?, last_enc=?, info_enc=?, optional_enc=?, updated_at=? |
| 17196 | WHERE id=? AND owner=? |
| 17197 | """, (aesgcm_encrypt_text(first), aesgcm_encrypt_text(last), aesgcm_encrypt_text(info), profiler_encrypt_optional(opt), now_z(), eid, owner)) |
| 17198 | conn.commit() |
| 17199 | conn.close() |
| 17200 | |
| 17201 | if att and att.filename: |
| 17202 | try: |
| 17203 | profiler_store_attachment(eid, att) |
| 17204 | except Exception as e: |
| 17205 | log.exception("Profiler attachment failed: %s", e) |
| 17206 | |
| 17207 | flash("Updated.") |
| 17208 | return redirect(url_for("profiler")) |
| 17209 | |
| 17210 | @app.route("/profiler/<int:eid>/delete", methods=["POST"]) |
| 17211 | @login_required |
| 17212 | def profiler_delete(eid: int): |
| 17213 | """Delete a Profiler entry (requires typing first+last name). |
| 17214 | |
| 17215 | Requested safety: user must type the profile's first and last name before deletion. |
| 17216 | """ |
no test coverage detected