jiten: cherry-pick test fix from upstream
This commit is contained in:
parent
43edc09698
commit
877de20d92
39
pkgs/applications/misc/jiten/cookie-fix.patch
Normal file
39
pkgs/applications/misc/jiten/cookie-fix.patch
Normal file
@ -0,0 +1,39 @@
|
||||
diff --git a/jiten/app.py b/jiten/app.py
|
||||
index 6d54020..f30a1d8 100644
|
||||
--- a/jiten/app.py
|
||||
+++ b/jiten/app.py
|
||||
@@ -149,13 +149,22 @@ True
|
||||
>>> d.index("JLPT N3") < d.index("歯", d.index("JLPT N5")) < d.index("JLPT N2")
|
||||
True
|
||||
|
||||
->>> sorted( (c.name, c.value) for c in client.cookie_jar )
|
||||
+>>> def cookies():
|
||||
+... import importlib.metadata
|
||||
+... v = tuple(map(int, importlib.metadata.version("werkzeug").split(".")))
|
||||
+... if v < (2, 3):
|
||||
+... return sorted( (c.name, c.value) for c in client.cookie_jar )
|
||||
+... else:
|
||||
+... cookies = [ client.get_cookie(k) for k in PREFS ]
|
||||
+... return sorted( (c.key, c.value) for c in cookies if c is not None )
|
||||
+
|
||||
+>>> cookies()
|
||||
[]
|
||||
>>> p = dict(dark = "yes", lang = "eng ger oops".split())
|
||||
>>> r = client.post("/_save_prefs", data = p, follow_redirects = True)
|
||||
>>> r.status
|
||||
'200 OK'
|
||||
->>> sorted( (c.name, c.value) for c in client.cookie_jar )
|
||||
+>>> cookies()
|
||||
[('dark', 'yes'), ('lang', '"eng ger"'), ('large', 'no'), ('max', '50'), ('nogrid', 'no'), ('nor2h', 'no'), ('roma', 'no')]
|
||||
|
||||
""" # }}}1
|
||||
@@ -168,8 +177,7 @@ import kanjidraw
|
||||
import click, flask, jinja2, werkzeug
|
||||
|
||||
os.environ["FLASK_SKIP_DOTENV"] = "yes" # FIXME
|
||||
-from flask import Flask, abort, escape, make_response, redirect, \
|
||||
- request, render_template, url_for
|
||||
+from flask import Flask, abort, make_response, redirect, request, render_template, url_for
|
||||
|
||||
from .version import __version__, py_version
|
||||
from .kana import kana2romaji
|
@ -27,6 +27,12 @@ python3.pkgs.buildPythonApplication rec {
|
||||
sha256 = "16sz8i0sw7ggy6kijcx4qyl2zr6xj789x4iav0yyllx12dfgp5b1";
|
||||
};
|
||||
|
||||
patches = [
|
||||
# Potentially can be dropped after the next release
|
||||
# https://github.com/NixOS/nixpkgs/issues/271600
|
||||
./cookie-fix.patch
|
||||
];
|
||||
|
||||
nativeBuildInputs = [ makeWrapper ];
|
||||
buildInputs = [ pcre sqlite ];
|
||||
propagatedBuildInputs = with python3.pkgs; [ click flask kanjidraw ];
|
||||
|
Loading…
Reference in New Issue
Block a user