def pregenerator(request, elements, kw):
    """
    Route pregenerator that set the current matched route application and table
    segments as defaults for generating urls.
    """
    if 'application' not in kw:
        kw['application'] = request.matchdict.get('application', 'default')
    if 'table' not in kw:
        kw['table'] = request.matchdict.get('table', None)
    return elements, kw
