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

Standalone Resource Endpoints #5

Open
zbyte64 opened this issue Mar 20, 2013 · 0 comments
Open

Standalone Resource Endpoints #5

zbyte64 opened this issue Mar 20, 2013 · 0 comments

Comments

@zbyte64
Copy link
Owner

zbyte64 commented Mar 20, 2013

Currently Resources can be included directly in a urls conf without specifying an api site. This results in the Resource being registered with the global_site api. Resource endpoints should be able to do the same.

There are a couple ways this could take shape::

myresource = ModelResource(resource_adaptor=MyModel)
#this probably already works or requires the least changes
urlpatterns += ('', myresource.endpoints['create'].get_url_object())

#this gives greater url control which is more like what we want
urlpatterns += ('', url('^add/$', myresource.endpoints['create'].get_standalone_view()))

The latter requires that we detect the url info after its inclusion in urls which is different from how it is done now where the resource itself determines the url info. Since the endpoint.as_view emits a callable with an endpoint attribute matching the originator we can dig up the endpoint after the urlconf is generated. Unfortunately there is no signal we can hook into that says the root urlconf is completed for us so we may end up monkey patching get_urconf to add such a signal.

The other foreseeable change is that each standalone endpoint may have different namespaces. Currently the reversing is done at the root endpoint and the namespace is added there. Handling reversing at the endpoint level may conflict with our ability to proxy APIs from one client to another. Perhaps adding a reverse_endpoint where the endpoint itself is passed instead of it's urlname would resolve this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant