def autoload_filenode(must_be=None, default_root=False):
 def _autoload_filenode(func):
  @handle_odm_errors
  @must_have_addon('osfstorage', 'node')
  @functools.wraps(func)
  def wrapped(*args, **kwargs):
   node = kwargs['node']
   if (('fid' not in kwargs) and default_root):
    file_node = kwargs['node_addon'].get_root()
   else:
    file_node = models.OsfStorageFileNode.get(kwargs.get('fid'), node)
   if (must_be and (file_node.kind != must_be)):
    raise HTTPError(httplib.BAD_REQUEST, data={'message_short': 'incorrect type', 'message_long': 'FileNode must be of type {} not {}'.format(must_be, file_node.kind)})
   kwargs['file_node'] = file_node
   return func(*args, **kwargs)
  return wrapped
 return _autoload_filenode

def autoload_filenode ( must_be = None , default_root = False ) : def _autoload_filenode ( func ) : @ handle_odm_errors @ must_have_addon ( 'osfstorage' , 'node' ) @ functools . wraps ( func ) def wrapped ( * args , ** kwargs ) : node = kwargs [ 'node' ] if ( ( 'fid' not in kwargs ) and default_root ) : file_node = kwargs [ 'node_addon' ] . get_root ( ) else : file_node = models . OsfStorageFileNode . get ( kwargs . get ( 'fid' ) , node ) if ( must_be and ( file_node . kind != must_be ) ) : raise HTTPError ( httplib . BAD_REQUEST , data = { 'message_short' : 'incorrect type' , 'message_long' : 'FileNode must be of type {} not {}' . format ( must_be , file_node . kind ) } ) kwargs [ 'file_node' ] = file_node return func ( * args , ** kwargs ) return wrapped return _autoload_filenode
implies both must_have_addon osfstorage node and handle_odm_errors attempts to load fid as a osfstoragefilenode with viable constraints .