def test_after_checkout(self):
        working_copy = self.do_checkout()
        self.assertTrue(working_copy)
        self.assertTrue(IIterateAware.providedBy(working_copy))
        self.assertFalse(IBaseline.providedBy(working_copy))
        self.assertTrue(IWorkingCopy.providedBy(working_copy))

        self.assertTrue(IIterateAware.providedBy(self.obj))
        self.assertTrue(IBaseline.providedBy(self.obj))
        self.assertFalse(IWorkingCopy.providedBy(self.obj))
Ejemplo n.º 2
0
    def test_after_checkout(self):
        working_copy = self.do_checkout()
        self.assertTrue(working_copy)
        self.assertTrue(IIterateAware.providedBy(working_copy))
        self.assertFalse(IBaseline.providedBy(working_copy))
        self.assertTrue(IWorkingCopy.providedBy(working_copy))

        self.assertTrue(IIterateAware.providedBy(self.obj))
        self.assertTrue(IBaseline.providedBy(self.obj))
        self.assertFalse(IWorkingCopy.providedBy(self.obj))
Ejemplo n.º 3
0
 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()
Ejemplo n.º 4
0
 def __init__( self, context, request ):
     self.context = context
     self.request = request
     if IBaseline.providedBy( self.context ):
         self.baseline = context
         self.working_copy = context.getBackReferences( WorkingCopyRelation.relationship )[0]
     elif IWorkingCopy.providedBy( self.context ):
         self.working_copy = context
         self.baseline = context.getReferences( WorkingCopyRelation.relationship )[0]
     else:
         raise AttributeError("Invalid Context")
Ejemplo n.º 5
0
 def __init__( self, context, request ):
     self.context = context
     self.request = request
     if IBaseline.providedBy( self.context ):
         self.baseline = context
         self.working_copy = get_working_copy(context)
     elif IWorkingCopy.providedBy( self.context ):
         self.working_copy = context
         self.baseline = get_baseline(context)
     else:
         raise AttributeError("Invalid Context")
Ejemplo n.º 6
0
 def __init__( self, context, request ):
     self.context = context
     self.request = request
     if HAS_STAGINGBEHAVIOR and IIterateAware.providedBy(context):
         if IBaseline.providedBy( self.context ):
             self.baseline = get_baseline(context)
             self.working_copy = get_working_copy(context)
         elif IWorkingCopy.providedBy( self.context ):
             self.working_copy = get_working_copy(context)
             self.baseline = get_baseline(context)
         else:
             raise AttributeError("Invalid Context")
     else:
         if IBaseline.providedBy( self.context ):
             self.baseline = context
             self.working_copy = context.getBackReferences( WorkingCopyRelation.relationship )[0]
         elif IWorkingCopy.providedBy( self.context ):
             self.working_copy = context
             self.baseline = context.getReferences( WorkingCopyRelation.relationship )[0]
         else:
             raise AttributeError("Invalid Context")
Ejemplo n.º 7
0
 def creator_name( self ):
     creator = self.creator()
     if creator is not None:
         return creator.getProperty('fullname') or creator.getId()
     # User is not known by PAS. This may be due to LDAP issues, so we keep
     # the user and log this.
     name = self.properties.get(keys.checkout_user)
     if IBaseline.providedBy(self.context):
         warning_tpl = "%s is a baseline of a plone.app.iterate checkout by an unknown user id '%s'"
     else:
         # IWorkingCopy.providedBy(self.context)
         warning_tpl = "%s is a working copy of a plone.app.iterate checkout by an unknown user id '%s'"
     logger.warning(warning_tpl, self.context, name)
     return name
Ejemplo n.º 8
0
 def creator_name( self ):
     creator = self.creator()
     if creator is not None:
         return creator.getProperty('fullname') or creator.getId()
     # User is not known by PAS. This may be due to LDAP issues, so we keep
     # the user and log this.
     name = self.properties.get(keys.checkout_user)
     if IBaseline.providedBy(self.context):
         warning_tpl = "%s is a baseline of a plone.app.iterate checkout by an unknown user id '%s'"
     else:
         # IWorkingCopy.providedBy(self.context)
         warning_tpl = "%s is a working copy of a plone.app.iterate checkout by an unknown user id '%s'"
     logger.warning(warning_tpl, self.context, name)
     return name
Ejemplo n.º 9
0
 def render(self):
     if IBaseline.providedBy(self.context) and self.working_copy() is not None:
         return self.index()
     return ""
 def test_before_checkout(self):
     self.assertTrue(self.obj)
     self.assertTrue(IIterateAware.providedBy(self.obj))
     self.assertFalse(IBaseline.providedBy(self.obj))
     self.assertFalse(IWorkingCopy.providedBy(self.obj))
Ejemplo n.º 11
0
 def render(self):
     if IBaseline.providedBy(
             self.context) and self.working_copy() is not None:
         return self.index()
     return ''
Ejemplo n.º 12
0
 def test_before_checkout(self):
     self.assertTrue(self.obj)
     self.assertTrue(IIterateAware.providedBy(self.obj))
     self.assertFalse(IBaseline.providedBy(self.obj))
     self.assertFalse(IWorkingCopy.providedBy(self.obj))