Skip to content

Conversation

lovelydinosaur
Copy link
Collaborator

Closes #2108.

@lovelydinosaur lovelydinosaur changed the title Fix misleading AttributeError on Request` objects. Fix misleading AttributeError tracebacks on Request objects. Feb 9, 2015
@lovelydinosaur lovelydinosaur added this to the 3.0.5 Release milestone Feb 9, 2015
@foresmac
Copy link

foresmac commented Feb 9, 2015

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.

@lovelydinosaur
Copy link
Collaborator Author

@foresmac Most welcome - needed to be done.

@lovelydinosaur
Copy link
Collaborator Author

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
Copy link

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

Copy link
Collaborator Author

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.

lovelydinosaur added a commit that referenced this pull request Feb 9, 2015
Fix misleading `AttributeError` tracebacks on `Request` objects.
@lovelydinosaur lovelydinosaur merged commit 873fb69 into master Feb 9, 2015
@lovelydinosaur lovelydinosaur deleted the attribute-proxying-fix branch February 9, 2015 17:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Usage of both @property and __getattr__ can lead to obscure and hard to debug errors
2 participants