find_free_port. Route handler or application helper. This docstring was expanded to make future maintenance easier. Args: preferred: Parameter. Returns: Varies.
(preferred=6969)
| 16799 | filtered.append({"id": r["id"], "first": first, "last": last, "updated_at": r["updated_at"]}) |
| 16800 | entries = filtered[:200] |
| 16801 | |
| 16802 | class Obj: |
| 16803 | def __init__(self, d): |
| 16804 | """__init__. |
| 16805 | |
| 16806 | Internal helper function. |
| 16807 | |
| 16808 | This docstring was added automatically to improve maintainability. |
| 16809 | |
| 16810 | Args: |
| 16811 | self: Parameter. |
| 16812 | d: Parameter. |
| 16813 | |
| 16814 | Returns: |
| 16815 | Varies. |
| 16816 | """ |
| 16817 | self.__dict__.update(d) |
| 16818 | return render_template("profiler.html", title="Profiler", entries=[Obj(e) for e in entries], q=q) |
| 16819 | |
| 16820 | @app.route("/profiler/export", methods=["POST"]) |
| 16821 | @login_required |
| 16822 | def profiler_export(): |
| 16823 | """profiler_export. |
| 16824 | |
| 16825 | Route handler or application helper. |
| 16826 | |
| 16827 | This docstring was expanded to make future maintenance easier. |
| 16828 | |
| 16829 | Returns: |
| 16830 | Varies. |
| 16831 | """ |
| 16832 | owner = current_user() |
| 16833 | # Export all of *your* encrypted profiles into a zip in Downloads |
| 16834 | try: |
| 16835 | conn = db_connect() |
| 16836 | entries = conn.execute("SELECT id, first_enc, last_enc, info_enc, optional_enc, created_at, updated_at FROM profiler_entries WHERE owner=? ORDER BY id ASC", (owner,)).fetchall() |
| 16837 | att_rows = conn.execute("SELECT entry_id, filename_enc, mime_enc, stored_path, created_at FROM profiler_attachments WHERE entry_id IN (SELECT id FROM profiler_entries WHERE owner=?) ORDER BY id ASC", (owner,)).fetchall() |
| 16838 | conn.close() |
| 16839 | |
| 16840 | # Build export structure |
| 16841 | export = [] |
| 16842 | atts_by_entry = {} |
| 16843 | for a in att_rows: |
| 16844 | atts_by_entry.setdefault(a["entry_id"], []).append(dict(a)) |
| 16845 | |
| 16846 | tmp_dir = os.path.join(BASE_DIR, "_tmp_profiler_export") |