本文整理汇总了Python中plone.folder.ordered.CMFOrderedBTreeFolderBase类的典型用法代码示例。如果您正苦于以下问题:Python CMFOrderedBTreeFolderBase类的具体用法?Python CMFOrderedBTreeFolderBase怎么用?Python CMFOrderedBTreeFolderBase使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CMFOrderedBTreeFolderBase类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self, id=None, **kwargs):
CMFOrderedBTreeFolderBase.__init__(self, id)
if id is not None:
self.id = id
for k, v in kwargs.items():
setattr(self, k, v)
# Ensure that the alias gets its own workflow history
self.workflow_history = PersistentMapping()
示例2: __init__
def __init__(self, id=None, **kwargs):
dublin_kw = {}
for arg in [ "title", "subject", "description", "contributors",
"effective_date", "expiration_date", "format", "language",
"rights"]:
if arg in kwargs:
dublin_kw[arg] = kwargs.pop(arg)
CMFOrderedBTreeFolderBase.__init__(self, id)
DefaultDublinCoreImpl.__init__(self, **dublin_kw)
for (k,v) in kwargs.items():
setattr(self, k, v)
示例3: has_key
def has_key(self, id):
"""Indicates whether the folder has an item by ID.
"""
if CMFOrderedBTreeFolderBase.has_key(self, id):
return True
return id in getSite() and id not in _languagelist and id not in _combinedlanguagelist
示例4: __getattr__
def __getattr__(self, name):
try:
return DexterityContent.__getattr__(self, name)
except AttributeError:
pass
# Be specific about the implementation we use
return CMFOrderedBTreeFolderBase.__getattr__(self, name)
示例5: __getitem__
def __getitem__(self, key):
aliased = getSite()
try:
obj = aliased.__getitem__(key)
new_object = aq_base(obj).__of__(self)
new_object._v_is_shared_content = True
return new_object
except KeyError:
return CMFOrderedBTreeFolderBase.__getitem__(self, key)
示例6: has_key
def has_key(self, item_id):
"""Indicates whether the folder has an item by ID.
"""
return (
CMFOrderedBTreeFolderBase.has_key(self, item_id) # noqa
or (
item_id in getSite()
and item_id not in BLACK_LIST_IDS
)
)
示例7: _getOb
def _getOb(self, id, default=_marker):
if self._aliasTraversal:
aliased = self._target
if aliased is not None:
obj = aliased._getOb(id, default)
if obj is default:
if default is _marker:
raise KeyError(id)
return default
return aq_base(obj).__of__(self)
return CMFOrderedBTreeFolderBase._getOb(self, id, default)
示例8: __getattr__
def __getattr__(self, name):
# attribute was not found; try to look it up in the schema and return
# a default
schema = SCHEMA_CACHE.get(self.portal_type)
if schema is not None:
field = schema.get(name, None)
if field is not None:
return deepcopy(field.default)
# Be specific about the implementation we use
return CMFOrderedBTreeFolderBase.__getattr__(self, name)
示例9: _getOb
def _getOb(self, item_id, default=_marker):
obj = CMFOrderedBTreeFolderBase._getOb(self, item_id, default)
if obj is not default:
return obj
aliased = getSite()
if aliased and item_id not in BLACK_LIST_IDS:
obj = aliased._getOb(item_id, default)
if obj is default:
return default
new_object = aq_base(obj).__of__(self)
new_object._v_is_shared_content = True
return new_object
if default is not _marker:
return default
示例10: _getOb
def _getOb(self, id, default=_marker):
obj = CMFOrderedBTreeFolderBase._getOb(self, id, default)
if obj is not default:
return obj
else:
aliased = getSite()
if aliased:
if (id not in _languagelist and id not in _combinedlanguagelist):
obj = aliased._getOb(id, default)
if obj is default:
# if default is _marker:
# raise KeyError
return default
new_object = aq_base(obj).__of__(self)
new_object._v_is_shared_content = True
return new_object
示例11: objectIds
def objectIds(self, spec=None, ordered=True):
# XXX : need to find better aproach
aliased = getSite()
aliased_objectIds = set()
if aliased is not None:
try:
# spec = ['Dexterity Container',
# 'Dexterity Item',
# 'ATFolder',
# 'ATDocument']
aliased_objectIds.update(aliased.objectIds(spec))
aliased_objectIds -= BLACK_LIST_IDS
except AttributeError:
pass
own_elements = CMFOrderedBTreeFolderBase.objectIds(self, spec, False)
return [item for item in own_elements] + list(aliased_objectIds)
示例12: objectIds
def objectIds(self, spec=None, ordered=True):
aliased = getSite()
# XXX : need to find better aproach
try:
if aliased is not None:
to_remove = []
# spec = ['Dexterity Container', 'Dexterity Item', 'ATFolder', 'ATDocument']
aliased_objectIds = list(aliased.objectIds(spec))
for id in aliased_objectIds:
if id in _languagelist or id in _combinedlanguagelist:
aliased_objectIds.remove(id)
else:
aliased_objectIds = []
except AttributeError:
aliased_objectIds = []
own_elements = CMFOrderedBTreeFolderBase.objectIds(self, spec, False)
return [item for item in own_elements] + aliased_objectIds
示例13: __init__
def __init__(self, id=None, **kwargs):
CMFOrderedBTreeFolderBase.__init__(self, id)
DexterityContent.__init__(self, id, **kwargs)
示例14: _checkId
def _checkId(self, id, allow_dup=0):
""" check only locally """
if not allow_dup and id in CMFOrderedBTreeFolderBase.objectIds(self, None, False):
raise BadRequestException('The id "%s" is invalid--'
'it is already in use.' % id)
示例15: __getitem__
def __getitem__(self, key):
if self._aliasTraversal:
aliased = self._target
if aliased is not None:
return aliased.__getitem__(key)
return CMFOrderedBTreeFolderBase.__getitem__(self, key)