def build_page(rex, kwargs):
 target_node = (kwargs.get('node') or kwargs.get('project'))
 target_id = target_node._id
 data = {'target_id': target_id}
 data.update(kwargs)
 data.update(request.args.to_dict())
 try:
  return rex.format(**data)
 except KeyError:
  return None

def build_page ( rex , kwargs ) : target_node = ( kwargs . get ( 'node' ) or kwargs . get ( 'project' ) ) target_id = target_node . _id data = { 'target_id' : target_id } data . update ( kwargs ) data . update ( request . args . to_dict ( ) ) try : return rex . format ( ** data ) except KeyError : return None
build page key from format pattern and request data .