Mercurial > p > roundup > code
diff roundup/actions.py @ 6003:48a1f919f894
Flake8 cleanups.
| author | John Rouillard <rouilj@ieee.org> |
|---|---|
| date | Sat, 28 Dec 2019 12:50:11 -0500 |
| parents | ed02a1e0aa5d |
| children | 4c9acc580769 |
line wrap: on
line diff
--- a/roundup/actions.py Thu Dec 26 21:44:50 2019 -0500 +++ b/roundup/actions.py Sat Dec 28 12:50:11 2019 -0500 @@ -7,7 +7,7 @@ from roundup.exceptions import Unauthorised from roundup import hyperdb -from roundup.i18n import _ + class Action: def __init__(self, db, translator): @@ -24,7 +24,6 @@ self.permission(*args) return self.handle(*args) - def permission(self, *args): """Check whether the user has permission to execute this action. @@ -32,12 +31,10 @@ pass - def gettext(self, msgid): """Return the localized translation of msgid""" return self.translator.gettext(msgid) - _ = gettext @@ -47,11 +44,12 @@ classname, itemid = hyperdb.splitDesignator(designator) perm = self.db.security.hasPermission - if not perm('Retire', self.db.getuid(), classname=classname - , itemid=itemid): + if not perm('Retire', self.db.getuid(), classname=classname, + itemid=itemid): raise Unauthorised(self._('You do not have permission to retire ' 'or restore the %(classname)s class.') - %locals()) + % locals()) + class Retire(PermCheck): @@ -61,7 +59,7 @@ # make sure we don't try to retire admin or anonymous if (classname == 'user' and - self.db.user.get(itemid, 'username') in ('admin', 'anonymous')): + self.db.user.get(itemid, 'username') in ('admin', 'anonymous')): raise ValueError(self._( 'You may not retire the admin or anonymous user')) @@ -79,4 +77,3 @@ # do the restore self.db.getclass(classname).restore(itemid) self.db.commit() -
