当前位置: 首页>>代码示例>>Python>>正文


Python BlokManager.get方法代码示例

本文整理汇总了Python中anyblok.blok.BlokManager.get方法的典型用法代码示例。如果您正苦于以下问题:Python BlokManager.get方法的具体用法?Python BlokManager.get怎么用?Python BlokManager.get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在anyblok.blok.BlokManager的用法示例。


在下文中一共展示了BlokManager.get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_get_invalid_blok

# 需要导入模块: from anyblok.blok import BlokManager [as 别名]
# 或者: from anyblok.blok.BlokManager import get [as 别名]
 def test_get_invalid_blok(self):
     try:
         BlokManager.load()
         BlokManager.get('invalid blok')
         self.fail('No exception when get invalid blok')
     except BlokManagerException:
         pass
开发者ID:petrus-v,项目名称:AnyBlok,代码行数:9,代码来源:test_blok.py

示例2: test_load_anyblok

# 需要导入模块: from anyblok.blok import BlokManager [as 别名]
# 或者: from anyblok.blok.BlokManager import get [as 别名]
    def test_load_anyblok(self):
        BlokManager.load()
        if not BlokManager.list():
            self.fail('No blok load')
        if not BlokManager.has('anyblok-core'):
            self.fail("The blok 'anyblok-core' is missing")

        BlokManager.get('anyblok-core')
开发者ID:petrus-v,项目名称:AnyBlok,代码行数:10,代码来源:test_blok.py

示例3: test_reload

# 需要导入模块: from anyblok.blok import BlokManager [as 别名]
# 或者: from anyblok.blok.BlokManager import get [as 别名]
 def test_reload(self):
     BlokManager.load()
     BlokManager.set('invalid blok', None)
     BlokManager.get('invalid blok')
     BlokManager.reload()
     try:
         BlokManager.get('invalid blok')
         self.fail("Reload classmethod doesn't reload the bloks")
     except BlokManagerException:
         pass
开发者ID:petrus-v,项目名称:AnyBlok,代码行数:12,代码来源:test_blok.py

示例4: imports

# 需要导入模块: from anyblok.blok import BlokManager [as 别名]
# 或者: from anyblok.blok.BlokManager import get [as 别名]
    def imports(self):
        """ Imports modules and / or packages listed in the blok path"""
        from anyblok.blok import BlokManager
        from anyblok.registry import RegistryManager

        RegistryManager.init_blok(self.blok)
        b = BlokManager.get(self.blok)
        b.import_declaration_module()
开发者ID:AnyBlok,项目名称:AnyBlok,代码行数:10,代码来源:imp.py

示例5: get_short_description

# 需要导入模块: from anyblok.blok import BlokManager [as 别名]
# 或者: from anyblok.blok.BlokManager import get [as 别名]
    def get_short_description(self):
        """ fget of the ``short_description`` Column.Selection

        :rtype: the docstring of the blok
        """
        blok = BlokManager.get(self.name)
        if hasattr(blok, '__doc__'):
            return blok.__doc__ or ''

        return ''
开发者ID:AnyBlok,项目名称:AnyBlok,代码行数:12,代码来源:blok.py

示例6: get_addons

# 需要导入模块: from anyblok.blok import BlokManager [as 别名]
# 或者: from anyblok.blok.BlokManager import get [as 别名]
def get_addons(request):
    res = []
    for blok_name in BlokManager.ordered_bloks:
        blok = BlokManager.get(blok_name)
        if hasattr(blok, 'setting_blok_description'):
            addons = blok.setting_blok_description
            addons['id'] = blok_name
            res.append(addons)

    return res
开发者ID:ERPBlok,项目名称:ERPBlok,代码行数:12,代码来源:database.py

示例7: get_logo

# 需要导入模块: from anyblok.blok import BlokManager [as 别名]
# 或者: from anyblok.blok.BlokManager import get [as 别名]
    def get_logo(self):
        """fget of ``logo`` return the path in the blok of the logo

        :rtype: absolute path or None if unexiste logo
        """
        blok = BlokManager.get(self.name)
        blok_path = BlokManager.getPath(blok.name)
        file_path = join(blok_path, blok.logo)
        if isfile(file_path):
            return file_path

        return None
开发者ID:AnyBlok,项目名称:AnyBlok,代码行数:14,代码来源:blok.py

示例8: get_templates_from

# 需要导入模块: from anyblok.blok import BlokManager [as 别名]
# 或者: from anyblok.blok.BlokManager import get [as 别名]
def get_templates_from(attr):
    tmpl = Template(forclient=True)
    for blok_name in BlokManager.ordered_bloks:
        blok = BlokManager.get(blok_name)
        if hasattr(blok, attr):
            bpath = BlokManager.getPath(blok_name)
            for template in getattr(blok, attr):
                with open(join(bpath, template), 'r') as fp:
                    tmpl.load_file(fp)

    tmpl.compile()
    return tmpl.get_all_template()
