當前位置: 首頁>>代碼示例>>Python>>正文


Python blok.Blok類代碼示例

本文整理匯總了Python中anyblok.blok.Blok的典型用法代碼示例。如果您正苦於以下問題:Python Blok類的具體用法?Python Blok怎麽用?Python Blok使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了Blok類的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_replace_blok_by_another_in_one_step

 def test_replace_blok_by_another_in_one_step(self):
     registry = self.init_registry(None)
     Blok = registry.System.Blok
     testblok1 = Blok.query().filter(Blok.name == 'test-blok1').first()
     testblok13 = Blok.query().filter(Blok.name == 'test-blok13').first()
     registry.upgrade(install=('test-blok1',))
     self.assertEqual(testblok1.state, 'installed')
     self.assertEqual(testblok13.state, 'uninstalled')
     registry.upgrade(uninstall=('test-blok1',), install=('test-blok13',))
     self.assertEqual(testblok1.state, 'uninstalled')
     self.assertEqual(testblok13.state, 'installed')
開發者ID:petrus-v,項目名稱:AnyBlok,代碼行數:11,代碼來源:test_blok.py

示例2: test_install

 def test_install(self):
     registry = self.init_registry(None)
     Blok = registry.System.Blok
     registry.upgrade(install=('test-blok6',))
     testblok1 = Blok.query().filter(Blok.name == 'test-blok1').first()
     testblok6 = Blok.query().filter(Blok.name == 'test-blok6').first()
     self.assertEqual(testblok1.state, 'installed')
     self.assertEqual(testblok1.version, '1.0.0')
     self.assertEqual(testblok1.installed_version, '1.0.0')
     self.assertEqual(testblok6.state, 'installed')
     self.assertEqual(testblok6.version, '1.0.0')
     self.assertEqual(testblok6.installed_version, '1.0.0')
開發者ID:petrus-v,項目名稱:AnyBlok,代碼行數:12,代碼來源:test_blok.py

示例3: test_update_required

 def test_update_required(self):
     registry = self.init_registry(None)
     registry.upgrade(install=('test-blok2',))
     Blok = registry.System.Blok
     testblok1 = Blok.query().filter(Blok.name == 'test-blok1').first()
     testblok2 = Blok.query().filter(Blok.name == 'test-blok2').first()
     testblok1.version = '2.0.0'
     testblok2.version = '2.0.0'
     registry.upgrade(update=('test-blok1',))
     self.assertEqual(testblok1.state, 'installed')
     self.assertEqual(testblok1.installed_version, '2.0.0')
     self.assertEqual(testblok2.state, 'installed')
     self.assertEqual(testblok2.installed_version, '2.0.0')
開發者ID:petrus-v,項目名稱:AnyBlok,代碼行數:13,代碼來源:test_blok.py

示例4: test_uninstall

 def test_uninstall(self):
     registry = self.init_registry(None)
     registry.upgrade(install=('test-blok2',))
     registry.upgrade(uninstall=('test-blok2',))
     Blok = registry.System.Blok
     testblok1 = Blok.query().filter(Blok.name == 'test-blok1').first()
     testblok2 = Blok.query().filter(Blok.name == 'test-blok2').first()
     self.assertEqual(testblok1.state, 'installed')
     self.assertEqual(testblok1.version, '1.0.0')
     self.assertEqual(testblok1.installed_version, '1.0.0')
     self.assertEqual(testblok2.state, 'uninstalled')
     self.assertEqual(testblok2.version, '1.0.0')
     self.assertIsNone(testblok2.installed_version)
開發者ID:jssuzanne,項目名稱:AnyBlok,代碼行數:13,代碼來源:test_blok.py

