about summary refs log tree commit diff
path: root/pkgs/servers/calibre-web
diff options
context:
space:
mode:
authorrenesat <smol.ivan97@gmail.com>2023-09-06 04:47:06 +0200
committerrenesat <smol.ivan97@gmail.com>2023-09-06 04:53:19 +0200
commitc53fc9a1e40b0b75e2a78497851488fc1d3b6aa7 (patch)
tree364bc7cb9c25948d8fafa734cc5d408ee4d10db0 /pkgs/servers/calibre-web
parent05f82739df7cf884907db8ee9b22c76a7efb6edb (diff)
calibre-web: fix static environ method in tornado
Diffstat (limited to 'pkgs/servers/calibre-web')
-rw-r--r--pkgs/servers/calibre-web/default.nix2
-rw-r--r--pkgs/servers/calibre-web/static_environ.patch25
2 files changed, 27 insertions, 0 deletions
diff --git a/pkgs/servers/calibre-web/default.nix b/pkgs/servers/calibre-web/default.nix
index 607ced4606ff4..70f2287c83e70 100644
--- a/pkgs/servers/calibre-web/default.nix
+++ b/pkgs/servers/calibre-web/default.nix
@@ -63,6 +63,8 @@ python.pkgs.buildPythonApplication rec {
     # and exit. This is gonna be used to configure calibre-web declaratively, as most of its configuration parameters
     # are stored in the DB.
     ./db-migrations.patch
+    # environ in tornado.wsgi.WSGIContainer no longer a static method from 6.3 version
+    ./static_environ.patch
   ];
 
   # calibre-web doesn't follow setuptools directory structure. The following is taken from the script
diff --git a/pkgs/servers/calibre-web/static_environ.patch b/pkgs/servers/calibre-web/static_environ.patch
new file mode 100644
index 0000000000000..4f94283a4e664
--- /dev/null
+++ b/pkgs/servers/calibre-web/static_environ.patch
@@ -0,0 +1,25 @@
+diff --git a/cps/tornado_wsgi.py b/cps/tornado_wsgi.py
+index af93219c..cf302042 100644
+--- a/cps/tornado_wsgi.py
++++ b/cps/tornado_wsgi.py
+@@ -53,7 +53,7 @@ class MyWSGIContainer(WSGIContainer):
+             return response.append
+ 
+         app_response = self.wsgi_application(
+-            MyWSGIContainer.environ(request), start_response
++            self.environ(request), start_response
+         )
+         try:
+             response.extend(app_response)
+@@ -86,9 +86,8 @@ class MyWSGIContainer(WSGIContainer):
+         request.connection.finish()
+         self._log(status_code, request)
+ 
+-    @staticmethod
+-    def environ(request: httputil.HTTPServerRequest) -> Dict[Text, Any]:
+-        environ = WSGIContainer.environ(request)
++    def environ(self, request: httputil.HTTPServerRequest) -> Dict[Text, Any]:
++        environ = super().environ(request)
+         environ['RAW_URI'] = request.path
+         return environ
+