def view(tpl_name, **defaults):
 def decorator(func):
  @functools.wraps(func)
  def wrapper(*args, **kwargs):
   result = func(*args, **kwargs)
   if isinstance(result, (dict, DictMixin)):
    tplvars = defaults.copy()
    tplvars.update(result)
    return template(tpl_name, **tplvars)
   elif (result is None):
    return template(tpl_name, defaults)
   return result
  return wrapper
 return decorator

def view ( tpl_name , ** defaults ) : def decorator ( func ) : @ functools . wraps ( func ) def wrapper ( * args , ** kwargs ) : result = func ( * args , ** kwargs ) if isinstance ( result , ( dict , DictMixin ) ) : tplvars = defaults . copy ( ) tplvars . update ( result ) return template ( tpl_name , ** tplvars ) elif ( result is None ) : return template ( tpl_name , defaults ) return result return wrapper return decorator
open a browser to view the specified location .