示例5: test_update_conditionnal

 def test_update_conditionnal(self):
     registry = self.init_registry(None)
     registry.upgrade(install=('test-blok5',))
     Blok = registry.System.Blok
     testblok1 = Blok.query().filter(Blok.name == 'test-blok1').first()
     testblok4 = Blok.query().filter(Blok.name == 'test-blok4').first()
     testblok5 = Blok.query().filter(Blok.name == 'test-blok5').first()
     testblok1.version = '2.0.0'
     testblok4.version = '2.0.0'
     testblok5.version = '2.0.0'
     registry.upgrade(update=('test-blok1',))
     self.assertEqual(testblok1.state, 'installed')
     self.assertEqual(testblok1.installed_version, '2.0.0')
     self.assertEqual(testblok4.state, 'installed')
     self.assertEqual(testblok4.installed_version, '1.0.0')
     self.assertEqual(testblok5.state, 'installed')
     self.assertEqual(testblok5.installed_version, '2.0.0')
開發者ID:petrus-v,項目名稱:AnyBlok,代碼行數:17,代碼來源:test_blok.py

示例6: test_blok_exist

    def test_blok_exist(self):
        registry = self.init_registry(None)
        Blok = registry.System.Blok
        query = Blok.query().filter(Blok.name == 'test-blok2')
        if not query.count():
            self.fail('No blok found')

        testblok2 = query.first()
        self.assertEqual(testblok2.state, 'uninstalled')
        self.assertEqual(testblok2.version, '1.0.0')
        self.assertEqual(testblok2.installed_version, None)
        self.assertEqual(testblok2.short_description, 'Test blok2')
開發者ID:petrus-v,項目名稱:AnyBlok,代碼行數:12,代碼來源:test_blok.py

示例7: test_install_1by1

 def test_install_1by1(self):
     registry = self.init_registry(None)
     registry.upgrade(install=('test-blok1',))
     Blok = registry.System.Blok
     testblok1 = Blok.query().filter(Blok.name == 'test-blok1').first()
     testblok4 = Blok.query().filter(Blok.name == 'test-blok4').first()
     testblok5 = Blok.query().filter(Blok.name == 'test-blok5').first()
     self.assertEqual(testblok1.state, 'installed')
     self.assertEqual(testblok1.version, '1.0.0')
     self.assertEqual(testblok1.installed_version, '1.0.0')
     self.assertEqual(testblok4.state, 'uninstalled')
     self.assertEqual(testblok4.version, '1.0.0')
     self.assertEqual(testblok4.installed_version, None)
     self.assertEqual(testblok5.state, 'uninstalled')
     self.assertEqual(testblok5.version, '1.0.0')
     self.assertEqual(testblok5.installed_version, None)
     registry.upgrade(install=('test-blok4',))
     testblok1 = Blok.query().filter(Blok.name == 'test-blok1').first()
     testblok4 = Blok.query().filter(Blok.name == 'test-blok4').first()
     testblok5 = Blok.query().filter(Blok.name == 'test-blok5').first()
     self.assertEqual(testblok1.state, 'installed')
     self.assertEqual(testblok1.version, '1.0.0')
     self.assertEqual(testblok1.installed_version, '1.0.0')
     self.assertEqual(testblok4.state, 'installed')
     self.assertEqual(testblok4.version, '1.0.0')
     self.assertEqual(testblok4.installed_version, '1.0.0')
     self.assertEqual(testblok5.state, 'installed')
     self.assertEqual(testblok5.version, '1.0.0')
     self.assertEqual(testblok5.installed_version, '1.0.0')
開發者ID:petrus-v,項目名稱:AnyBlok,代碼行數:29,代碼來源:test_blok.py

示例8: load

    def load(self):
        from os.path import join
        tmpl = Template()
        Blok = self.registry.System.Blok
        for blok in Blok.list_by_state('installed'):
            b = BlokManager.get(blok)
            if hasattr(b, 'views'):
                bpath = BlokManager.getPath(blok)
                for template in b.views:
                    with open(join(bpath, template), 'r') as fp:
                        tmpl.load_file(fp)

        tmpl.compile()
        self.registry.erpblok_views = tmpl
開發者ID:ERPBlok,項目名稱:ERPBlok,代碼行數:14,代碼來源:__init__.py


注:本文中的anyblok.blok.Blok類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。