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


Python Registry.notify方法代码示例

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


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

示例1: _set_local_roles

# 需要导入模块: from pyramid.registry import Registry [as 别名]
# 或者: from pyramid.registry.Registry import notify [as 别名]
def _set_local_roles(resource, new_local_roles: dict, registry: Registry):
    old_local_roles = getattr(resource, '__local_roles__', None)
    if new_local_roles == old_local_roles:
        return
    else:
        resource.__local_roles__ = new_local_roles
    event = LocalRolesModified(resource, new_local_roles, old_local_roles,
                               registry)
    registry.notify(event)
开发者ID:liqd,项目名称:adhocracy3,代码行数:11,代码来源:__init__.py

示例2: send_back_reference_removal_notificatons

# 需要导入模块: from pyramid.registry import Registry [as 别名]
# 或者: from pyramid.registry.Registry import notify [as 别名]
 def send_back_reference_removal_notificatons(self,
                                              references: [Reference],
                                              registry: Registry):
     """Send SheetBackReferenceRemoved to reference targets."""
     for reference in references:
         event = SheetBackReferenceRemoved(reference.target,
                                           reference.isheet,
                                           reference,
                                           registry)
         registry.notify(event)
开发者ID:liqd,项目名称:adhocracy3,代码行数:12,代码来源:__init__.py

示例3: remove

# 需要导入模块: from pyramid.registry import Registry [as 别名]
# 或者: from pyramid.registry.Registry import notify [as 别名]
    def remove(self, name, send_events: bool=True, registry: Registry=None,
               **kwargs):
        """Delete subresource `name` from database.

        :raises KeyError: if `name` is not a valid subresource name
        """
        subresource = self[name]
        registry = registry or get_current_registry(self)
        if send_events:  # pragma: no branch
            event = ResourceWillBeDeleted(object=subresource,
                                          parent=self,
                                          registry=registry)
            registry.notify(event)
        graph = find_graph(subresource)
        references = graph.get_refernces_for_removal_notificaton(subresource)
        res = super().remove(name,
                             registry=registry,
                             send_events=send_events,
                             **kwargs)
        graph.send_back_reference_removal_notificatons(references, registry)
        return res
开发者ID:liqd,项目名称:adhocracy3,代码行数:23,代码来源:pool.py

示例4: set_local_roles

# 需要导入模块: from pyramid.registry import Registry [as 别名]
# 或者: from pyramid.registry.Registry import notify [as 别名]
def set_local_roles(resource, new_local_roles: dict, registry: Registry=None):
    """Set the :term:`local role`s mapping to ``new_local_roles``.

    :param new_local_roles: Mapping from :term:`groupid`/:term:`userid` to
                            a set of :term:`role`s for the `resource`:

                            {'system.Everyone': {'role:reader'}}

    If the resource's `local roles` and the ``new_local_roles`` differ,
    set the ``new_local_roles`` via setattr and send a
    :class:`adhocracy_core.interfaces.ILocalRolesModified` to notify others.
    """
    _assert_values_have_set_type(new_local_roles)
    old_local_roles = getattr(resource, '__local_roles__', None)
    if new_local_roles == old_local_roles:
        return None
    else:
        resource.__local_roles__ = new_local_roles
    if registry is None:
        registry = get_current_registry()
    event = LocalRolesModified(resource, new_local_roles, old_local_roles,
                               registry)
    registry.notify(event)
开发者ID:robx,项目名称:adhocracy3.mercator,代码行数:25,代码来源:__init__.py


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