Commit graph

118 commits

Author SHA1 Message Date
Gina Häußge
06816fb8dc Test: checksum missing => missing checksum 2017-12-04 16:04:38 +01:00
Gina Häußge
cc0a17f2ac Unit tests for MachineCom._handle_errors
With various Marlin and Repetier error variants.
2017-12-04 15:56:31 +01:00
Gina Häußge
14bd0632c0 parse_requirements => Requirement.parse
Since we only ever handle one requirement here, the parse_requirements
generator (which btw needs a next m() is not the best choice.

Also extracted install command cleanup into class method and added tests
for that.

cc @markwal
2017-11-28 12:02:43 +01:00
Gina Häußge
ebfc6f2f26 More dynamic detection of plugin mixins
Instead of hardcoding a list of supported mixins, we now instead define
a base class (or a list thereof) from which mixins might inherit and use
inspection to determine the set of mixins each plugin implementation
implements. Not only will that reduce the risk of forgetting to add a
new mixin to the whitelist, but it will also allow mixins defined by
plugins.
2017-11-13 16:01:37 +01:00
Gina Häußge
1180e4e27b Fix & extend environment detection on Pi 2017-11-10 18:27:52 +01:00
Gina Häußge
b2d70de144 Environment detection & logging on startup
Incl. OctoPi version & RPi model through bundled plugin that only
gets loaded if OctoPi is detected.
2017-11-10 17:32:59 +01:00
Gina Häußge
69f9c523f9 Add utm tags to announcement links 2017-11-09 10:49:39 +01:00
Gina Häußge
42ac133436 Support full UTF8 file names
Files (and folders) are still slugified to ASCII for storage on disk,
but now the original filename is stored alongside in metadata.yaml
and used for display in the file list and print status.

The slicing dialog also inherits that display name for use as base
for the suggested GCODE name.

Internally, everything still depends completely on the slugified
ASCII version.

This implements #2094
2017-10-12 18:08:41 +02:00
Gina Häußge
abfcc6e5aa Fix deletion of unrendered timelapses
If the filename contained a [] pair, the file would not match the glob
pattern used for selecting for deletion.

Backporting the glob.escape function from Python 3.4 and using it here
should fix that. We only use our own ported version if glob.escape
doesn't exist - that should reduce redundant code once we become Python
3 compatible.
2017-10-10 12:41:47 +02:00
Gina Häußge
7fc0f48659 Adjust unit tests for script root in cookie suffix 2017-09-28 17:43:53 +02:00
Gina Häußge
cf053ddbed Temperatures may in fact be negative
E.g. in case of a disconnected thermistor, or when it is really
really cold. Make sure our parsing doesn't get confuse by this and
thinks that

  ok T:150.0/210.0 T0:-55.7/0 T1:150.0/210.0

is actually only T and T1 being reported by the firmware, causing
stuff to be wrongly canonicalized thanks to T/T1 being Smoothie's way
of reporting dual extruder setups.

Fixes #2007
2017-07-14 11:18:04 +02:00
Gina Häußge
f8d225a768 Support for parsing GCODE subcodes
Hook handlers will get any parsed subcode as optional keyword argument
"subcode".
2017-07-05 17:56:46 +02:00
Gina Häußge
7ab4d12548 Better error resilience against wrong user manager
Also improved get_class by using importlib instead of complicated
climbing through the whole module tree.
2017-06-29 15:07:17 +02:00
Gina Häußge
f6c3e5991d PMGR: Detect if plugin needs printer reconnect 2017-06-28 10:30:35 +02:00
Gina Häußge
12d40122d1 Use wrapt.ObjectProxy for SessionUser wrapper class
Our old manual wrapped didn't properly work in some aspects, this
version now should hopefully take care of most common proxy object
pitfalls.
2017-06-27 15:03:37 +02:00
Gina Häußge
6a1b162e7b Support for temperature autoreporting instead of polling
Now also detects capabilities reported by (extended) M115 output and
if AUTOREPORT_TEMP is available enables it with the configured
autoreport interval and disables active polling.

Implements #1679
2017-06-06 18:46:23 +02:00
Gina Häußge
832c27ed18 Filter source maps from bundled assets
At least for now. Might be re-evaluated in the future. URL rewrite
filter for such a case already in place.
2017-05-19 12:28:20 +02:00
Gina Häußge
cc44c1a981 Make sure to properly handle unicode passwords
Fix & test for #1891
2017-05-02 09:35:02 +02:00
Gina Häußge
346f818707 PGMR: More general flexibility for os compat check
* Don't restrict the list of compatibility values to check against
    to only those we have mapped, also support unmapped more exotic
    ones.

  * Allow 1:1 check against sys.platform values (with startswith).
    Combined with the above that allows very granular compatibility
    modelling ("freebsd11", "freebsd12") if required.

  * Instead of only whitelisting ("linux", "freebsd") now also black
    listing is possible ("!windows").

    A detected os must match all provided whitelist elements (if the
    whitelist is empty that is considered always the case) and none of
    the backlist elements (if the blacklist is empty that is also
    considered always the case).

See the included unit tests for examples of how this works.
2017-04-07 09:18:37 +02:00
Gina Häußge
7828ab0bf9 Fix tests for server.util.*
Weren't properly included in test suite, and those for the flask
utility also had some errors due to buggy test implementation.
2017-04-07 09:15:08 +02:00
Gina Häußge
4d324c5239 Fix unit tests 2017-04-03 18:47:27 +02:00
Gina Häußge
61fbde4e51 Manual test plugin for parts of the update mechanism 2017-03-10 12:01:09 +01:00
Gina Häußge
559238ca3c More solid parsing of line number from resends
Matches:

  * Resend:23
  * Resend:N23
  * Resend:N:23
  * rs 23
  * rs N23
  * rs N:23
  * rs N23 Expected checksum 109

Based on issue reported via PR #300
2017-03-09 17:08:01 +01:00
Gina Häußge
fa16037e9a Unit test for M115 response parsing 2017-03-09 16:39:16 +01:00
Andy Werner
8a4934e6f8 Fix an issue in user settings
* UserSettings: crashed if overwrite an existing key with primitive value by same key with complex value. Also reduced number of calls to user.get_setting()

* Updated tests

(cherry picked from commit b75b53d)
2017-03-08 18:11:36 +01:00
Gina Häußge
01ebf8fba7 Fix for two timing sensitive unit tests 2017-03-06 11:54:03 +01:00
Gina Häußge
7beabf953c Fixed user unit tests 2017-02-17 13:43:47 +01:00
Gina Häußge
6bd788a83f Always define pixfmt for timelapse in video filter chain
Apparently having a chain AND the pix_fmt parameter
produces issues with higher resolutions.

Should fix #1317
2017-01-17 13:03:27 +01:00
Gina Häußge
e6dd37e26e Various analysis queue fixes
* Fix priority queue sorting (sorts ascending, not descending!)
  * Abort low priority jobs when a high priority job comes in
  * Utilize queue for tracking aborted jobs too
  * Abort analysis for items that are to be deleted/moved (also
    fixes issue under Windows where it was impossible to delete
    a file for which the analysis was still running).
2017-01-12 18:16:42 +01:00
Gina Häußge
d28e0988fb Merge branch 'maintenance' into devel 2016-11-07 16:18:26 +01:00
Gina Häußge
2952b2622e Do not hiccup on ipv6 addresses in the HTTP Host header
Fixed port extraction. Now supports hostname, hostname + port,
ipv4, ipv4 + port, ipv6, ipv6 + port

Fixes #1571
2016-11-07 16:17:16 +01:00
Gina Häußge
0d8fdfae26 Trust Tc over T when parsing temps from the firmware 2016-10-17 10:27:06 +02:00
Gina Häußge
aca3dfae49 Merge branch 'maintenance' into devel
# Conflicts:
#	CHANGELOG.md
2016-09-23 14:35:31 +02:00
Gina Häußge
080a6e9ccd Extend atomic_write to allow setting & persisting file permissions 2016-09-23 14:26:33 +02:00
Gina Häußge
53c0ad0889 Fixed unit tests for octoprint.timelapse 2016-09-16 18:35:30 +02:00
Gina Häußge
b6fbbb353a Merge branch 'maintenance' into devel
# Conflicts:
#	CHANGELOG.md
#	src/octoprint/filemanager/storage.py
#	src/octoprint/plugins/softwareupdate/templates/softwareupdate_settings.jinja2
2016-09-09 12:31:29 +02:00
Gina Häußge
bbe6e44d44 Only use non-postfixed cookie if no postfixed one exists
Example:

  * both "session" and "session_P5000" cookies available: "session" value from "session_P5000"
  * only "session" cookie available: "session" value from "session"
  * only "session_P5000" cookie available: "session" value from "session_P5000"
2016-09-08 15:42:51 +02:00
Gina Häußge
53b74f9caa Only construct HTTP_HOST header from SERVER_NAME and _PORT if it's unset
If HTTP_HOST is set, following PEP333 it takes precedence over SERVER_NAME and
_PORT, so we set those from it.
2016-09-08 15:18:09 +02:00
Gina Häußge
2b22d26eac Fixed a small issue with RFC 5987 headers arriving as unicode in parser
Also added API docs regarding header encoding, incl support for RFC 5987
for filename fields in Content-Disposition headers in multipart/form-data
parts, incl. an example of an upload request with a utf-8 encoded filename.
2016-09-07 18:44:46 +02:00
Gina Häußge
64d484bd09 Merge branch 'maintenance' into devel
# Conflicts:
#	src/octoprint/server/__init__.py
#	src/octoprint/util/jinja.py
2016-09-07 17:22:37 +02:00
Gina Häußge
13728c231c Also explicitely support ISO-8859-1 encoded multipart headers
Solves an issue with clients encoding filenames in multipart
 headers in ISO-8859-1, causing an HTTP 500 response code.

 This change makes ISO-8859-1 encoded headers work, sends
 a 400 Bad Request instead of 500 Internal Server Error if the
 request multipart headers cannot be decoded as either UTF-8
 or ISO-8859-1, defines UTF-8 content type for multipart text
 fields in rebuilt body and also adds support for RFC 5987 for the
 multipart file upload "filename" header component.
2016-09-07 17:03:59 +02:00
Gina Häußge
9d9eb3390d Cookie names are now port specific, based on the request associated with a response
* make sure server_port headers are properly set in reverse proxied scenarios
  * overwrite request and response classes to
    * always apply reverse proxy environment changes (so far missing for tornado
      context)
    * strip cookie name suffixes from cookie names on requests and
    * be sure to set cookie name suffixes for cookie names on responses
    * include script root in path used for cookies
  * some minor refactoring in octoprint.server setup routines
  * removed ReverseProxied class (didn't work for tornado context)
  * add unit tests for the whole reverse proxy, request and response customization
2016-09-05 12:06:56 +02:00
Gina Häußge
cba742a94f Fix some more left-overs of py2<->py3 PRs
Related to #1411, #1414 and #1415
2016-07-15 12:46:53 +02:00
Gina Häußge
7ed1f4cb9e umask test also needs to use different octal syntax
Related to #1414
2016-07-15 12:37:11 +02:00
Gina Häußge
47b7acdfbc Merge branch 'dev/python3A' of https://github.com/ByReaL/OctoPrint into pr/ByReaL/dev/python3A
Conflicts:
	src/octoprint/plugins/virtual_printer/virtual.py
	src/octoprint/printer/standard.py
2016-07-15 12:28:19 +02:00
Gina Häußge
76a04cbe9d Merge branch 'dev/python3B' of https://github.com/ByReaL/OctoPrint into pr/ByReaL/dev/python3B 2016-07-15 11:28:55 +02:00
MirceaDan
c33a9f9aa2 from __future__ import absolute_import, division, print_function
changed the behavior to import division and print to be consistent
across all app and similar with python 3.x
2016-07-15 00:16:58 -07:00
MirceaDan
149cc8c7c5 python 3 changes exceptions, queue and asesrtEqual
1) import Queue is now lower caps

2) exceptions
except KeyError as e:

3) assertEquals is deprecated but assertEqual does exactly same thing
2016-07-14 23:53:39 -07:00
Gina Häußge
18243e49a6 Fix a failing unit test 2016-07-13 11:25:03 +02:00
Gina Häußge
015b99fa14 Fix plugin unit tests 2016-06-28 11:02:44 +02:00