I’m using tastypie for providing an API for my application. I prefer to have URLs without trailing slashes. I prefer /api/v1/entry/set/1;3 rather than /api/v1/entry/set/1;3/. I’ve turned off django’s APPEND_SLASH and turned on TASTYPIE_ALLOW_MISSING_SLASH.
This works nicely, except for get_multiple (/set) which tastypie notes in its documentation can’t work without a trailing slash. The URL regex from the tastypie code is:
# Due to the way Django parses URLs, ``get_multiple`` won't work without
# a trailing slash.
...
url(r"^(?P<resource_name>%s)/set/(?P<%s_list>\w[\w/;-]*)/$" %
(self._meta.resource_name, self._meta.detail_uri_name),
self.wrap_view('get_multiple'), name="api_get_multiple"),
...
I’ve verified that this is true. /api/v1/notes/set/2;1 and /api/v1/notes/set/2;1/ match fine if APPEND_SLASH is enabled, but changing the / in the above regex to /? makes it so django does not match the pattern.
The pattern matches correctly when I try using the re module manually. Why doesn’t django match the URL without the trailing slash?
This has been fixed. My pull request was merged June 14th, 2012.