本文整理汇总了Python中plone.app.iterate.interfaces.ICheckinCheckoutPolicy.getBaseline方法的典型用法代码示例。如果您正苦于以下问题:Python ICheckinCheckoutPolicy.getBaseline方法的具体用法?Python ICheckinCheckoutPolicy.getBaseline怎么用?Python ICheckinCheckoutPolicy.getBaseline使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类plone.app.iterate.interfaces.ICheckinCheckoutPolicy
的用法示例。
在下文中一共展示了ICheckinCheckoutPolicy.getBaseline方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: checkin_allowed
# 需要导入模块: from plone.app.iterate.interfaces import ICheckinCheckoutPolicy [as 别名]
# 或者: from plone.app.iterate.interfaces.ICheckinCheckoutPolicy import getBaseline [as 别名]
def checkin_allowed(self):
"""Check if a checkin is allowed
"""
context = aq_inner(self.context)
checkPermission = getSecurityManager().checkPermission
if not interfaces.IIterateAware.providedBy(context):
return False
archiver = interfaces.IObjectArchiver(context)
if not archiver.isVersionable():
return False
if not IWorkingCopy.providedBy(context):
return False
policy = ICheckinCheckoutPolicy(context, None)
if policy is None:
return False
original = policy.getBaseline()
if original is None:
return False
can_modify = checkPermission(
Products.CMFCore.permissions.ModifyPortalContent,
original,
)
if not can_modify:
return False
return True
示例2: get_baseline_state
# 需要导入模块: from plone.app.iterate.interfaces import ICheckinCheckoutPolicy [as 别名]
# 或者: from plone.app.iterate.interfaces.ICheckinCheckoutPolicy import getBaseline [as 别名]
def get_baseline_state(self):
policy = ICheckinCheckoutPolicy(self.context)
baseline = policy.getBaseline()
if baseline is None:
baseline = self.context
return get_state(baseline)
示例3: cancel_allowed
# 需要导入模块: from plone.app.iterate.interfaces import ICheckinCheckoutPolicy [as 别名]
# 或者: from plone.app.iterate.interfaces.ICheckinCheckoutPolicy import getBaseline [as 别名]
def cancel_allowed(self):
"""Check to see if the user can cancel the checkout on the
given working copy
"""
policy = ICheckinCheckoutPolicy(self.context, None)
if policy is None:
return False
original = policy.getBaseline()
return original is not None
示例4: __call__
# 需要导入模块: from plone.app.iterate.interfaces import ICheckinCheckoutPolicy [as 别名]
# 或者: from plone.app.iterate.interfaces.ICheckinCheckoutPolicy import getBaseline [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()
示例5: checkout_allowed
# 需要导入模块: from plone.app.iterate.interfaces import ICheckinCheckoutPolicy [as 别名]
# 或者: from plone.app.iterate.interfaces.ICheckinCheckoutPolicy import getBaseline [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
示例6: handle_check
# 需要导入模块: from plone.app.iterate.interfaces import ICheckinCheckoutPolicy [as 别名]
# 或者: from plone.app.iterate.interfaces.ICheckinCheckoutPolicy import getBaseline [as 别名]
def handle_check(self):
policy = ICheckinCheckoutPolicy(self.context)
baseline = policy.getBaseline()
if baseline is None:
baseline = self.context
return self.request.response.redirect(baseline.absolute_url())