当前位置: 首页>>代码示例>>Python>>正文


Python ICheckinCheckoutPolicy.getWorkingCopy方法代码示例

本文整理汇总了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')
开发者ID:eea,项目名称:eea.climateadapt.plone,代码行数:30,代码来源:views.py

示例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
开发者ID:eea,项目名称:eea.climateadapt.plone,代码行数:12,代码来源:viewlets.py

示例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()
开发者ID:plone,项目名称:plone.app.iterate,代码行数:13,代码来源:diff.py

示例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
开发者ID:plone,项目名称:plone.app.iterate,代码行数:26,代码来源:control.py

示例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
开发者ID:eea,项目名称:eea.climateadapt.plone,代码行数:7,代码来源:views.py


注:本文中的plone.app.iterate.interfaces.ICheckinCheckoutPolicy.getWorkingCopy方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。