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


Python threadlocal.get_current_registry方法代码示例

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


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

示例1: create_object

# 需要导入模块: from pyramid import threadlocal [as 别名]
# 或者: from pyramid.threadlocal import get_current_registry [as 别名]
def create_object(content_type, args={}):
    registry = get_current_registry()
    factory = registry.content.content_types.get(content_type, None)
    config = INTERFACES_CONFIG.get(content_type, None)
    if not factory or not config:
        return args

    interface = config.get('interface', None)
    deserializer = config.get('deserializer', None)
    obj = None
    if interface:
        result = {a: create_attr_obj(interface[a], args.get(a))
                  for a in interface if a in args and
                  isinstance(interface[a], Attribute)}
        result.update({a: args.get(a) for a in args if a not in interface})
        deserialized_args = deserializer(result)
        obj = factory(**deserialized_args)
    else:
        obj = factory(**args)

    return obj 
开发者ID:ecreall,项目名称:lagendacommun,代码行数:23,代码来源:data_manager.py

示例2: mysubscriber

# 需要导入模块: from pyramid import threadlocal [as 别名]
# 或者: from pyramid.threadlocal import get_current_registry [as 别名]
def mysubscriber(event):
    """Add the lac catalog when the root is added."""
    root = event.object
    registry = get_current_registry()
    settings = registry.settings
    lac_title = settings.get('lac.title')
    root.title = lac_title
    catalogs = find_service(root, 'catalogs')
    catalogs.add_catalog('lac')
    default_site = SiteFolder(title="Création culturelle")
    default_site.urls_ids = PersistentList(DEFAULT_SITE_ID)
    root.addtoproperty('site_folders', default_site)
    add_storage_to_root(root, registry)
    root.default_site = default_site 
开发者ID:ecreall,项目名称:lagendacommun,代码行数:16,代码来源:subscribers.py

示例3: _getattribute

# 需要导入模块: from pyramid import threadlocal [as 别名]
# 或者: from pyramid.threadlocal import get_current_registry [as 别名]
def _getattribute(self, value, **args):
        adapter = get_current_registry().queryAdapter(value, ISearchableObject)
        if adapter is None:
            return [(value, self.default_value)]

        cities = adapter.object_city()
        return [(value, c.title()) for c in cities] 
开发者ID:ecreall,项目名称:lagendacommun,代码行数:9,代码来源:classification.py

示例4: __call__

# 需要导入模块: from pyramid import threadlocal [as 别名]
# 或者: from pyramid.threadlocal import get_current_registry [as 别名]
def __call__(self):
        root = getSite()
        if not global_user_processsecurity(None, root):
            return {'error': True}

        dace_ui_api = get_current_registry().getUtility(IDaceUIAPI,
                                                        'dace_ui_api')
        actions = dace_ui_api.get_actions([root], self.request)
        admin_actions = [a for a in actions
                         if getattr(a[1], 'style_descriminator', '') ==
                         'admin-action']
        return {'groups': group_actions(admin_actions),
                'pictos': {g: v[1] for g, v in GROUPS_PICTO.items()},
                'error': False} 
开发者ID:ecreall,项目名称:lagendacommun,代码行数:16,代码来源:panels.py

示例5: add_site_facebook_login

# 需要导入模块: from pyramid import threadlocal [as 别名]
# 或者: from pyramid.threadlocal import get_current_registry [as 别名]
def add_site_facebook_login(site, app):
    registry = get_current_registry()
    config = Configurator(registry=registry, autocommit=True)
    name = app.application_site_id
    add_facebook_login(
        config,
        consumer_key=getattr(app, 'consumer_key', ''),
        consumer_secret=getattr(app, 'consumer_secret', ''),
        scope=getattr(app, 'scop', ''),
        login_path='/login/'+name,
        callback_path='/login/'+name+'/callback',
        name=name) 
开发者ID:ecreall,项目名称:lagendacommun,代码行数:14,代码来源:social_login.py

示例6: add_site_twitter_login

# 需要导入模块: from pyramid import threadlocal [as 别名]
# 或者: from pyramid.threadlocal import get_current_registry [as 别名]
def add_site_twitter_login(site, app):
    registry = get_current_registry()
    config = Configurator(registry=registry, autocommit=True)
    name = app.application_site_id
    add_twitter_login(
        config,
        consumer_key=getattr(app, 'consumer_key', ''),
        consumer_secret=getattr(app, 'consumer_secret', ''),
        login_path='/login/'+name,
        callback_path='/login/'+name+'/callback',
        name=name) 
开发者ID:ecreall,项目名称:lagendacommun,代码行数:13,代码来源:social_login.py

示例7: add_site_google_login

# 需要导入模块: from pyramid import threadlocal [as 别名]
# 或者: from pyramid.threadlocal import get_current_registry [as 别名]
def add_site_google_login(site, app):
    registry = get_current_registry()
    config = Configurator(registry=registry, autocommit=True)
    name = app.application_site_id
    add_google_login(
        config,
        consumer_key=getattr(app, 'consumer_key', ''),
        consumer_secret=getattr(app, 'consumer_secret', ''),
        scope=getattr(app, 'scope', ''),
        login_path='/login/'+name,
        callback_path='/login/'+name+'/callback',
        name=name) 
开发者ID:ecreall,项目名称:lagendacommun,代码行数:14,代码来源:social_login.py

示例8: release_date

# 需要导入模块: from pyramid import threadlocal [as 别名]
# 或者: from pyramid.threadlocal import get_current_registry [as 别名]
def release_date(self, default):
        adapter = get_current_registry().queryAdapter(
            self.resource, ISearchableObject)
        if adapter is None:
            return default

        return adapter.release_date() 
开发者ID:ecreall,项目名称:lagendacommun,代码行数:9,代码来源:catalog.py

示例9: publication_end_date

# 需要导入模块: from pyramid import threadlocal [as 别名]
# 或者: from pyramid.threadlocal import get_current_registry [as 别名]
def publication_end_date(self, default):
        adapter = get_current_registry().queryAdapter(
            self.resource, ISearchableObject)
        if adapter is None:
            return default

        return adapter.publication_end_date() 
开发者ID:ecreall,项目名称:lagendacommun,代码行数:9,代码来源:catalog.py

示例10: start_date

# 需要导入模块: from pyramid import threadlocal [as 别名]
# 或者: from pyramid.threadlocal import get_current_registry [as 别名]
def start_date(self, default):
        adapter = get_current_registry().queryAdapter(
            self.resource, ISearchableObject)
        if adapter is None:
            return default

        return adapter.start_date() 
开发者ID:ecreall,项目名称:lagendacommun,代码行数:9,代码来源:catalog.py

示例11: end_date

# 需要导入模块: from pyramid import threadlocal [as 别名]
# 或者: from pyramid.threadlocal import get_current_registry [as 别名]
def end_date(self, default):
        adapter = get_current_registry().queryAdapter(
            self.resource, ISearchableObject)
        if adapter is None:
            return default

        return adapter.end_date() 
开发者ID:ecreall,项目名称:lagendacommun,代码行数:9,代码来源:catalog.py

示例12: object_keywords

# 需要导入模块: from pyramid import threadlocal [as 别名]
# 或者: from pyramid.threadlocal import get_current_registry [as 别名]
def object_keywords(self, default):
        adapter = get_current_registry().queryAdapter(
            self.resource, ISearchableObject)
        if adapter is None:
            return default

        return adapter.object_keywords() 
开发者ID:ecreall,项目名称:lagendacommun,代码行数:9,代码来源:catalog.py

示例13: object_authors

# 需要导入模块: from pyramid import threadlocal [as 别名]
# 或者: from pyramid.threadlocal import get_current_registry [as 别名]
def object_authors(self, default):
        adapter = get_current_registry().queryAdapter(
            self.resource, ISearchableObject)
        if adapter is None:
            return default

        return adapter.object_authors() 
开发者ID:ecreall,项目名称:lagendacommun,代码行数:9,代码来源:catalog.py

示例14: created_at

# 需要导入模块: from pyramid import threadlocal [as 别名]
# 或者: from pyramid.threadlocal import get_current_registry [as 别名]
def created_at(self, default):
        adapter = get_current_registry().queryAdapter(
            self.resource, ISearchableObject)
        if adapter is None:
            return default

        created_at = adapter.created_at()
        if created_at is None:
            return default

        return created_at 
开发者ID:ecreall,项目名称:lagendacommun,代码行数:13,代码来源:catalog.py

示例15: modified_at

# 需要导入模块: from pyramid import threadlocal [as 别名]
# 或者: from pyramid.threadlocal import get_current_registry [as 别名]
def modified_at(self, default):
        adapter = get_current_registry().queryAdapter(
            self.resource, ISearchableObject)
        if adapter is None:
            return default

        modified_at = adapter.modified_at()
        if modified_at is None:
            return default

        return modified_at 
开发者ID:ecreall,项目名称:lagendacommun,代码行数:13,代码来源:catalog.py


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