-
Notifications
You must be signed in to change notification settings - Fork 63
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Consistent about using urljoin #264
Conversation
Reviewer's Guide by SourceryThis pull request standardizes URL generation by replacing manual string concatenation and formatting with the urljoin function. The changes enhance URL reliability by ensuring correct URL joining in various parts of the codebase. No diagrams generated as the changes look simple and do not need a visual representation. File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
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.
Hey @HungNgien - I've reviewed your changes - here's some feedback:
Overall Comments:
- Consider adding a comment explaining why
urljoin
is preferred over string concatenation.
Here's what I looked at during the review
- 🟡 General issues: 1 issue found
- 🟢 Security: all looks good
- 🟢 Testing: all looks good
- 🟢 Complexity: all looks good
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
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.
Hey @HungNgien - I've reviewed your changes - here's some feedback:
Overall Comments:
- It looks like you're using f-strings in some places and
.format
in others; can you pick one? - Consider adding
from urllib.parse import urljoin
to the top of the files where it's used.
Here's what I looked at during the review
- 🟢 General issues: all looks good
- 🟢 Security: all looks good
- 🟢 Testing: all looks good
- 🟢 Complexity: all looks good
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
src/pretalx/settings.py
Outdated
@@ -690,10 +689,10 @@ def merge_csp(*options, config=None): | |||
) | |||
|
|||
EVENTYAY_TICKET_BASE_PATH = config.get( | |||
"urls", "eventyay-ticket", fallback="https://app-test.eventyay.com/tickets" | |||
"urls", "eventyay-ticket", fallback="https://app-test.eventyay.com/tickets/" |
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.
Why a hardcoded domain should be in the code? How to make this domain agnostic?
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.
It is just a default value when the urls
key is missing in the config.
To use other domain, we just need to set it in config.
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.
app-test domain is a temporary domain for the dev branch. It should not be used as a fallback anywhere. If the urls key is missing best would be an error message for the developer. If the fallback can be made domain agnostic this option should be choosen. We will change the dev branch deployment domain in future and app-test is not suitable therefore to be part of the code.
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.
As discussed in chat other projects usually use "localhost" as fallback. Please explain why localhost cannot be the fallback.
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.
Since this fallback value does not impact the production, I can set it to "localhost" or any other value you prefer.
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.
ok, sounds good. localhost, please.
src/pretalx/settings.py
Outdated
) | ||
EVENTYAY_VIDEO_BASE_PATH = config.get( | ||
"urls", "eventyay-video", fallback="https://app-test.eventyay.com/video" | ||
"urls", "eventyay-video", fallback="https://app-test.eventyay.com/video/" |
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.
Why a hardcoded domain should be in the code? How to make this domain agnostic?
Summary by Sourcery
Enhancements: