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


Python Configuration.register_module方法代码示例

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


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

示例1: OrQuery

# 需要导入模块: from config import Configuration [as 别名]
# 或者: from config.Configuration import register_module [as 别名]
        if permission != 'share':
            return OrQuery(PhraseQuery('owner', str(user.abspath)), query)

        return query


    def has_permission(self, user, permission, resource, class_id=None):
        # The query
        query = AndQuery(
            self.get_search_query(user, permission, class_id),
            PhraseQuery('abspath', str(resource.abspath)))

        # Search
        results = get_context().search(query, user=user)
        return len(results) > 0


    def get_document_types(self):
        return [AccessRule]


    # Views
    class_views = ['browse_content', 'add_rule', 'edit']
    browse_content = ConfigAccess_Browse()
    add_rule = NewResource_Local(title=MSG(u'Add rule'))



# Register
Configuration.register_module(ConfigAccess)
开发者ID:hforge,项目名称:ikaaro,代码行数:32,代码来源:config_access.py

示例2: Footer

# 需要导入模块: from config import Configuration [as 别名]
# 或者: from config.Configuration import register_module [as 别名]
class Footer(WebPage):

    class_id = 'config-footer'
    class_title = MSG(u'Footer')
    class_description = MSG(u'Define the site footer.')
    class_icon_css = 'fa-sort-down'
    class_views = ['edit', 'externaledit']

    # Configuration
    config_name = 'footer'
    config_group = 'webmaster'


    def init_resource(self, **kw):
        body = """
        <html xmlns="http://www.w3.org/1999/xhtml">
        <body>
        <a href="/;powered_by">Powered by Ikaaro</a>
        </body>
        </html>
        """
        super(Footer, self).init_resource(data={'en': body}, **kw)


    # Views
    edit = File_Edit(fields=['data'])


# Register
Configuration.register_module(Footer)
开发者ID:hforge,项目名称:ikaaro,代码行数:32,代码来源:config_footer.py

示例3: target

