Skip to content

Commit

Permalink
Fix Href
Browse files Browse the repository at this point in the history
  • Loading branch information
DasIch committed May 24, 2013
1 parent 9909894 commit 7be1b27
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions werkzeug/urls.py
Expand Up @@ -753,9 +753,9 @@ class Href(object):
`sort` and `key` were added.
"""

def __init__(self, base='./', charset='utf-8', sort=False, key=None):
def __init__(self, base=u'./', charset='utf-8', sort=False, key=None):
if not base:
base = './'
base = u'./'
self.base = base
self.charset = charset
self.sort = sort
Expand All @@ -767,14 +767,16 @@ def __getattr__(self, name):
base = self.base
if base[-1:] != u'/':
base += u'/'
if PY2:
name = name.decode('ascii')
return Href(urljoin(base, name), self.charset, self.sort, self.key)

def __call__(self, *path, **query):
if path and isinstance(path[-1], dict):
if query:
raise TypeError('keyword arguments and query-dicts '
'can\'t be combined')
query, path = path[-1], path[:-1]
query, path = path[-1], path[:-1]
elif query:
query = dict([(k.endswith('_') and k[:-1] or k, v)
for k, v in query.items()])
Expand Down

0 comments on commit 7be1b27

Please sign in to comment.