MCPcopy
hub / github.com/pyload/pyload / build

Method build

module/lib/bottle.py:391–400  ·  view source on GitHub ↗

Build an URL by filling the wildcards in a rule.

(self, _name, *anons, **query)

Source from the content-addressed store, hash-verified

389 return match
390
391 def build(self, _name, *anons, **query):
392 ''' Build an URL by filling the wildcards in a rule. '''
393 builder = self.builder.get(_name)
394 if not builder: raise RouteBuildError("No route with that name.", _name)
395 try:
396 for i, value in enumerate(anons): query['anon%d'%i] = value
397 url = ''.join([f(query.pop(n)) if n else f for (n,f) in builder])
398 return url if not query else url+'?'+urlencode(query)
399 except KeyError, e:
400 raise RouteBuildError('Missing URL argument: %r' % e.args[0])
401
402 def match(self, environ):
403 ''' Return a (target, url_agrs) tuple or raise HTTPError(400/404/405). '''

Callers 3

addMethod · 0.95
get_urlMethod · 0.80

Calls 5

RouteBuildErrorClass · 0.85
joinMethod · 0.80
popMethod · 0.80
fFunction · 0.50
getMethod · 0.45

Tested by

no test coverage detected