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


Python IAnnotations._p_changed方法代码示例

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


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

示例1: handle_daviz_delete

# 需要导入模块: from zope.annotation.interfaces import IAnnotations [as 别名]
# 或者: from zope.annotation.interfaces.IAnnotations import _p_changed [as 别名]
def handle_daviz_delete(context, event):
    """ Remove annotations from assessmentparts when a daviz has been deleted
    """
    context_uid = context.UID()
    refs = context.getBRefs()

    for o in refs:
        annot = IAnnotations(o).get(KEY, {})
        if context_uid in annot.keys():
            del annot[context_uid]
            annot._p_changed = True
            o._p_changed = True
开发者ID:davilima6,项目名称:eea.daviz,代码行数:14,代码来源:daviz.py

示例2: notify_outdated

# 需要导入模块: from zope.annotation.interfaces import IAnnotations [as 别名]
# 或者: from zope.annotation.interfaces.IAnnotations import _p_changed [as 别名]
    def notify_outdated(self):
        """ Notify providers by email about outdated implementations """

        # f*ck plone.protect
        alsoProvides(self.request, IDisableCSRFProtection)

        # remember when we send notifications for which component
        annotations = IAnnotations(self.context)
        notifications = annotations.get(NOTIFICATION_KEY)
        if not notifications:
            annotations[NOTIFICATION_KEY] = OOBTree()

        result = self.items()
        for item in self.items():

            version_info = item['version_info']

            # filter out irrelevant components
            if not version_info or version_info['is_current']:
                continue

            # preserve notification dates
            notification_key = (item['component'].getId(), version_info[
                                'current_version'], version_info['latest_version'])
            dt = annotations[NOTIFICATION_KEY].get(notification_key)
            if dt and (datetime.utcnow() - dt).days < RESEND_AFTER_DAYS:
                continue

            annotations[NOTIFICATION_KEY][notification_key] = datetime.utcnow()
            annotations._p_changed = True

            # build and send notification email
            dest_email = item['provider'].getAlarm_email(
            ) or item['provider'].getHelpdesk_email()
            subject = '[DPMT] New version for "{}" available'.format(
                item['component'].Title())

            params = dict(
                component_name=item['component'].Title(),
                component_url=item['component'].absolute_url(),
                current_version=version_info['current_version'],
                latest_version=version_info['latest_version'],
            )
            send_mail(
                sender=None,
                recipients=[dest_email],
                subject=subject,
                template='implementation-outdated.txt',
                params=params,
                context=item['provider'])
        return 'DONE'
开发者ID:EUDAT-DPMT,项目名称:pcp.contenttypes,代码行数:53,代码来源:provider.py

示例3: _deleteMenuEntries

# 需要导入模块: from zope.annotation.interfaces import IAnnotations [as 别名]
# 或者: from zope.annotation.interfaces.IAnnotations import _p_changed [as 别名]
    def _deleteMenuEntries(self, form):
        context = self.context
        extras, saved_customizations = self.getSavedCustomizations()

        to_delete = form.get('delete',[])
        if not to_delete:
            return _(u'Please, select at least one entry to be deleted'), 'error'
        saved_customizations = [x for x in saved_customizations if x['index'] not in to_delete]
        self._reindex(saved_customizations)
        
        annotations = IAnnotations(context)
        annotations[ANN_CUSTOMMENU_KEY] = (extras, saved_customizations)
        annotations._p_changed=1
        return _(u'Customizations removed')
开发者ID:keul,项目名称:redturtle.custommenu.factories,代码行数:16,代码来源:view.py

示例4: _updateMenuEntries

# 需要导入模块: from zope.annotation.interfaces import IAnnotations [as 别名]
# 或者: from zope.annotation.interfaces.IAnnotations import _p_changed [as 别名]
    def _updateMenuEntries(self, form):
        context = self.context
        saved_customizations = []

        for x in range(0, len(form.get('index',[]))):
            # check not-mandatory data
            if not form.get('element-name')[x] or not form.get('element-tales')[x]:
                return _(u'Please, provide all required data'), 'error'
            saved_customizations.append(
                self._generateNewMenuElement(x, form.get('element-id')[x], form.get('element-name')[x],
                                             form.get('element-descr')[x], form.get('icon-tales')[x],
                                             form.get('condition-tales')[x], form.get('element-tales')[x]))
        
        annotations = IAnnotations(context)
        annotations[ANN_CUSTOMMENU_KEY] = ({'inherit': form.get('inherit',False)}, saved_customizations)
        annotations._p_changed=1
        return _(u'Customizations updated')
开发者ID:keul,项目名称:redturtle.custommenu.factories,代码行数:19,代码来源:view.py

示例5: _addMenuEntry

# 需要导入模块: from zope.annotation.interfaces import IAnnotations [as 别名]
# 或者: from zope.annotation.interfaces.IAnnotations import _p_changed [as 别名]
 def _addMenuEntry(self, form):
     context = self.context
     
     # check not-mandatory data
     if not form.get('element-name') or not form.get('element-tales'):
         return _(u'Please, provide all required data'), 'error'
     
     extras, saved_customizations = self.getSavedCustomizations()
     saved_customizations.append(self._generateNewMenuElement(
                                     len(saved_customizations),
                                     form.get('element-id'),
                                     form.get('element-name'),
                                     form.get('element-descr'),
                                     form.get('icon-tales'),
                                     form.get('condition-tales'),
                                     form.get('element-tales'))
                                 )
     
     annotations = IAnnotations(context)
     annotations[ANN_CUSTOMMENU_KEY] = (extras, saved_customizations)
     annotations._p_changed=1
     return _(u'New entry added')
开发者ID:keul,项目名称:redturtle.custommenu.factories,代码行数:24,代码来源:view.py


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