Commit a5213d40 by Tom Christie

Drop urlobject2

parent a2d0fd2c
...@@ -16,7 +16,6 @@ For more information, check out [the documentation][docs], in particular, the tu ...@@ -16,7 +16,6 @@ For more information, check out [the documentation][docs], in particular, the tu
* Python (2.6, 2.7) * Python (2.6, 2.7)
* Django (1.3, 1.4, 1.5) * Django (1.3, 1.4, 1.5)
* [URLObject][urlobject] (2.0.0+)
**Optional:** **Optional:**
......
from django.http import QueryDict
from django.template import Library from django.template import Library
from urlobject import URLObject from urlparse import urlparse, urlunparse
register = Library() register = Library()
def replace_query_param(url, key, val):
(scheme, netloc, path, params, query, fragment) = urlparse(url)
query_dict = QueryDict(query).copy()
query_dict[key] = val
query = query_dict.urlencode()
return urlunparse((scheme, netloc, path, params, query, fragment))
def add_query_param(url, param): def add_query_param(url, param):
return unicode(URLObject(url).with_query(param)) key, val = param.split('=')
return replace_query_param(url, key, val)
register.filter('add_query_param', add_query_param) register.filter('add_query_param', add_query_param)
...@@ -17,7 +17,6 @@ REST framework requires the following: ...@@ -17,7 +17,6 @@ REST framework requires the following:
* Python (2.6, 2.7) * Python (2.6, 2.7)
* Django (1.3, 1.4, 1.5) * Django (1.3, 1.4, 1.5)
* [URLObject][urlobject] (2.0.0+)
The following packages are optional: The following packages are optional:
......
...@@ -63,7 +63,7 @@ setup( ...@@ -63,7 +63,7 @@ setup(
packages=get_packages('djangorestframework'), packages=get_packages('djangorestframework'),
package_data=get_package_data('djangorestframework'), package_data=get_package_data('djangorestframework'),
test_suite='djangorestframework.runtests.runcoverage.main', test_suite='djangorestframework.runtests.runcoverage.main',
install_requires=['URLObject>=0.6.0'], install_requires=[],
classifiers=[ classifiers=[
'Development Status :: 4 - Beta', 'Development Status :: 4 - Beta',
'Environment :: Web Environment', 'Environment :: Web Environment',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment