本文整理汇总了Python中zope.annotation.interfaces.IAnnotations.items方法的典型用法代码示例。如果您正苦于以下问题:Python IAnnotations.items方法的具体用法?Python IAnnotations.items怎么用?Python IAnnotations.items使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类zope.annotation.interfaces.IAnnotations
的用法示例。
在下文中一共展示了IAnnotations.items方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __call__
# 需要导入模块: from zope.annotation.interfaces import IAnnotations [as 别名]
# 或者: from zope.annotation.interfaces.IAnnotations import items [as 别名]
def __call__(self):
query = {'portal_type': 'opengever.meeting.proposal'}
for proposal in self.objects(query, 'Fix proposal history'):
history = IAnnotations(proposal).get('object_history', OOBTree())
for key, value in history.items():
if value.get('name') and not value.get('history_type'):
value.update({'history_type': value.get('name')})
示例2: test_outputfilter_scaled
# 需要导入模块: from zope.annotation.interfaces import IAnnotations [as 别名]
# 或者: from zope.annotation.interfaces.IAnnotations import items [as 别名]
def test_outputfilter_scaled(self, browser):
page = browser.login().visit(self.obj)
annos = IAnnotations(self.obj)
scales = annos.items()[1][1].keys()
for scale in scales:
if isinstance(scale, str):
scale_uid = scale
image = page.css('.fileListing img')[1].node
self.assertEqual("http://nohost/plone/file/@@images/" + scale_uid + ".jpeg",
image.attrib['src'])
示例3: get_options
# 需要导入模块: from zope.annotation.interfaces import IAnnotations [as 别名]
# 或者: from zope.annotation.interfaces.IAnnotations import items [as 别名]
def get_options(self):
nav_root = self.context.restrictedTraverse(getNavigationRoot(self.context))
options = IAnnotations(nav_root).get('onegov.customstyles', {})
styles = []
for key, value in options.items():
if value and key.startswith('css.'):
styles.append('$%s: %s;' % (key.replace('css.',''),
value))
if value and key == 'custom_scss':
styles.append(value)
return '\n'.join(styles)
示例4: _get
# 需要导入模块: from zope.annotation.interfaces import IAnnotations [as 别名]
# 或者: from zope.annotation.interfaces.IAnnotations import items [as 别名]
def _get(kls, obj):
data = {}
try:
annotations = IAnnotations(obj)
except TypeError:
return {}
for key, annotation in annotations.items():
if key.startswith('Archetypes.storage') or \
key in _skipped_annotations or \
key.startswith('plone.portlets'):
# skip because this data should be handled elsewhere
continue
data[key] = annotation
return data
示例5: __call__
# 需要导入模块: from zope.annotation.interfaces import IAnnotations [as 别名]
# 或者: from zope.annotation.interfaces.IAnnotations import items [as 别名]
def __call__(self):
draftAnnotations = IAnnotations(self.draft)
targetAnnotations = IAnnotations(self.target)
for key, value in draftAnnotations.items():
if key.startswith(ANNOTATIONS_KEY_PREFIX):
targetAnnotations[key] = value
annotationsDeleted = getattr(
self.draft, '_proxyAnnotationsDeleted', set())
for key in annotationsDeleted:
if key.startswith(ANNOTATIONS_KEY_PREFIX) and key in targetAnnotations: # noqa
del targetAnnotations[key]
示例6: export
# 需要导入模块: from zope.annotation.interfaces import IAnnotations [as 别名]
# 或者: from zope.annotation.interfaces.IAnnotations import items [as 别名]
def export(self):
"""\
Generate and save structure, delete all objects, rebuild.
"""
if hasattr(self, 'exported'):
return self.exported
cur = self.export_source()
# we need the actual data, now.
self.exported = list(self._export(cur))
# delete all existing annotations
notes = IAnnotations(cur)
for key, obj in notes.items():
if IExposureFileNote.providedBy(obj):
del notes[key]
return self.exported
示例7: get_recipient_settings
# 需要导入模块: from zope.annotation.interfaces import IAnnotations [as 别名]
# 或者: from zope.annotation.interfaces.IAnnotations import items [as 别名]
def get_recipient_settings(megaphone, recipient_type):
data = IAnnotations(megaphone).get(ANNOTATION_KEY, {}).get('recipients', {})
return [(id, settings) for (id, settings) in data.items()
if settings.get('recipient_type', 'standard') == recipient_type]