# Path: routes/util.py
# def _url_quote(string, encoding):
#     """A Unicode handling version of urllib.quote."""
#     if encoding:
#         if isinstance(string, unicode):
#             s = string.encode(encoding)
#         elif isinstance(string, str):
#             # assume the encoding is already correct
#             s = string
#         else:
#             s = unicode(string).encode(encoding)
#     else:
#         s = str(string)
#     return urllib.quote(s, '/')
# 
# def _str_encode(string, encoding):
#     if encoding:
#         if isinstance(string, unicode):
#             s = string.encode(encoding)
#         elif isinstance(string, str):
#             # assume the encoding is already correct
#             s = string
#         else:
#             s = unicode(string).encode(encoding)
#     else:
#         s = str(string)
#     return s


import re
import sys
import urllib
    from sets import ImmutableSet as frozenset
from routes.util import _url_quote as url_quote, _str_encode
                # Now check to see if there's a default and it matches the 
                # incoming call arg
                if (has_default and has_arg) and self.make_unicode(kargs[arg]) == \
                    self.make_unicode(self.defaults[arg]) and not gaps: 
                    continue
                
                # We need to pull the value to append, if the arg is None and 
                # we have a default, use that
                if has_arg and kargs[arg] is None and has_default and not gaps:
                    continue
                
                # Otherwise if we do have an arg, use that
                elif has_arg:
                    val = kargs[arg]
                
                elif has_default and self.defaults[arg] is not None:
                    val = self.defaults[arg]
                
                # No arg at all? This won't work
                else:
                    return False
                
                urllist.append(url_quote(val, self.encoding))
                if has_arg:
                    del kargs[arg]
                gaps = True
            elif isinstance(part, dict) and part['type'] == '*':
                arg = part['name']
                kar = kargs.get(arg)
                if kar is not None:

# Path: routes/util.py
# def _url_quote(string, encoding):
#     """A Unicode handling version of urllib.quote."""
#     if encoding:
#         if isinstance(string, unicode):
#             s = string.encode(encoding)
#         elif isinstance(string, str):
#             # assume the encoding is already correct
#             s = string
#         else:
#             s = unicode(string).encode(encoding)
#     else:
#         s = str(string)
#     return urllib.quote(s, '/')
# 
# def _str_encode(string, encoding):
#     if encoding:
#         if isinstance(string, unicode):
#             s = string.encode(encoding)
#         elif isinstance(string, str):
#             # assume the encoding is already correct
#             s = string
#         else:
#             s = unicode(string).encode(encoding)
#     else:
#         s = str(string)
#     return s


# Path: routes/route.py
import re
import sys
import urllib
    from sets import ImmutableSet as frozenset
from routes.util import _url_quote as url_quote, _str_encode

                # Now check to see if there's a default and it matches the 
                # incoming call arg
                if (has_default and has_arg) and self.make_unicode(kargs[arg]) == \
                    self.make_unicode(self.defaults[arg]) and not gaps: 
                    continue
                
                # We need to pull the value to append, if the arg is None and 
                # we have a default, use that
                if has_arg and kargs[arg] is None and has_default and not gaps:
                    continue
                
                # Otherwise if we do have an arg, use that
                elif has_arg:
                    val = kargs[arg]
                
                elif has_default and self.defaults[arg] is not None:
                    val = self.defaults[arg]
                
                # No arg at all? This won't work
                else:
                    return False
                
                urllist.append(url_quote(val, self.encoding))
                if has_arg:
                    del kargs[arg]
                gaps = True
            elif isinstance(part, dict) and part['type'] == '*':
                arg = part['name']
                kar = kargs.get(arg)
                if kar is not None:

                    urllist.append(url_quote(kar, self.encoding))