def href(*args, **kw):
 result = [(((request and request.script_root) or '') + '/')]
 for (idx, arg) in enumerate(args):
  result.append((((idx and '/') or '') + url_quote(arg)))
 if kw:
  result.append(('?' + url_encode(kw)))
 return ''.join(result)

def href ( * args , ** kw ) : result = [ ( ( ( request and request . script_root ) or '' ) + '/' ) ] for ( idx , arg ) in enumerate ( args ) : result . append ( ( ( ( idx and '/' ) or '' ) + url_quote ( arg ) ) ) if kw : result . append ( ( '?' + url_encode ( kw ) ) ) return '' . join ( result )
simple function for url generation .