web/views/urlrewrite.py
changeset 3396 fb261afd49cd
parent 3377 dd9d292b6a6d
child 3451 6b46d73823f5
equal deleted inserted replaced
3395:405f393bcac0 3396:fb261afd49cd
    65     input URI (regexp or plain string) to a dictionary to update the
    65     input URI (regexp or plain string) to a dictionary to update the
    66     request's form
    66     request's form
    67 
    67 
    68     If the input uri is a regexp, group substitution is allowed
    68     If the input uri is a regexp, group substitution is allowed
    69     """
    69     """
    70     id = 'simple'
    70     __regid__ = 'simple'
    71 
    71 
    72     rules = [
    72     rules = [
    73         ('/_', dict(vid='manage')),
    73         ('/_', dict(vid='manage')),
    74         ('/_registry', dict(vid='registry')),
    74         ('/_registry', dict(vid='registry')),
    75 #        (rgx('/_([^/]+?)/?'), dict(vid=r'\1')),
    75 #        (rgx('/_([^/]+?)/?'), dict(vid=r'\1')),
   177 
   177 
   178 class SchemaBasedRewriter(URLRewriter):
   178 class SchemaBasedRewriter(URLRewriter):
   179     """Here, the rules dict maps regexps or plain strings to
   179     """Here, the rules dict maps regexps or plain strings to
   180     callbacks that will be called with (input, uri, req, schema)
   180     callbacks that will be called with (input, uri, req, schema)
   181     """
   181     """
   182     id = 'schemabased'
   182     __regid__ = 'schemabased'
   183     rules = [
   183     rules = [
   184         # rgxp : callback
   184         # rgxp : callback
   185         (rgx('/search/(.+)'), build_rset(rql=r'Any X WHERE X has_text %(text)s',
   185         (rgx('/search/(.+)'), build_rset(rql=r'Any X WHERE X has_text %(text)s',
   186                                          rgxgroups=[('text', 1)])),
   186                                          rgxgroups=[('text', 1)])),
   187         ]
   187         ]