예제 #1
0
파일: core.py 프로젝트: webmaven/morepath
def traject_consume(request, model, lookup):
    traject = generic.traject(model, lookup=lookup, default=None)
    if traject is None:
        return None
    get_model, stack, traject_variables = traject(request.unconsumed)
    if get_model is None:
        return None
    variables = generic.context(model, default={}, lookup=lookup)
    variables['base'] = model
    variables['request'] = request
    variables.update(traject_variables)
    next_model = mapply(get_model, **variables)
    if next_model is None:
        return None
    request.unconsumed = stack
    return next_model
예제 #2
0
파일: core.py 프로젝트: iapilgrim/morepath
def traject_consume(request, model, lookup):
    traject = generic.traject(model, lookup=lookup, default=None)
    if traject is None:
        return None
    value, stack, traject_variables = traject.consume(request.unconsumed)
    if value is None:
        return None
    get_model, get_parameters = value
    variables = get_parameters(request.args)
    variables.update(generic.context(model, default={}, lookup=lookup))
    variables['parent'] = model
    variables['request'] = request
    variables.update(traject_variables)
    next_model = mapply(get_model, **variables)
    if next_model is None:
        return None
    request.unconsumed = stack
    return next_model