本文整理汇总了Python中plone.app.iterate.interfaces.ICheckinCheckoutPolicy.getWorkingCopy方法的典型用法代码示例。如果您正苦于以下问题:Python ICheckinCheckoutPolicy.getWorkingCopy方法的具体用法?Python ICheckinCheckoutPolicy.getWorkingCopy怎么用?Python ICheckinCheckoutPolicy.getWorkingCopy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类plone.app.iterate.interfaces.ICheckinCheckoutPolicy
的用法示例。
在下文中一共展示了ICheckinCheckoutPolicy.getWorkingCopy方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: handle_edit
# 需要导入模块: from plone.app.iterate.interfaces import ICheckinCheckoutPolicy [as 别名]
# 或者: from plone.app.iterate.interfaces.ICheckinCheckoutPolicy import getWorkingCopy [as 别名]
def handle_edit(self):
policy = ICheckinCheckoutPolicy(self.context)
obj = policy.getWorkingCopy()
#baseline = policy.getBaseline()
if obj is None:
obj = self.context
state = get_state(obj)
if state in ['private', 'sent']:
url = '{0}/edit'.format(obj.absolute_url())
return self.request.response.redirect(url)
elif state == 'published':
# create copy, go to it
wc = self._checkout()
url = '{0}/edit'.format(wc.absolute_url())
return self.request.response.redirect(url)
elif state == 'pending':
# retract object, go to it
transition(obj, to_state='sent')
url = '{0}/edit'.format(obj.absolute_url())
return self.request.response.redirect(url)
raise ValueError ('unknown state')
示例2: get_working_copy
# 需要导入模块: from plone.app.iterate.interfaces import ICheckinCheckoutPolicy [as 别名]
# 或者: from plone.app.iterate.interfaces.ICheckinCheckoutPolicy import getWorkingCopy [as 别名]
def get_working_copy(self):
context = self.context
policy = ICheckinCheckoutPolicy(context, None)
if policy is None:
return False
wc = policy.getWorkingCopy()
return wc
示例3: __call__
# 需要导入模块: from plone.app.iterate.interfaces import ICheckinCheckoutPolicy [as 别名]
# 或者: from plone.app.iterate.interfaces.ICheckinCheckoutPolicy import getWorkingCopy [as 别名]
def __call__(self):
policy = ICheckinCheckoutPolicy(self.context)
if IBaseline.providedBy(self.context):
self.baseline = self.context
self.working_copy = policy.getWorkingCopy()
elif IWorkingCopy.providedBy(self.context):
self.working_copy = self.context
self.baseline = policy.getBaseline()
else:
raise AttributeError('Invalid Context')
return self.index()
示例4: checkout_allowed
# 需要导入模块: from plone.app.iterate.interfaces import ICheckinCheckoutPolicy [as 别名]
# 或者: from plone.app.iterate.interfaces.ICheckinCheckoutPolicy import getWorkingCopy [as 别名]
def checkout_allowed(self):
"""Check if a checkout is allowed.
"""
context = aq_inner(self.context)
if not interfaces.IIterateAware.providedBy(context):
return False
archiver = interfaces.IObjectArchiver(context)
if not archiver.isVersionable():
return False
policy = ICheckinCheckoutPolicy(context, None)
if policy is None:
return False
if policy.getWorkingCopy() is not None:
return False
# check if its is a checkout
if policy.getBaseline() is not None:
return False
return True
示例5: _get_working_copy
# 需要导入模块: from plone.app.iterate.interfaces import ICheckinCheckoutPolicy [as 别名]
# 或者: from plone.app.iterate.interfaces.ICheckinCheckoutPolicy import getWorkingCopy [as 别名]
def _get_working_copy(self):
# needed to function as override. TODO: check this statement
policy = ICheckinCheckoutPolicy(self.context)
obj = policy.getWorkingCopy()
return obj