changeset 1062:c80649cdadd5

pages: new delegateToResource method to continue workflow with a Twisted Resource
author Goffi <goffi@goffi.org>
date Sun, 11 Mar 2018 19:29:23 +0100
parents bacb8f229742
children 4b69f69c6ffd
files src/server/pages.py
diffstat 1 files changed, 10 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/server/pages.py	Sun Mar 11 19:28:10 2018 +0100
+++ b/src/server/pages.py	Sun Mar 11 19:29:23 2018 +0100
@@ -772,6 +772,16 @@
             else:
                 log.debug(_(u"Removed signal handler"))
 
+    def delegateToResource(self, request, resource):
+        """continue workflow with Twisted Resource"""
+        buf = resource.render(request)
+        if buf == server.NOT_DONE_YET:
+            pass
+        else:
+            request.write(buf)
+            request.finish()
+        raise failure.Failure(exceptions.CancelError(u'resource delegation'))
+
     def HTTPRedirect(self, request, url):
         """redirect to an URL using HTTP redirection