Skip to content

Simplified tag system - #10

Open
gpetretto wants to merge 12 commits into
gp/pyd2_origfrom
gp/tags_simple
Open

Simplified tag system#10
gpetretto wants to merge 12 commits into
gp/pyd2_origfrom
gp/tags_simple

Conversation

@gpetretto

Copy link
Copy Markdown

Simplified version of tag system. Only allowing admin to create tags and no scope. Also adding variables to enable the feature.
Do you want to have another review @davidwaroquiers @DianaAliabieva ?

@davidwaroquiers davidwaroquiers left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks very nice to me!
Maybe one thing that is not clear is the variable needed to activate it. It seems that we need to set both PYDATALAB_ENABLE_TAGS and VUE_APP_ENABLE_TAGS, am I missing something ?
I think it might be good to include the "goal" of the tags somewhere, i.e. the ability to filter by tags. Even though it could be in another PR, I think that it is precisely that possibility that makes tags useful.
What do you think ?

Comment thread pydatalab/tests/server/test_tags.py
@DianaAliabieva

Copy link
Copy Markdown
Collaborator

Hello! Did you do changes in Frontend?
I will review tomorrow again also
Have a good evening!

@gpetretto

Copy link
Copy Markdown
Author

Hello! Did you do changes in Frontend? I will review tomorrow again also Have a good evening!

No visualization and front-end logic changes except the simplifications related to the fact that only global tags exist and only an admin can create them.

@davidwaroquiers added the tags filtering in #12 and we will probably merge that here as well.

@DianaAliabieva DianaAliabieva left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello! For me everything looks good, I didn't find anything anymore.
only one thing with error code

if not updated_data:
return (
jsonify(status="error", message="No data provided to update the tag with."),
204, # 204: No content

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
204, # 204: No content
400, # 400: Bad Request

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The HTTP specification states that a 204 No Content response must not have a body.

If you call jsonify() and return a JSON payload with a message, you are returning content. If you try to return JSON with a 204 status:

Flask/WSGI servers might strip the body automatically, meaning your "No data provided..." message gets deleted entirely.

If the request is invalid because the payload was empty, return a 400 Bad Request so the client understands it was an error and can read your message.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Option 2:
If you truly want to return 204 No Content
If you decide that an empty payload is a success state that just requires doing nothing, you must omit the JSON body entirely.

if not updated_data:
# Flask allows returning an empty string/response for 204
return "", 204

but i prefer 400

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants