Upload zip to server - #64
Conversation
| # TODO: Make sure this works | ||
| with io.open(os.path.join(self._PATH, "users.json"), encoding="utf8") as f: | ||
| self.__USER_DATA = {u["id"]: u for u in json.load(f)} | ||
| def __init__(self, PATH=''): |
| flash("No selected file") | ||
| return redirect(request.url) | ||
| if file and allowed_file(file.filename): | ||
| print("made it and it should extract the archive here") |
There was a problem hiding this comment.
I guess there isn't great logging set up already, so print is fine, but at the same time, I want to avoid having "made it" etc. logged :P
Perhaps "Extracting archive..." is sufficient.
| file = request.files["archive_file"] | ||
| # if user does not select file, browser also | ||
| # submit a empty part without filename | ||
| if file.filename == "": |
|
|
||
| reader = Reader() | ||
|
|
||
| # these functions only fire when the route is navigated to |
|
|
||
|
|
||
| @app.route("/") | ||
| ALLOWED_EXTENSIONS = set(["zip"]) |
There was a problem hiding this comment.
Constants like this should be at the top of the file
| def allowed_file(filename): | ||
| return "." in filename and \ | ||
| filename.rsplit(".", 1)[1].lower() in ALLOWED_EXTENSIONS | ||
|
|
There was a problem hiding this comment.
Two newlines between all module-level functions
|
|
||
| @app.route("/", methods=["GET", "POST"]) | ||
| def upload(): | ||
| print('upload') |
There was a problem hiding this comment.
I guess the request I have general for these print statements is, can you just clean them up a bit?
| flex-direction: column; | ||
| justify-content: center; | ||
| align-items: center; | ||
| background-color: #f5f5f5 |
There was a problem hiding this comment.
The mismatched indentation in this file bothers me, please use an auto formatter of some kind in your editor to clean it up. Thanks. :)
| @@ -0,0 +1,70 @@ | |||
| @import url('https://fonts.googleapis.com/css?family=Lato:400,900'); | |||
There was a problem hiding this comment.
Same for the indentation in this file
|
Hey @hfaran just mostly wanted to show you what I worked on. I had to get this out this week for my work. I can fix all of this stuff. |
Well, as long as:
implementation looks fine to me. 👍 😄 |
… to be the absolute path
Change Reader object to store all of the data instead of returning it from the compile functions
Change app routes to use reader values
Add upload view to upload a zip file
Some tech debt: