Example #1
0
 def get_principal(self, id):
     try:
         return principalRegistry.getPrincipal(id)
     except PrincipalLookupError:
         pass
     except KeyError:
         pass
Example #2
0
 def get_principal(self, id):
     try:
         return principalRegistry.getPrincipal(id)
     except PrincipalLookupError:
         pass
     except KeyError:
         pass
Example #3
0
    def testUndoPrincipalTransactions(self):
        request = self.request
        bonobo = principalRegistry.getPrincipal('bonobo')
        request.setPrincipal(bonobo)
        view = UndoView(self.folder1, request)

        # Just test whether it accepts the principal.  We know that
        # our undo dummy above "works".
        self.undo._emulatePublication(request)
        view.undoPrincipalTransactions(['6'])
        self.assert_(self.undo.principal is bonobo)
Example #4
0
    def testPrincipalLastTransactionIsUndo(self):
        request = self.request
        bonobo = principalRegistry.getPrincipal('bonobo')
        request.setPrincipal(bonobo)

        view = UndoView(self.folder1, request)
        self.failIf(view.principalLastTransactionIsUndo())

        # now undo the last transaction
        self.undo._emulatePublication(request)
        self.undo.undoTransactions(['6'])

        self.assert_(view.principalLastTransactionIsUndo())
Example #5
0
    def testUndoPrincipalLastTransaction(self):
        request = self.request
        bonobo = principalRegistry.getPrincipal('bonobo')
        request.setPrincipal(bonobo)

        self.undo._emulatePublication(request)
        view = UndoView(self.folder1, request)
        view.undoPrincipalLastTransaction()

        last_txn = self.undo.getTransactions(None, 0, 1)[0]
        self.assert_(last_txn.has_key('undo'))
        self.assert_(last_txn['undo'])
        self.assertEqual(last_txn['user_name'], bonobo.id)
Example #6
0
    def testGetPrincipalTransactions(self):
        request = self.request
        bonobo = principalRegistry.getPrincipal('bonobo')
        request.setPrincipal(bonobo)

        view = UndoView(self.folder1, request)
        expected = self.undo.getPrincipalTransactions(bonobo)
        self.assertEqual(view.getPrincipalTransactions(), expected)
        self.assert_(self.undo.context is self.folder1)
        self.assert_(self.undo.principal is bonobo)

        # test showall parameter and principal
        self.undo.principal = None
        view.getPrincipalTransactions(showall=True)
        self.assert_(self.undo.context is None)
        self.assert_(self.undo.principal is bonobo)
Example #7
0
 def principalInfo(self, id):
     principal = principalRegistry.getPrincipal(id)
     if principal is not None:
         return PrincipalInfo(u'' + principal.id, principal.getLogin(),
                              principal.title, principal.description)