def notifyAdded(self, id): """ see interfaces.py """ assert not id in self.order context = aq_base(self.context) obj = context._getOb(id) if IOrderable.providedBy(obj): self.order.append(id) self.context._p_changed = True # the order was changed
def testGetObjectPositionForNonOrderableContent(self): oid = self.folder.invokeFactory('Event', id='foo') obj = self.folder._getOb(oid) # a non-orderable object should return "no position" self.failIf(IOrderable.providedBy(obj), 'orderable events?') self.assertEqual(self.folder.getObjectPosition(oid), None) # a non-existant object should raise an error, though self.assertRaises(ValueError, self.folder.getObjectPosition, 'bar')