From 4caf4ef09b402111b7abf36425315271ce588108 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Tue, 6 Nov 2018 14:02:49 +0100 Subject: [PATCH 1/3] Fix GCODE viewer not being able to load files Side effect of the ForcedLogin plugin and a bug in get_flask_user_from_request. Closes #2873 --- src/octoprint/server/util/flask.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/octoprint/server/util/flask.py b/src/octoprint/server/util/flask.py index fc3b148f0..cdec02307 100644 --- a/src/octoprint/server/util/flask.py +++ b/src/octoprint/server/util/flask.py @@ -1109,7 +1109,8 @@ def get_flask_user_from_request(request): apikey = octoprint.server.util.get_api_key(request) if settings().getBoolean(["api", "enabled"]) and apikey is not None: user = octoprint.server.util.get_user_for_apikey(apikey) - else: + + if user is None: user = flask_login.current_user return user From 343195477b8aa973e12dfe73b29be97736235b2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Tue, 6 Nov 2018 14:47:39 +0100 Subject: [PATCH 2/3] Fix connection fail if fw doesn't send start Closes #2872 --- src/octoprint/util/__init__.py | 3 +++ src/octoprint/util/comm.py | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/octoprint/util/__init__.py b/src/octoprint/util/__init__.py index b23681bc4..6f74fcaf9 100644 --- a/src/octoprint/util/__init__.py +++ b/src/octoprint/util/__init__.py @@ -1299,6 +1299,9 @@ class CountedEvent(object): else: self._internal_set(self._counter - 1) + def reset(self): + self.clear(completely=True) + def wait(self, timeout=None): self._event.wait(timeout) diff --git a/src/octoprint/util/comm.py b/src/octoprint/util/comm.py index cfbedd623..f6bd0e754 100644 --- a/src/octoprint/util/comm.py +++ b/src/octoprint/util/comm.py @@ -2322,7 +2322,7 @@ class MachineCom(object): def _on_external_reset(self): # hold queue processing, clear queues and acknowledgements, reset line number and last lines with self._send_queue.blocked(): - self._clear_to_send.clear(completely=True) + self._clear_to_send.reset() with self._command_queue.blocked(): self._command_queue.clear() self._send_queue.clear() @@ -2493,7 +2493,7 @@ class MachineCom(object): # first hook to succeed wins, but any can pass on to the next self._changeState(self.STATE_OPEN_SERIAL) self._serial = serial_obj - self._clear_to_send.clear() + self._clear_to_send.reset() return True return False From 68ca2c5e51a2934be40dc0df01848e10abb50b21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Tue, 6 Nov 2018 15:52:41 +0100 Subject: [PATCH 3/3] Pin regex dependency to last known working version See #2874 and https://bitbucket.org/mrabarnett/mrab-regex/issues/301/typeerror-character-mapping-must-return --- setup.py | 1 + 1 file changed, 1 insertion(+) diff --git a/setup.py b/setup.py index 8c0f76646..3da12ab63 100644 --- a/setup.py +++ b/setup.py @@ -18,6 +18,7 @@ INSTALL_REQUIRES = [ "Jinja2>=2.8.1,<2.9", # Jinja 2.9 has breaking changes WRT template scope - we can't # guarantee backwards compatibility for plugins and such with that # version, hence we need to pin to a lower version for now. See #1697 + "regex==2018.11.3", # Current version as of 2018-11-06 is broken. See #2874 "werkzeug>=0.8.3,<0.9", "tornado==4.5.3", #"sockjs-tornado>=1.0.3,<1.1", # current version is incompatible to tornado 5, we use a