-
Notifications
You must be signed in to change notification settings - Fork 886
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
refactor parse_url_overrides #3034
refactor parse_url_overrides #3034
Conversation
Refactor parse_url_overrides: * pop values with default if key is missing * change conditionals to test for truth * prevent throwing an exception if passing keyword with default value * test if anchor starts with '#' before blindly adding it
modified: pyramid/url.py
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.
Looks good :D
pyramid/url.py
Outdated
|
||
if '_port' in kw: | ||
port = kw.pop('_port') | ||
if anchor.startswith('#') == False: |
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.
Please fix this PEP8 issue:
Hi @mmerickel and @bertjwregeer - what should I do next? |
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.
Sorry @russellballestrini, thanks for the reminder. This logic needs to be uniform between resource_url
and route_url
. Currently resource_url
does this on its own but ideally it would be updated to use parse_url_overrides
as well by munging the argument names or something.
Also annoyingly .pop
is slower than if foo in bar: bar.get(foo)
but I think it's not worth fretting about performance here.
|
The original version uses |
@russellballestrini The point of It is perfectly OK to use |
@tseaver - Ah yes, I see how popping and mutating the @mmerickel - I see what you mean about |
Sorry I meant |
@mmerickel - the |
@russellballestrini it's the same code it's just the parameters have different names (no leading underscores). |
I went ahead and did the work to cleanup and standardize this effort with |
Found a bug while adding a test... yup. I accidentally pushed this PR as a branch on pyramid which is why the CI tests are messing up but the |
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.
Very cool - I always love a change with more deletes then adds and testing code is most of the adds!
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.
👍
Refactor parse_url_overrides: