本文整理汇总了Python中plone.app.iterate.interfaces.ICheckinCheckoutPolicy.checkin方法的典型用法代码示例。如果您正苦于以下问题:Python ICheckinCheckoutPolicy.checkin方法的具体用法?Python ICheckinCheckoutPolicy.checkin怎么用?Python ICheckinCheckoutPolicy.checkin使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类plone.app.iterate.interfaces.ICheckinCheckoutPolicy
的用法示例。
在下文中一共展示了ICheckinCheckoutPolicy.checkin方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_annotation_saved_on_checkin
# 需要导入模块: from plone.app.iterate.interfaces import ICheckinCheckoutPolicy [as 别名]
# 或者: from plone.app.iterate.interfaces.ICheckinCheckoutPolicy import checkin [as 别名]
def test_annotation_saved_on_checkin(self):
# First we get and save a custom annotation to the existing object
obj_annotations = IAnnotations(self.s1)
self.assertEqual(obj_annotations, {})
obj_annotations['key1'] = u'value1'
obj_annotations = IAnnotations(self.s1)
self.assertEqual(obj_annotations, {'key1': u'value1'})
# Now, let's get a working copy for it.
locators = getAdapters((self.s1,), IWCContainerLocator)
location = u'plone.app.iterate.parent'
locator = [c[1] for c in locators if c[0] == location][0]
policy = ICheckinCheckoutPolicy(self.s1)
wc = policy.checkout(locator())
# Annotations should be the same
new_annotations = IAnnotations(wc)
self.assertEqual(new_annotations['key1'], u'value1')
# Now, let's modify the existing one, and create a new one
new_annotations['key1'] = u'value2'
new_annotations['key2'] = u'value1'
# Check that annotations were stored correctly and original ones were
# not overriten
new_annotations = IAnnotations(wc)
self.assertEqual(new_annotations['key1'], u'value2')
self.assertEqual(new_annotations['key2'], u'value1')
obj_annotations = IAnnotations(self.s1)
self.assertEqual(obj_annotations['key1'], u'value1')
self.assertFalse('key2' in obj_annotations)
# Now, we do a checkin
policy = ICheckinCheckoutPolicy(wc)
policy.checkin(u'Commit message')
# And finally check that the old object has the same annotations as
# its working copy
obj_annotations = IAnnotations(self.s1)
self.assertTrue('key1' in obj_annotations)
self.assertTrue('key2' in obj_annotations)
self.assertEqual(obj_annotations['key1'], u'value2')
self.assertEqual(obj_annotations['key2'], u'value1')
示例2: __call__
# 需要导入模块: from plone.app.iterate.interfaces import ICheckinCheckoutPolicy [as 别名]
# 或者: from plone.app.iterate.interfaces.ICheckinCheckoutPolicy import checkin [as 别名]
def __call__(self):
context = aq_inner(self.context)
if 'form.button.Checkin' in self.request.form:
control = getMultiAdapter(
(context, self.request), name=u'iterate_control')
if not control.checkin_allowed():
raise CheckinException(u'Not a checkout')
message = self.request.form.get('checkin_message', '')
policy = ICheckinCheckoutPolicy(context)
baseline = policy.checkin(message)
IStatusMessage(self.request).addStatusMessage(
_('Checked in'), type='info')
view_url = baseline.restrictedTraverse(
'@@plone_context_state').view_url()
self.request.response.redirect(view_url)
elif 'form.button.Cancel'in self.request.form:
view_url = context.restrictedTraverse(
'@@plone_context_state').view_url()
self.request.response.redirect(view_url)
else:
return self.index()
示例3: checkInIfNeeded
# 需要导入模块: from plone.app.iterate.interfaces import ICheckinCheckoutPolicy [as 别名]
# 或者: from plone.app.iterate.interfaces.ICheckinCheckoutPolicy import checkin [as 别名]
def checkInIfNeeded(document, event):
context = aq_inner(document)
workflowTool = getToolByName(context, "portal_workflow")
status = workflowTool.getStatusOf("1MX_wiki_workflow", document)
if IWorkingCopy.providedBy(context) and status["review_state"] == "internally_published":
policy = ICheckinCheckoutPolicy(context)
baseline = policy.checkin("")
IStatusMessage(context.REQUEST).addStatusMessage(
_("Checked in"), type='info')
view_url = baseline.unrestrictedTraverse("@@plone_context_state").view_url()
transaction.commit()
raise Redirect(view_url)
示例4: __call__
# 需要导入模块: from plone.app.iterate.interfaces import ICheckinCheckoutPolicy [as 别名]
# 或者: from plone.app.iterate.interfaces.ICheckinCheckoutPolicy import checkin [as 别名]
def __call__(self):
context = aq_inner(self.context)
if self.request.form.has_key('form.button.Checkin'):
control = getMultiAdapter((context, self.request), name=u"iterate_control")
if not control.checkin_allowed():
raise CheckinException(u"Not a checkout")
message = self.request.form.get('checkin_message', "")
policy = ICheckinCheckoutPolicy(context)
baseline = policy.checkin(message)
baseline.reindexObject()
IStatusMessage(self.request).addStatusMessage(_("Checked in"), type='info')
view_url = baseline.restrictedTraverse("@@plone_context_state").view_url()
self.request.response.redirect(view_url)
elif self.request.form.has_key('form.button.Cancel'):
view_url = context.restrictedTraverse("@@plone_context_state").view_url()
self.request.response.redirect(view_url)
else:
return self.template()
示例5: do_checkin
# 需要导入模块: from plone.app.iterate.interfaces import ICheckinCheckoutPolicy [as 别名]
# 或者: from plone.app.iterate.interfaces.ICheckinCheckoutPolicy import checkin [as 别名]
def do_checkin(self, working_copy):
policy = ICheckinCheckoutPolicy(working_copy)
return policy.checkin('')
示例6: do_checkin
# 需要导入模块: from plone.app.iterate.interfaces import ICheckinCheckoutPolicy [as 别名]
# 或者: from plone.app.iterate.interfaces.ICheckinCheckoutPolicy import checkin [as 别名]
def do_checkin(self, working_copy):
policy = ICheckinCheckoutPolicy(working_copy)
policy.checkin("")