Skip to content
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

is_url_for decorator. Fixes #77. #79

Merged
merged 6 commits into from
Dec 4, 2015
Merged

is_url_for decorator. Fixes #77. #79

merged 6 commits into from
Dec 4, 2015

Conversation

jace
Copy link
Member

@jace jace commented Dec 3, 2015

No description provided.

else:
kwargs[param] = getattr(self, attr)

return url_for(endpoint, **kwargs)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could this could use a more obvious name to indicate that it's calling flask's url_for? At first blush, it seemed like a recursive call.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A comment above this line?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, as a reader I would find flask_url_for clearer than a comment, but this is perhaps a subjective detail.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree, but our convention is to rename only when there's a conflict. We're not defining a url_for at the module level, and we don't want to cause conflict if some thing else in this module requires that function in future. A comment has less collateral impact.

@jace
Copy link
Member Author

jace commented Dec 4, 2015

In hasjob.models.JobPost.url_for, the method does some additional processing. There's no scope for doing this in the decorator, so the model will still need the url_for method.

jace added a commit that referenced this pull request Dec 4, 2015
is_url_for decorator. Fixes #77.
@jace jace merged commit b5e8077 into master Dec 4, 2015
@jace jace deleted the is_url_for branch December 4, 2015 11:44
@jace jace mentioned this pull request Nov 21, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants