Exemplo n.º 1
0
    def getModel(cls, modelType =None):
        this = AbstractPyGlassModelsMeta
        name = cls.__name__ + '_Master'

        if name in this._registry:
            return this._registry[name]

        # New method to be wrapped as the ORM reconstructor
        def reconstructor(self):
            self.ormInit()

        from pyglass.sqlalchemy.ConcretePyGlassModelsMeta import ConcretePyGlassModelsMeta
        this._registry[name] = ConcretePyGlassModelsMeta(
            name, (cls,), {
                '__module__':cls.__module__,
                'IS_MASTER':True,
                'ormReconstructor':orm.reconstructor(reconstructor) })

        return this._registry[name]
Exemplo n.º 2
0
    def getModel(cls, modelType =None):
        this     = AbstractModelsMeta
        isMaster = (modelType == 'MASTER')
        name     = cls.__name__ + ('_Master' if isMaster else '_Slave')

        if name in this._registry:
            return this._registry[name]

        # New method to be wrapped as the ORM reconstructor
        def reconstructor(self):
            self.ormInit()

        from ziggurat.sqlalchemy.meta.ConcreteModelsMeta import ConcreteModelsMeta
        this._registry[name] = ConcreteModelsMeta(
            name, (cls,), {
                '__module__':cls.__module__,
                'IS_MASTER':isMaster,
                'MODEL_TYPE':modelType,
                'ormReconstructor':orm.reconstructor(reconstructor) })

        return this._registry[name]
Exemplo n.º 3
0
 def map (self, *args, **kw) :
     reconstructor(self.cls._make_object)
     super().map(*args, **kw)