Mercurial > p > roundup > code
comparison roundup/cgi/client.py @ 2018:96a1bf48efdd
Remove duplication in permission handling:
* Use execute() as a Template Method, with permission() and handle()
as the hook methods.
* Provide a default implementation for the permission() method, which
checks for self.permissionType, if the attribute is defined.
* New hasPermission() method which checks whether the current user has
a permission on the current class
editItemPermission method:
* Better error message when user is editing roles when they shouldn't be.
* Extracted isEditingSelf(), which checks whether a user is editing
his/her own details.
* Use hasPermission method.
| author | Johannes Gijsbers <jlgijsbers@users.sourceforge.net> |
|---|---|
| date | Sat, 14 Feb 2004 19:58:20 +0000 |
| parents | 95f2c726f664 |
| children | 8fab5d394f22 |
comparison
equal
deleted
inserted
replaced
| 2017:31d920b31642 | 2018:96a1bf48efdd |
|---|---|
| 1 # $Id: client.py,v 1.159 2004-02-14 11:27:23 jlgijsbers Exp $ | 1 # $Id: client.py,v 1.160 2004-02-14 19:58:20 jlgijsbers Exp $ |
| 2 | 2 |
| 3 """WWW request handler (also used in the stand-alone server). | 3 """WWW request handler (also used in the stand-alone server). |
| 4 """ | 4 """ |
| 5 __docformat__ = 'restructuredtext' | 5 __docformat__ = 'restructuredtext' |
| 6 | 6 |
| 552 break | 552 break |
| 553 else: | 553 else: |
| 554 raise ValueError, 'No such action "%s"'%action | 554 raise ValueError, 'No such action "%s"'%action |
| 555 # call the mapped action | 555 # call the mapped action |
| 556 try: | 556 try: |
| 557 action_klass(self).handle() | 557 action_klass(self).execute() |
| 558 except TypeError: | 558 except TypeError: |
| 559 # Old way of specifying actions. | 559 # Old way of specifying actions. |
| 560 getattr(self, action_klass)() | 560 getattr(self, action_klass)() |
| 561 | 561 |
| 562 except ValueError, err: | 562 except ValueError, err: |
