-
-
Notifications
You must be signed in to change notification settings - Fork 6.9k
Fix misleading AttributeError
tracebacks on Request
objects.
#2530
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
Conversation
AttributeError on
Request` objects.AttributeError
tracebacks on Request
objects.
Thanks for working on this. I ended up tracing the problem to an issue with my auth backend, but it took some doing to get there because the original stack trace was lost. |
@foresmac Most welcome - needed to be done. |
Some unrelated stuff in this commit - mostly due to a silent upgrade of pep8 (we might consider pinning it) |
@@ -154,7 +154,9 @@ def urlize_quoted_links(text, trim_url_limit=None, nofollow=True, autoescape=Tru | |||
|
|||
If autoescape is True, the link text and URLs will get autoescaped. | |||
""" | |||
trim_url = lambda x, limit=trim_url_limit: limit is not None and (len(x) > limit and ('%s...' % x[:max(0, limit - 3)])) or x | |||
def trim_url(x, limit=trim_url_limit): | |||
return limit is not None and (len(x) > limit and ('%s...' % x[:max(0, limit - 3)])) or x |
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.
FWIW, I'd feel better if these conditional and y or x
lines were replaced with explicit Python conditional assignment statements.
return ('%s...' % x[:max(0, limit - 3)]) if limit and len(x) > limit else x
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.
Yeah. We're just cloning from the Django codebase here so I don't particularly mind that it's a bit rubbish in this case.
Fix misleading `AttributeError` tracebacks on `Request` objects.
Closes #2108.