# 需要导入模块: from config import Configuration [as 别名]
# 或者: from config.Configuration import register_module [as 别名]
        "items" contains the first level. Each item_dic contains in turn an
        'items' with its children.
        "class" is a CSS class decorating the item when active on within the
        current path.
        "id" is a CSS id to uniquely identify the item, based on the title.
        "target" is the anchor target (opening a new window or not).

        Activate "use_first_child" to automatically point to the first child
        of each item instead of the item itself.
        """
        resource = context.resource
        url = list(context.uri.path)
        if not url or url[-1][0] != ';':
            method = resource.get_default_view_name()
            url.append(';%s' % method)

        # Get the menu
        menu = self
        if src:
            menu = self.get_resource(src, soft=True)
            if menu is None:
                return []

        return menu.get_menu_namespace_level(context, url, show_first_child)



# Register
Configuration.register_module(ConfigMenu)
开发者ID:nicolasderam,项目名称:ikaaro,代码行数:31,代码来源:config_menu.py

示例4: ConfigVHosts

# 需要导入模块: from config import Configuration [as 别名]
# 或者: from config.Configuration import register_module [as 别名]
        vhosts = [ x.strip() for x in form['vhosts'].splitlines() ]
        vhosts = [ x for x in vhosts if x ]
        resource.set_value('vhosts', vhosts)
        # Ok
        context.message = MSG_CHANGES_SAVED



class ConfigVHosts(DBResource):

    class_id = 'config-vhosts'
    class_title = MSG(u'Virtual Hosts')
    class_description = MSG(u'Define the domain names for this Web Site.')
    class_icon48 = 'icons/48x48/website.png'

    # Fields
    vhosts = Char_Field(multiple=True, title=MSG(u'Domain names'),
                        widget=MultilineWidget)

    # Views
    class_views = ['edit']
    edit = ConfigVHosts_Edit

    # Configuration
    config_name = 'vhosts'
    config_group = 'webmaster'


# Register
Configuration.register_module(ConfigVHosts)
开发者ID:matrixorz,项目名称:ikaaro,代码行数:32,代码来源:config_vhosts.py

示例5: MSG

# 需要导入模块: from config import Configuration [as 别名]
# 或者: from config.Configuration import register_module [as 别名]
        message = MSG(
            u'<div id="registration-end-msg">'
            u'An email has been sent to you, to finish the registration '
            u'process follow the instructions detailed in it.</div>')
        return message.gettext().encode('utf-8')



class ConfigRegister(DBResource):

    class_id = 'config-register'
    class_title = MSG(u'User registration')
    class_description = MSG(u'Configuration of the user registration process.')
    class_icon_css = 'fa-user-plus'
    class_views = ['edit']

    # Configuration
    config_name = 'register'
    config_group = 'access'

    # Fields
    is_open = Boolean_Field(default=False,
                            title=MSG(u'Users can register by themselves'))
    tos = HTMLFile_Field(title=MSG(u"Terms of service"))

    # Views
    edit = AutoEdit(title=class_title, fields=['is_open', 'tos'])


Configuration.register_module(ConfigRegister)
开发者ID:hforge,项目名称:ikaaro,代码行数:32,代码来源:config_register.py

示例6: NewResource_Local

# 需要导入模块: from config import Configuration [as 别名]
# 或者: from config.Configuration import register_module [as 别名]
    class_icon48 = 'icons/48x48/groups.png'

    # Configuration
    config_name = 'groups'
    config_group = 'access'
    property_name = 'groups'

    # Views
    class_views = ['browse_content', 'add_group', 'edit', 'commit_log']
    browse_content = BrowseGroups
    add_group = NewResource_Local(title=MSG(u'Add group'))

    default_groups = [
        ('admins', {'en': u'Admins'}),
        ('reviewers', {'en': u'Reviewers'}),
        ('members', {'en': u'Members'})]


    def init_resource(self, **kw):
        super(ConfigGroups, self).init_resource(**kw)
        # Add default groups
        for name, title in self.default_groups:
            self.make_resource(name, Group, title=title)


    def get_document_types(self):
        return [Group]


Configuration.register_module(ConfigGroups)
开发者ID:matrixorz,项目名称:ikaaro,代码行数:32,代码来源:config_groups.py

示例7: Select_Field

# 需要导入模块: from config import Configuration [as 别名]
# 或者: from config.Configuration import register_module [as 别名]
    class_icon48 = '/ui/ikaaro/icons/48x48/captcha.png'

    # Fields
    captcha_type = Select_Field(
        required=True, title=MSG(u"Captcha type"), datatype=CaptchaType,
        widget = Select_CaptchaWidget(has_empty_option=False))

    # Views
    class_views = ['edit']
    edit = AutoEdit(title=MSG(u'Edit captcha'), fields=['captcha_type'])

    # Configuration
    config_name = 'captcha'
    config_group = 'access'


    def init_resource(self, **kw):
        super(Captcha, self).init_resource(**kw)
        # Init several captcha
        self.make_resource('question', Captcha_Question)
        self.make_resource('recaptcha', Captcha_Recaptcha)


    def get_captcha(self):
        captcha_type = self.get_value('captcha_type')
        return self.get_resource(captcha_type)


# Register captcha
Configuration.register_module(Captcha)
开发者ID:hforge,项目名称:ikaaro,代码行数:32,代码来源:config_captcha.py

示例8: super

# 需要导入模块: from config import Configuration [as 别名]
# 或者: from config.Configuration import register_module [as 别名]
        super(Theme, self).init_resource(**kw)
        # Access
        self.set_value('share', 'everybody')
        # CSS file
        path = get_abspath('ui/themes/style.css')
        data = open(path).read()
        self.set_value('style', data)
        # Logo
        path = get_abspath('ui/themes/logo.png')
        data = open(path).read()
        self.set_value('logo', data)
        # Banner
        path = get_abspath('ui/themes/banner.jpg')
        data = open(path).read()
        self.set_value('banner', data)

    # Views
    class_views = ['edit', 'browse_content', 'preview_content', 'links',
                   'backlinks', 'commit_log']

    edit = AutoEdit(fields=['favicon', 'logo', 'banner', 'style', 'share'])

    # Configuration
    config_name = 'theme'
    config_group = 'webmaster'



# Register
Configuration.register_module(Theme)
开发者ID:matrixorz,项目名称:ikaaro,代码行数:32,代码来源:config_theme.py

示例9: Users

# 需要导入模块: from config import Configuration [as 别名]
# 或者: from config.Configuration import register_module [as 别名]
# Users
###########################################################################
class Users(Folder):

    class_id = 'users'
    class_title = MSG(u'Users')
    class_description = MSG(u'Manage users.')
    class_icon48 = 'icons/48x48/userfolder.png'
    is_content = False

    def get_document_types(self):
        return [self.database.get_resource_class('user')]


    # Views
    class_views = ['browse_users', 'add_user', 'edit']
    browse_users = Users_Browse
    add_user = Users_AddUser

    # Configuration
    config_name = '/users'
    config_group = 'access'



###########################################################################
# Register
###########################################################################
Configuration.register_module(Users)
register_field('email_domain', String(indexed=True, stored=True))
开发者ID:nkhine,项目名称:ikaaro,代码行数:32,代码来源:users.py

示例10: ConfigMail

# 需要导入模块: from config import Configuration [as 别名]
# 或者: from config.Configuration import register_module [as 别名]
    fields = ['emails_from_addr', 'emails_reply_to', 'emails_signature',
              'contacts']



class ConfigMail(DBResource):

    class_id = 'config-mail'
    class_title = MSG(u'Email options')
    class_description = mail_description
    class_icon_css = 'fa-envelope'
    class_views = ['edit']

    # Fields
    contacts = Select_Field(multiple=True, datatype=ContactsOptions,
                            title=MSG(u'Select the contact accounts'),
                            has_empty_option=False)
    emails_from_addr = Text_Field(title=MSG(u'From header'))
    emails_reply_to = Boolean_Field(title=MSG(u'Reply to'), default=True)
    emails_signature = Textarea_Field(title=MSG(u'Signature'))

    # Views
    edit = ConfigMail_Edit()

    # Configuration
    config_name = 'mail'
    config_group = 'access'


Configuration.register_module(ConfigMail)
开发者ID:hforge,项目名称:ikaaro,代码行数:32,代码来源:config_mail.py

示例11: MSG

# 需要导入模块: from config import Configuration [as 别名]
# 或者: from config.Configuration import register_module [as 别名]
    class_id = 'config-seo'
    class_title = MSG(u'Search Engine Optimization')
    class_description = seo_description
    class_icon16 = 'icons/16x16/search.png'
    class_icon48 = 'icons/48x48/search.png'

    # Fields
    google_site_verification = Char_Field(
        title=MSG(u'Google site verification key'))
    yahoo_site_verification = Char_Field(
        title=MSG(u'Yahoo site verification key'))
    bing_site_verification = Char_Field(
        title=MSG(u'Bing site verification key'))


    # Views
    class_views = ['edit']
    edit = AutoEdit(title=MSG(u'Search engine optimization'),
                    description=seo_description,
                    fields=['google_site_verification',
                            'yahoo_site_verification',
                            'bing_site_verification'])

    # Configuration
    config_name = 'seo'
    config_group = 'webmaster'


# Register
Configuration.register_module(SEO)
开发者ID:matrixorz,项目名称:ikaaro,代码行数:32,代码来源:config_seo.py


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