Open kennknowles opened 11 years ago
There does not seem to be a consistent way to achieve an API named "v0.4".
"v0.4"
api = Api(api_name="v0.4")
api = Api(api_name=r"v0\.4")
api_name
reverse
From the way it is used right now, and because it hardly makes sense to match multiple names, I believe the intent is for it is be a plain string, so it should be passed through re.escape prior to putting it in the urlpatterns, here: https://github.com/toastdriven/django-tastypie/blob/master/tastypie/api.py#L103
re.escape
urlpatterns
Am I correct? Feedback?
Kenn
The precise link to the part of the commit relevant for this ticket is https://github.com/dimagi/core-hq/blob/master/corehq/apps/api/urls.py#L51
There does not seem to be a consistent way to achieve an API named
"v0.4"
.api = Api(api_name="v0.4")
does not work because the name is injected into the urlpatterns as a regex.api = Api(api_name=r"v0\.4")
does not work because theapi_name
is used inreverse
lookups, where it needs to be "v0.4" not r"v0.4".From the way it is used right now, and because it hardly makes sense to match multiple names, I believe the intent is for it is be a plain string, so it should be passed through
re.escape
prior to putting it in theurlpatterns
, here: https://github.com/toastdriven/django-tastypie/blob/master/tastypie/api.py#L103Am I correct? Feedback?
Kenn