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
support for ignoring get params #20 #22
Conversation
Also, decouple off yes/no functionality into ``yesno_to_bool`` function.
django_activeurl/utils.py
Outdated
# check missing href parameter | ||
if not url.attrib.get('href', None) is None: | ||
# get href attribute | ||
href = url.attrib['href'].strip() | ||
# cut off hashtag (anchor) | ||
href = re.sub(r'\#.+', '', href) | ||
if ignore_params: |
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 urlparse.urlunsplit urlparse.urlunsplit here please
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.
This is actually less performant IMO, but I added it in 21ce8a3. While it feels good to work with the standard library.
- it turns out urlparse objects aren't mutable. The reason why is the object subclasses
tuple
. _replace
is available, but still does a copy every time
So don't you think re.sub
would be more performant? Since there's no additional urlsplit / tuple object created?
Also, decouple off yes/no functionality into
yesno_to_bool
function.