def mapper(cls, *arg, **kw): if cls.__init__ is object.__init__: def __init__(self, **kwargs): for key, value in kwargs.items(): setattr(self, key, value) cls.__init__ = __init__ sqla_mapper(cls, *arg, **kw) cls.query = scoped_session.query_property()
def mapper(cls, *arg, **kw): if cls.__init__ is object.__init__: def __init__(self, **kwargs): for key, value in kwargs.items(): setattr(self, key, value) scoped_session.add(self) # new mapped objects will be automatically added to the session cls.__init__ = __init__ cls.query = scoped_session.query_property() return sqla_mapper(cls, *arg, **kw)
def mapper(cls, *arg, **kw): if cls.__init__ is object.__init__: def __init__(self, **kwargs): for key, value in kwargs.items(): setattr(self, key, value) scoped_session.add( self ) # new mapped objects will be automatically added to the session cls.__init__ = __init__ cls.query = scoped_session.query_property() return sqla_mapper(cls, *arg, **kw)
def mapper( cls, *arg, **kw ): validate = kw.pop( 'validate', False ) if cls.__init__ is object.__init__: def __init__( self, **kwargs ): for key, value in kwargs.items(): if validate: if not cls_mapper.has_property( key ): raise TypeError( "Invalid __init__ argument: '%s'" % key ) setattr( self, key, value ) cls.__init__ = __init__ cls.query = scoped_session.query_property() # FIXME: eliminate the need for the following monkey patch by fixing the single # query in ~/datatypes/metadata.py in the FileParameter.wrap() method _monkeypatch_query_method( 'get', scoped_session, cls ) return sqla_mapper( cls, *arg, **kw )
def mapper(cls, *arg, **kw): validate = kw.pop('validate', False) if cls.__init__ is object.__init__: def __init__(self, **kwargs): for key, value in kwargs.items(): if validate: if not cls_mapper.has_property(key): raise TypeError("Invalid __init__ argument: '%s'" % key) setattr(self, key, value) cls.__init__ = __init__ cls.query = scoped_session.query_property() return sqla_mapper(cls, *arg, **kw)
def mapper(cls, *arg, **kw): validate = kw.pop('validate', False) if cls.__init__ is object.__init__: def __init__(self, **kwargs): for key, value in kwargs.items(): if validate: if not cls_mapper.has_property(key): raise TypeError("Invalid __init__ argument: '%s'" % key) setattr(self, key, value) cls.__init__ = __init__ cls.query = scoped_session.query_property() # FIXME: eliminate the need for the following monkey patch by fixing the single # query in ~/datatypes/metadata.py in the FileParameter.wrap() method _monkeypatch_query_method('get', scoped_session, cls) return sqla_mapper(cls, *arg, **kw)
def mapper(cls, *args, **kwargs): cls.query = scoped_session_.query_property() return sqla_mapper(cls, *args, **kwargs)
def mapper(cls, *arg, **kw): cls.query = scoped_session.query_property() return sqla_mapper(cls, *arg, **kw)
def mapper(cls, *arg, **kw): cls.query = session.query_property() return sqla_mapper(cls, *arg, **kw)