开发者ID:jssuzanne,项目名称:ERPBlok,代码行数:14,代码来源:common.py

示例9: load

# 需要导入模块: from anyblok.blok import BlokManager [as 别名]
# 或者: from anyblok.blok.BlokManager import get [as 别名]
    def load(self):
        """ Method to load the blok when the registry is completly loaded
        """
        name = self.name
        blok_cls = BlokManager.get(name)
        if blok_cls is None:
            logger.warning("load(): class of Blok %r not found, "
                           "Blok can't be loaded", name)
            return

        logger.info("Loading Blok %r", name)
        blok_cls(self.registry).load()
        logger.debug("Succesfully loaded Blok %r", name)
开发者ID:AnyBlok,项目名称:AnyBlok,代码行数:15,代码来源:blok.py

示例10: get_static

# 需要导入模块: from anyblok.blok import BlokManager [as 别名]
# 或者: from anyblok.blok.BlokManager import get [as 别名]
def get_static(static_type):
    """ Get in the Blok definition the static data from the client

    :param static: entry to read: css, js, ...
    :rtype: list of str
    """
    res = []
    for blok_name in BlokManager.ordered_bloks:
        blok = BlokManager.get(blok_name)
        if hasattr(blok, static_type):
            for static_url in getattr(blok, static_type):
                res.append(format_static(blok_name, static_url))

    return res
开发者ID:jssuzanne,项目名称:ERPBlok,代码行数:16,代码来源:common.py

示例11: load

# 需要导入模块: from anyblok.blok import BlokManager [as 别名]
# 或者: from anyblok.blok.BlokManager import get [as 别名]
    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,代码行数:16,代码来源:__init__.py

示例12: get_templates

# 需要导入模块: from anyblok.blok import BlokManager [as 别名]
# 或者: from anyblok.blok.BlokManager import get [as 别名]
    def get_templates(cls):
        """ Return the list of the web client template to load """
        from os.path import join
        tmpl = Template(forclient=True)
        Blok = cls.registry.System.Blok
        for blok in Blok.list_by_state('installed'):
            b = BlokManager.get(blok)
            if hasattr(b, 'client_templates'):
                bpath = BlokManager.getPath(blok)
                for template in b.client_templates:
                    with open(join(bpath, template), 'r') as fp:
                        tmpl.load_file(fp)

        tmpl.compile()
        return tmpl.get_all_template()
开发者ID:ERPBlok,项目名称:ERPBlok,代码行数:17,代码来源:__init__.py

示例13: get_static

# 需要导入模块: from anyblok.blok import BlokManager [as 别名]
# 或者: from anyblok.blok.BlokManager import get [as 别名]
    def get_static(cls, static_type):
        """ return the list of all static file path

        :param static_type: entry in the blok
        :rtype: list of the path
        """
        res = []
        Blok = cls.registry.System.Blok
        for blok in Blok.list_by_state('installed'):
            b = BlokManager.get(blok)
            if hasattr(b, static_type):
                for static_url in getattr(b, static_type):
                    res.append(cls.format_static(blok, static_url))

        return res
开发者ID:ERPBlok,项目名称:ERPBlok,代码行数:17,代码来源:__init__.py

示例14: load_config_bloks

# 需要导入模块: from anyblok.blok import BlokManager [as 别名]
# 或者: from anyblok.blok.BlokManager import get [as 别名]
    def load_config_bloks(self):
        """ loop on each blok, keep the order of the blok to load the
        pyramid config. The blok must declare the meth
        ``pyramid_load_config``::

            def pyramid_load_config(config):
                config.add_route('hello', '/hello/{name}/')
                ...

        """
        self.commit()
        for blok_name in BlokManager.ordered_bloks:
            blok = BlokManager.get(blok_name)
            if hasattr(blok, 'pyramid_load_config'):
                logger.debug('Load configuration from: %r' % blok_name)
                blok.pyramid_load_config(self)
                self.commit()
开发者ID:jssuzanne,项目名称:Anyblok_Pyramid,代码行数:19,代码来源:pyramid_config.py

示例15: get_long_description

# 需要导入模块: from anyblok.blok import BlokManager [as 别名]
# 或者: from anyblok.blok.BlokManager import get [as 别名]
    def get_long_description(self):
        """ fget of the ``long_description`` Column.Selection

        :rtype: the readme file of the blok
        """
        blok = BlokManager.get(self.name)
        path = BlokManager.getPath(self.name)
        readme = getattr(blok, 'readme', 'README.rst')
        if readme == '__doc__':
            return blok.__doc__

        file_path = join(path, readme)
        description = ''
        if isfile(file_path):
            with open(file_path, 'r') as fp:
                description = fp.read()

        return description
开发者ID:AnyBlok,项目名称:AnyBlok,代码行数:20,代码来源:blok.py


注:本文中的anyblok.blok.BlokManager.get方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。