Ejemplo n.º 1
0
def get_search_params(request):
    # Hack - remove any format tags from route match - idealy this would be done at the route level
    url = re.sub('|'.join(['\.'+f for f in registered_formats()]), '', request.matchdict['tags'])

    try   : tags     = url.split('/')
    except: tags     = []
    try   : keywords = sorted([keyword for keyword in re.findall(r'\w+', request.params['keywords']) if keyword])
    except: keywords = []
    try   : trackids = [trackid for trackid in re.findall(r'\w+', request.params['trackids']) if trackid]
    except: trackids = []

    tags_silent_forced = request.registry.settings.get('karakara.search.tag.silent_forced', [])
    tags_silent_hidden = request.registry.settings.get('karakara.search.tag.silent_hidden', [])

    return SearchParams(tags, keywords, trackids, tags_silent_forced, tags_silent_hidden)
Ejemplo n.º 2
0
 def append_format_pattern(route):
     return re.sub(r'{(.*)}', r'{\1:[^/\.]+}',
                   route) + r'{spacer:[.]?}{format:(%s)?}' % '|'.join(
                       registered_formats())
Ejemplo n.º 3
0
 def append_format_pattern(route):
     return re.sub(r'{(.*)}', r'{\1:[^/\.]+}', route) + r'{spacer:[.]?}{format:(%s)?}' % '|'.join(registered_formats())