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

Add static helpers #2824

Merged
merged 6 commits into from
Mar 14, 2018
Merged

Add static helpers #2824

merged 6 commits into from
Mar 14, 2018

Conversation

asvetlov
Copy link
Member

Fixes #2795

def test_repr_static_def():
routes = web.RouteTableDef()

routes.static('/prefix', '/path', name='name')
Copy link
Member

Choose a reason for hiding this comment

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

@

Copy link
Member Author

Choose a reason for hiding this comment

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

No, this method is intentionally not a decorator: static has no user-supported handler, only prefix, path and optional parameters. I'll document it properly.

The reason why url.static() and routes.static should exist is it is a part of configuration which very often is constant (safe to be done at module level). No need to add app.add_statiic() shortcut.

app.router.add_static() is redundant (but still exist and do all work internally).
app.add_subapp is a different beast: it requires subapp instance, that's why I don't want to add shourcuts for add_subapp.

Copy link
Member

Choose a reason for hiding this comment

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

Aha, I see. Now it looks fine. On previous version there was a function right after and that looks like missed @ from decorator.

@codecov-io
Copy link

codecov-io commented Mar 13, 2018

Codecov Report

Merging #2824 into master will increase coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2824      +/-   ##
==========================================
+ Coverage   97.96%   97.97%   +<.01%     
==========================================
  Files          39       39              
  Lines        7426     7445      +19     
  Branches     1305     1307       +2     
==========================================
+ Hits         7275     7294      +19     
  Misses         48       48              
  Partials      103      103
Impacted Files Coverage Δ
aiohttp/web_urldispatcher.py 99.21% <100%> (+0.02%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9108698...e5a63ff. Read the comment docs.

@asvetlov
Copy link
Member Author

Thanks @kxepal

@asvetlov asvetlov merged commit d2961fc into master Mar 14, 2018
@asvetlov asvetlov deleted the static-helpers branch March 14, 2018 09:22
@lock
Copy link

lock bot commented Oct 28, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a [new issue] for related bugs.
If you feel like there's important points made in this discussion, please include those exceprts into that [new issue].
[new issue]: https://github.com/aio-libs/aiohttp/issues/new

@lock lock bot added the outdated label Oct 28, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Oct 28, 2019
@psf-chronographer psf-chronographer bot added the bot:chronographer:provided There is a change note present in this PR label Oct 28, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bot:chronographer:provided There is a change note present in this PR outdated
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add web.static and web.RouteTableDef.static
3 participants