Main app.

Commit
c355c31f72b5658f1d3b37c60c137a8275e964ca
Author
Marius Peter <marius.peter@tutanota.com>
Author date
Committer
Marius Peter <marius.peter@tutanota.com>
Committer date
app/main.py
index 149ef641..fd1a8a09 100644..100644
@@ -1,22 +1,6 @@
1 1 # -*- mode: python; -*-
2 2
3 3 """
4 Removed: routes.py module
5 Removed: ----------------
6 Removed:
7 Removed: This Python module contains the logic supporting:
8 Removed: 1. Navigating between website pages
9 Removed: 2. Interpreting user requests to the server
10 Removed: 3. Dispatching requested content back to the user
11 Removed:
12 Removed: Python dependencies:
13 Removed: - flask: provides web application features
14 Removed: - forms: provides secure user form submission
15 Removed: - sqlalchemy: provides communication with database on server.
16 Removed:
17 Removed: Personal imports:
18 Removed: These are used to avoid cluttering this file with
19 Removed: placeholder data for posts' content.
20 4 """
21 5
22 6 import os
@@ -104,9 +88,9 @@
104 88 db.session.add(new_download)
105 89 db.session.commit()
106 90 flash(f"Successfully started downloading {title}.")
107 Removed: return redirect("/index")
91 Added: return redirect(url_for("main.home"))
108 92 flash(f"Couldn't download {title}.")
109 Removed: return redirect("/index")
93 Added: return redirect(url_for("main.home"))
110 94
111 95
112 96 @main.route("/manage-remote/", methods=["POST"])
@@ -126,7 +110,7 @@
126 110 elif form.remove_remote.data:
127 111 return redirect(url_for("main.remove_remote", file=file_name))
128 112 flash("Couldn't manage remote file.", "error")
129 Removed: return redirect("/index")
113 Added: return redirect(url_for("main.home"))
130 114
131 115
132 116 @main.route("/download-local/<file>", methods=["GET", "POST"])
@@ -144,4 +128,4 @@
144 128 file_to_remove = os.path.join(os.getcwd(), "downloads", file)
145 129 os.remove(file_to_remove)
146 130 flash(f"Successfully removed file {file}.")
147 Removed: return redirect("/index")
131 Added: return redirect(url_for("main.home"))