-
Notifications
You must be signed in to change notification settings - Fork 1
Conversation
|
||
file.save(file_location + "/" + filename) | ||
try: | ||
with zipfile.ZipFile(file_location + "/" + filename) as upload_zip: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not solved eh
|
||
file_location = os.path.join(project_upload_directory) | ||
|
||
if not os.path.exists(project_upload_directory): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just use, exist_ok=True
without the if :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
||
project_upload_directory = os.path.join(f"{UPLOAD_FOLDER}", f"{new_project.project_id}") | ||
|
||
file_location = os.path.join(project_upload_directory) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
path.join with 1 argument has no effect, did you forget second argument?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I forgor 💀
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
||
# save the file that is given with the request | ||
|
||
new_project = create_model_instance( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You don't handle the case where this fails
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The only thing that fails is me 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
backend/project/utils/query_agent.py
Outdated
db.session.commit() | ||
return jsonify({ | ||
"data": new_instance, | ||
new_instance = create_model_instance(model, data, response_url_base, required_fields) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use model_instance, status_code = create_model_instance
instead
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
backend/project/utils/query_agent.py
Outdated
f"{response_url_base}/", | ||
str(getattr(new_instance, url_id_field)))}), 201 | ||
"url": | ||
urljoin(response_url_base + "/", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use f-string
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
||
# save the file that is given with the request | ||
|
||
new_project, status_code = create_model_instance( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still not doing anything about if it fails.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Create functionality of file uploading when using POST to projects