def viewdefaults(wrapped):
 def wrapper(self, *arg, **kw):
  defaults = {}
  if arg:
   view = arg[0]
  else:
   view = kw.get('view')
  view = self.maybe_dotted(view)
  if inspect.isclass(view):
   defaults = getattr(view, '__view_defaults__', {}).copy()
  if ('_backframes' not in kw):
   kw['_backframes'] = 1
  defaults.update(kw)
  return wrapped(self, *arg, **defaults)
 return functools.wraps(wrapped)(wrapper)

def viewdefaults ( wrapped ) : def wrapper ( self , * arg , ** kw ) : defaults = { } if arg : view = arg [ 0 ] else : view = kw . get ( 'view' ) view = self . maybe_dotted ( view ) if inspect . isclass ( view ) : defaults = getattr ( view , '__view_defaults__' , { } ) . copy ( ) if ( '_backframes' not in kw ) : kw [ '_backframes' ] = 1 defaults . update ( kw ) return wrapped ( self , * arg , ** defaults ) return functools . wraps ( wrapped ) ( wrapper )
decorator for add_view-like methods which takes into account __view_defaults__ attached to view it is passed .