Пример #1
0
    def init_env(self, request):
        def revert():
            EnvironmentManager.set('current_blok', None)
            del RegistryManager.loaded_bloks['testCore']
            RegistryManager.undeclare_core('test')

        request.addfinalizer(revert)
        RegistryManager.declare_core('test')
        RegistryManager.init_blok('testCore')
        EnvironmentManager.set('current_blok', 'testCore')
Пример #2
0
        :param parent: Existing declaration
        :param name: Name of the new declaration to add it
        :param cls_: Class Interface to add in the declaration
        """
        if not hasattr(parent, name):
            core = type(name, tuple(), {})
            setattr(parent, name, core)

        if parent == Declarations:
            return

        RegistryManager.add_core_in_register(name, cls_)

    @classmethod
    def unregister(self, entry, cls_):
        """ Remove the Interface from the registry

        :param entry: entry declaration of the model where the ``cls_``
            must be removed
        :param cls_: Class Interface to remove in the declaration
        """
        RegistryManager.remove_in_register(cls_)


RegistryManager.declare_core('Base')
RegistryManager.declare_core('SqlBase')
RegistryManager.declare_core('SqlViewBase')
RegistryManager.declare_core('Session')
RegistryManager.declare_core('Query')
RegistryManager.declare_core('InstrumentedList')
Пример #3
0
 def setUpClass(cls):
     super(TestRegistryCore, cls).setUpClass()
     RegistryManager.declare_core('test')
     RegistryManager.init_blok('testCore')
     EnvironmentManager.set('current_blok', 'testCore')
Пример #4
0
        :param parent: Existing declaration
        :param name: Name of the new declaration to add it
        :param cls_: Class Interface to add in the declaration
        """
        if not hasattr(parent, name):
            core = type(name, tuple(), {})
            setattr(parent, name, core)

        if parent == Declarations:
            return

        RegistryManager.add_core_in_register(name, cls_)

    @classmethod
    def unregister(self, entry, cls_):
        """ Remove the Interface from the registry

        :param entry: entry declaration of the model where the ``cls_``
            must be removed
        :param cls_: Class Interface to remove in the declaration
        """
        RegistryManager.remove_in_register(cls_)


RegistryManager.declare_core('Base')
RegistryManager.declare_core('SqlBase')
RegistryManager.declare_core('SqlViewBase')
RegistryManager.declare_core('Session')
RegistryManager.declare_core('Query')
RegistryManager.declare_core('InstrumentedList')
Пример #5
0
 def setUpClass(cls):
     super(TestRegistryCore, cls).setUpClass()
     RegistryManager.declare_core('test')
     RegistryManager.init_blok('testCore')
     EnvironmentManager.set('current_blok', 'testCore')