예제 #1
0
 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)
예제 #2
0
    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)
예제 #3
0
def objectViewed(obj, event):
    """ adds creator's userid to readby
    """
    set_readby(obj,userids=[event.user.getId()])
예제 #4
0
 def set_readby(self, userids):
     set_readby(self.context, userids=userids)
예제 #5
0
def objectCreated(obj, event):
    """ adds creator's userid to readby
    """
    set_readby(obj)