Mercurial > p > roundup > code
comparison roundup/cgi/client.py @ 2019:8fab5d394f22
Call actions in a different way so we won't hide any bad TypeErrors.
| author | Johannes Gijsbers <jlgijsbers@users.sourceforge.net> |
|---|---|
| date | Sun, 15 Feb 2004 10:08:20 +0000 |
| parents | 96a1bf48efdd |
| children | 5a7ec0c63095 |
comparison
equal
deleted
inserted
replaced
| 2018:96a1bf48efdd | 2019:8fab5d394f22 |
|---|---|
| 1 # $Id: client.py,v 1.160 2004-02-14 19:58:20 jlgijsbers Exp $ | 1 # $Id: client.py,v 1.161 2004-02-15 10:08: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 |
| 550 for name, action_klass in self.actions: | 550 for name, action_klass in self.actions: |
| 551 if name == action: | 551 if name == action: |
| 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 | |
| 555 # call the mapped action | 556 # call the mapped action |
| 556 try: | 557 if isinstance(action_klass, type('')): |
| 557 action_klass(self).execute() | 558 # old way of specifying actions |
| 558 except TypeError: | |
| 559 # Old way of specifying actions. | |
| 560 getattr(self, action_klass)() | 559 getattr(self, action_klass)() |
| 560 else: | |
| 561 action_klass(self).handle() | |
| 561 | 562 |
| 562 except ValueError, err: | 563 except ValueError, err: |
| 563 self.error_message.append(str(err)) | 564 self.error_message.append(str(err)) |
| 564 | 565 |
| 565 def write(self, content): | 566 def write(self, content): |
