Mercurial > p > roundup > code
comparison roundup/cgi/client.py @ 5603:79da1ca2f94b REST-rebased
Make xmlrpc and rest APIs configurable
| author | Ralf Schlatterbeck <rsc@runtux.com> |
|---|---|
| date | Wed, 30 Jan 2019 13:58:18 +0100 |
| parents | edab9daa8015 |
| children | 5df309febe49 |
comparison
equal
deleted
inserted
replaced
| 5602:c40d04915e23 | 5603:79da1ca2f94b |
|---|---|
| 424 self.ngettext = translator.ngettext | 424 self.ngettext = translator.ngettext |
| 425 | 425 |
| 426 def main(self): | 426 def main(self): |
| 427 """ Wrap the real main in a try/finally so we always close off the db. | 427 """ Wrap the real main in a try/finally so we always close off the db. |
| 428 """ | 428 """ |
| 429 xmlrpc_enabled = self.instance.config.WEB_ENABLE_XMLRPC | |
| 430 rest_enabled = self.instance.config.WEB_ENABLE_REST | |
| 429 try: | 431 try: |
| 430 if self.path == 'xmlrpc': | 432 if xmlrpc_enabled and self.path == 'xmlrpc': |
| 431 self.handle_xmlrpc() | 433 self.handle_xmlrpc() |
| 432 elif self.path == 'rest' or self.path[:5] == 'rest/': | 434 elif rest_enabled and (self.path == 'rest' or |
| 435 self.path[:5] == 'rest/'): | |
| 433 self.handle_rest() | 436 self.handle_rest() |
| 434 else: | 437 else: |
| 435 self.inner_main() | 438 self.inner_main() |
| 436 finally: | 439 finally: |
| 437 if hasattr(self, 'db'): | 440 if hasattr(self, 'db'): |
