def test_get_and_set(self): username = PloneTestCase.default_user # login as simple user self.login(username) set_readby(self.obj) readby = get_readby(self.obj) self.failUnless(username in readby)
def test_readby_catalog_index(self): # check index existence ct = getToolByName(self.portal, 'portal_catalog') self.failUnless('readBy' in ct.indexes()) # check indexed value username = "******" set_readby(self.obj,userids=[username]) self.obj.reindexObject() brains = ct(readBy=username) self.failUnless(len(brains)==1)
def objectViewed(obj, event): """ adds creator's userid to readby """ set_readby(obj,userids=[event.user.getId()])
def set_readby(self, userids): set_readby(self.context, userids=userids)
def objectCreated(obj, event): """ adds creator's userid to readby """ set_readby(obj)