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

make new resources classes public #767

Merged
merged 1 commit into from
Feb 5, 2016

Conversation

rutsky
Copy link
Member

@rutsky rutsky commented Feb 5, 2016

These classes are documented as members of aiohttp.web, but they aren't because they are not exported in __all__:
AbstractResource, ResourceAdapter, AbstractRoute, ResourceRoute.

These classes are documented as members of aiohttp.web, but they aren't
because they are not exported in __all__:
AbstractResource, ResourceAdapter, AbstractRoute, ResourceRoute
rutsky added a commit to aio-libs/aiohttp-cors that referenced this pull request Feb 5, 2016
@asvetlov
Copy link
Member

asvetlov commented Feb 5, 2016

I just curious what do you want to do with these public names? Perform isinstance() checks?
Creating new resources is still forbidden by public API, the only available way is router.add_resource().

@rutsky
Copy link
Member Author

rutsky commented Feb 5, 2016

I just curious what do you want to do with these public names? Perform isinstance() checks?

  1. For type hinting (e.g. here, however I removed them at this moment because of this issue).
  2. For isinstance checks, yes.

I haven't thought about support of Resources in aiohttp_cors in details, but I believe in addition to:

# setup CORS for specific route
cors.add(app.router.add_route("GET", "/hello", handler_get))

where cors.add() receives AbstractRoute.
Will be cors.add() that receives AbstractResource:

resource = router.add_resource('/path/{to}', name='name')
resource.add_route('GET', handler_get)
resource.add_route('POST', handler_post)
# setup CORS for all routes on resource
cors.add(resource)

So I need to check is passed object is resource or route.

Currently later approach is not supported, but RuntimeError after proper isinstance check is already done: https://github.com/aio-libs/aiohttp_cors/blob/fix-for-aiohttp-0.21/aiohttp_cors/cors_config.py#L172

@asvetlov
Copy link
Member

asvetlov commented Feb 5, 2016

Sounds good

asvetlov added a commit that referenced this pull request Feb 5, 2016
make new resources classes public
@asvetlov asvetlov merged commit b9b1967 into aio-libs:master Feb 5, 2016
rutsky added a commit to aio-libs/aiohttp-cors that referenced this pull request Apr 4, 2016
@lock
Copy link

lock bot commented Oct 29, 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.

@lock lock bot added the outdated label Oct 29, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Oct 29, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants