##// END OF EJS Templates
Make sure the repository names don't have slashes at the at or else in some...
Make sure the repository names don't have slashes at the at or else in some cases env[path_info] will not find an defined repository. REQUEST_URI can contain a query_string appending the repository name would lead to corrupt urls.

File last commit:

r1056:34be48b4 default
r1181:4f5001f5 default
Show More
fancyopts.py
30 lines | 839 B | text/x-python | PythonLexer
import getopt
def fancyopts(args, options, state):
long=[]
short=''
map={}
dt={}
for s, l, d, c in options:
pl = l.replace('-', '_')
map['-'+s] = map['--'+l] = pl
state[pl] = d
dt[pl] = type(d)
if not d is None and not callable(d):
if s: s += ':'
if l: l += '='
if s: short = short + s
if l: long.append(l)
opts, args = getopt.getopt(args, short, long)
for opt, arg in opts:
if dt[map[opt]] is type(fancyopts): state[map[opt]](state,map[opt],arg)
elif dt[map[opt]] is type(1): state[map[opt]] = int(arg)
elif dt[map[opt]] is type(''): state[map[opt]] = arg
elif dt[map[opt]] is type([]): state[map[opt]].append(arg)
elif dt[map[opt]] is type(None): state[map[opt]] = 1
return args