diff --git a/.versioneer-lookup b/.versioneer-lookup index 674e4c88b..28de35100 100644 --- a/.versioneer-lookup +++ b/.versioneer-lookup @@ -31,8 +31,8 @@ bug/.* 1.7.4 59cbfadf8922d85b9df40f8d0173e8c21724c3b8 pep440-dev # staging/maintenance is currently the branch for preparation of 1.8.0rc4 # so is regressionfix/... -staging/maintenance 1.8.0rc4 3c478036ae9edde3dd294af28bf1d8c78a2555d5 pep440-dev -regressionfix/.* 1.8.0rc4 3c478036ae9edde3dd294af28bf1d8c78a2555d5 pep440-dev +staging/maintenance 1.8.0rc5 c5b095a8b905d759c84acab5e8a65ed3170d124c pep440-dev +regressionfix/.* 1.8.0rc5 c5b095a8b905d759c84acab5e8a65ed3170d124c pep440-dev # staging/devel is currently inactive (but has the 1.4.1rc4 namespace) staging/devel 1.4.1rc4 650d54d1885409fa1d411eb54b9e8c7ff428910f pep440-dev diff --git a/SUPPORTERS.md b/SUPPORTERS.md index b9601c24e..94ed52f15 100644 --- a/SUPPORTERS.md +++ b/SUPPORTERS.md @@ -20,6 +20,7 @@ thanks to everyone who contributed! * Christian Wolf * Christian Würthner * Christoph Sigrist + * Craig Parker * Creality3D * David Bounds * DeltaMaker 3D Printers @@ -34,6 +35,7 @@ thanks to everyone who contributed! * Hog Duske * Itay Shem-tov * James Mackay + * Jeff Green * Jeff Moe * Jeremy Cole * Joshua Wills @@ -49,6 +51,7 @@ thanks to everyone who contributed! * LulzBot * Makespace Madrid * Mark Walker + * Matt Van Itallie * Michael Aumock * Mike Kershaw * Miles Flavel diff --git a/docs/_static/theme_overrides.css b/docs/_static/theme_overrides.css index cce327b20..12de9d439 100644 --- a/docs/_static/theme_overrides.css +++ b/docs/_static/theme_overrides.css @@ -1,14 +1,3 @@ -/* override table width restrictions */ -.wy-table-responsive table td, .wy-table-responsive table th { - /* !important prevents the common CSS stylesheets from - overriding this as on RTD they are loaded after this stylesheet */ - white-space: normal !important; -} - -.wy-table-responsive { - overflow: visible !important; -} - /* style headlink for code block captions like other headlinks */ .code-block-caption .headerlink { display: none; @@ -42,19 +31,3 @@ line-height: 1.5; } -/* make code tags non-red again */ -code, -.rst-content tt { - color: #000 !important; -} - -a code, -.rst-content a tt { - color: #2980B9 !important; -} - -a:visited code, -.rst-content a:visited tt { - color: #9B59B6 !important; -} - diff --git a/docs/api/printerprofiles.rst b/docs/api/printerprofiles.rst index 395020562..8b802b37d 100644 --- a/docs/api/printerprofiles.rst +++ b/docs/api/printerprofiles.rst @@ -627,9 +627,11 @@ Profile - ``float`` - The diameter of the printer's nozzle(s) in mm. * - ``extruder.sharedNozzle`` + - 0..1 - ``boolean`` - Whether there's only one nozzle shared among all extruders (true) or one nozzle per extruder (false). * - ``extruder.defaultExtrusionLength`` + - 0..1 - ``int`` - Default extrusion length used in Control tab on initial page load in mm. * - ``extruder.count`` diff --git a/docs/api/users.rst b/docs/api/users.rst deleted file mode 100644 index 495829a1f..000000000 --- a/docs/api/users.rst +++ /dev/null @@ -1,9 +0,0 @@ -.. _sec-api-user: - -**** -User -**** - -.. note:: - - This API endpoint has been moved and is now part of :ref:`Access Control `. diff --git a/docs/bundledplugins/loginui.rst b/docs/bundledplugins/loginui.rst deleted file mode 100644 index 4697cd7d3..000000000 --- a/docs/bundledplugins/loginui.rst +++ /dev/null @@ -1,6 +0,0 @@ -.. _sec-bundledplugins-loginui: - -Login UI -======== - -The Login UI plugin's functionality has been merged into OctoPrint's core as of OctoPrint 1.4.2. diff --git a/docs/conf.py b/docs/conf.py index 645d8dc0b..f8b7fa933 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -40,6 +40,7 @@ extensions = [ "sphinx.ext.napoleon", "sphinxcontrib.mermaid", "sphinx.ext.intersphinx", + "sphinx_rtd_theme" ] todo_include_todos = True intersphinx_mapping = { @@ -105,7 +106,7 @@ exclude_patterns = ["_build"] # show_authors = False # The name of the Pygments (syntax highlighting) style to use. -pygments_style = "sphinx" +pygments_style = "stata-dark" # A list of ignored prefixes for module index sorting. # modindex_common_prefix = [] @@ -119,19 +120,14 @@ mermaid_version = "" # -- Options for HTML output --------------------------------------------------- -import sphinx_rtd_theme - -html_theme = "sphinx_rtd_theme" -html_theme_path = [sphinx_rtd_theme.get_html_theme_path()] - # The theme to use for HTML and HTML Help pages. See the documentation for # a list of built-in themes. -# html_theme = "sphinx_rtd_theme" +html_theme = "sphinx_rtd_theme" # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the # documentation. -# html_theme_options = {} +html_theme_options = {} # Add any paths that contain custom themes here, relative to this directory. # html_theme_path = [sphinx_rtd_theme.get_html_theme_path()] diff --git a/docs/plugins/gettingstarted.rst b/docs/plugins/gettingstarted.rst index 41d3ec9f7..e0c635965 100644 --- a/docs/plugins/gettingstarted.rst +++ b/docs/plugins/gettingstarted.rst @@ -55,7 +55,6 @@ development environment:: We'll start at the most basic form a plugin can take - just a few simple lines of Python code: .. code-block:: python - :linenos: __plugin_name__ = "Hello World" __plugin_version__ = "1.0.0" @@ -91,8 +90,7 @@ Apart from being discovered by OctoPrint, our plugin does nothing yet. We want t "Hello World!" to the log upon server startup. Modify our ``helloworld.py`` like this: .. code-block:: python - :emphasize-lines: 4-8,14 - :linenos: + :emphasize-lines: 1-5,11 import octoprint.plugin @@ -120,7 +118,7 @@ up and ready to serve requests. You'll also note that we are using ``self._logger`` for logging. Where did that one come from? OctoPrint's plugin system injects :ref:`a some useful objects ` into our plugin implementation classes, -one of those being a fully instantiated :ref:`python logger ` ready to be +one of those being a fully instantiated :py:mod:`python logger ` ready to be used by your plugin. As you can see in the log output above, that logger uses the namespace ``octoprint.plugins.helloworld`` for our little plugin here, or more generally ``octoprint.plugins.``. @@ -270,7 +268,6 @@ Something is still a bit ugly though. Take a look into ``__init__.py`` and ``set of information now defined twice: .. code-block:: python - :linenos: :caption: __init__.py __plugin_name__ = "Hello World" @@ -278,7 +275,6 @@ of information now defined twice: __plugin_description__ = "A quick \"Hello World\" example plugin for OctoPrint" .. code-block:: python - :linenos: :caption: setup.py plugin_name = "OctoPrint-HelloWorld" @@ -290,7 +286,6 @@ within ``setup.py``! So, we don't really need to define all this data twice. Rem and ``__plugin_description__`` from ``__init__.py``, but leave ``__plugin_implementation__`` and ``__plugin_pythoncompat__``: .. code-block:: python - :linenos: import octoprint.plugin @@ -313,7 +308,6 @@ Our "Hello World" Plugin still gets detected fine, but it's now listed under the .. code-block:: python :emphasize-lines: 7 - :linenos: import octoprint.plugin @@ -359,7 +353,6 @@ add the :class:`TemplatePlugin` to our ``HelloWorldPlugin`` class: .. code-block:: python :emphasize-lines: 4 - :linenos: import octoprint.plugin @@ -376,7 +369,6 @@ Next, we'll create a sub folder ``templates`` underneath our ``octoprint_hellowo ``helloworld_navbar.jinja2`` like so: .. code-block:: html - :linenos: Hello World! @@ -423,7 +415,6 @@ Let's take a look at how all that would look in our plugin's ``__init__.py``: .. code-block:: python :emphasize-lines: 5, 7, 9-10 - :linenos: import octoprint.plugin @@ -455,7 +446,6 @@ Adjust your plugin's ``__init__.py`` like this: .. code-block:: python :emphasize-lines: 12-13 - :linenos: import octoprint.plugin @@ -478,7 +468,6 @@ Adjust your plugin's ``__init__.py`` like this: Also adjust your plugin's ``templates/helloworld_navbar.jinja2`` like this: .. code-block:: html - :linenos: Hello World! @@ -515,7 +504,6 @@ So in your plugin's ``templates`` folder create a new file ``helloworld_settings into it: .. code-block:: html - :linenos:
@@ -537,7 +525,6 @@ Now adjust your ``templates/helloworld_navbar.jinja2`` file to use a ``data-bind settings view model into the ``href`` attribute of the link tag: .. code-block:: html - :linenos: Hello World! @@ -560,7 +547,6 @@ again since we don't use that anymore: .. code-block:: python :emphasize-lines: 12-16 - :linenos: import octoprint.plugin @@ -618,7 +604,6 @@ First let us create the Jinja2 template for our tab. In your plugin's ``template ``helloworld_tab.jinja2`` like so: .. code-block:: html - :linenos:
@@ -655,7 +640,6 @@ like so: .. code-block:: python :emphasize-lines: 6,19-22 - :linenos: import octoprint.plugin @@ -693,7 +677,6 @@ Then we'll create our custom `Knockout @@ -807,7 +789,6 @@ First we'll create a new folder within our plugin's ``static`` folder called ``c Put something like the following into ``helloworld.css``: .. code-block:: css - :linenos: #tab_plugin_helloworld iframe { width: 100%; @@ -818,7 +799,6 @@ Put something like the following into ``helloworld.css``: Don't forget to remove the ``style`` attribute from the ``iframe`` tag in ``helloworld_tab.jinja2``: .. code-block:: html - :linenos: :emphasize-lines: 6
@@ -833,7 +813,6 @@ a reference to our CSS file: .. code-block:: python :emphasize-lines: 23 - :linenos: import octoprint.plugin @@ -916,7 +895,6 @@ Then adjust our returned assets to include our LESS file as well: .. code-block:: python :emphasize-lines: 24 - :linenos: import octoprint.plugin @@ -966,7 +944,6 @@ source code. In the ``head`` section of the page you'll see that instead of your embedded the ``helloworld.less`` file instead: .. code-block:: html - :linenos: :emphasize-lines: 5 @@ -995,7 +972,6 @@ setting it to ``css``, e.g. Restart and shift-reload and take another look at the ``head``: .. code-block:: html - :linenos: :emphasize-lines: 5 @@ -1025,7 +1001,6 @@ stop it from doing that at the start of this section, we should switch this back Just out of curiosity, restart, shift-reload and take a final look at the ``head``: .. code-block:: html - :linenos: :emphasize-lines: 3-5 diff --git a/docs/plugins/helpers.rst b/docs/plugins/helpers.rst index 73b2a7935..6abc321b0 100644 --- a/docs/plugins/helpers.rst +++ b/docs/plugins/helpers.rst @@ -11,7 +11,6 @@ An example for providing some helper functions to the system can be found in the which provides its SSDP browsing and Zeroconf browsing and publishing functions as helper methods. .. code-block:: python - :linenos: :emphasize-lines: 11-20 :caption: Excerpt from the Discovery Plugin showing the declaration of its exported helpers. :name: sec-plugin-concepts-helpers-example-export @@ -42,7 +41,6 @@ Using :meth:`~octoprint.plugin.code.PluginManager.get_helpers` plugins can retri them as (hopefully) documented. .. code-block:: python - :linenos: :emphasize-lines: 6-8,20 :caption: Excerpt from the Growl Plugin showing utilization of the helpers published by the Discovery Plugin. :name: sec-plugin-concepts-helpers-example-usage diff --git a/docs/plugins/hooks.rst b/docs/plugins/hooks.rst index 20d1f3bb4..815482ac3 100644 --- a/docs/plugins/hooks.rst +++ b/docs/plugins/hooks.rst @@ -26,7 +26,6 @@ lines to OctoPrint's :ref:`GCODE scripts `, either a or as ``postfix`` (after the existing lines). .. code-block:: python - :linenos: self._gcode_hooks = self._pluginManager.get_hooks("octoprint.comm.protocol.scripts") @@ -75,7 +74,6 @@ property instead, manually instantiate your implementation instance and then add ``__plugin_hooks__`` property and itself to the ``__plugin_implementation__`` property. See the following example. .. onlineinclude:: https://raw.githubusercontent.com/OctoPrint/Plugin-Examples/master/custom_action_command.py - :linenos: :tab-width: 4 :caption: `custom_action_command.py `__ :name: sec-plugin-concepts-hooks-example @@ -95,7 +93,6 @@ An example should help clear this up. Let's assume we have the following plugin hook called ``octoprint.plugin.ordertest.callback``: .. code-block:: python - :linenos: :caption: ordertest.py import octoprint.plugin @@ -120,7 +117,6 @@ hook called ``octoprint.plugin.ordertest.callback``: And these three plugins defining handlers for that hook: .. code-block:: python - :linenos: :caption: oneorderedhook.py import logging @@ -135,7 +131,6 @@ And these three plugins defining handlers for that hook: } .. code-block:: python - :linenos: :caption: anotherorderedhook.py import logging @@ -150,7 +145,6 @@ And these three plugins defining handlers for that hook: } .. code-block:: python - :linenos: :caption: yetanotherhook.py import logging @@ -237,7 +231,7 @@ octoprint.access.permissions .. code-block:: python from octoprint.access import ADMIN_GROUP - + def get_additional_permissions(*args, **kwargs): return [ dict(key="ADMIN", @@ -316,7 +310,6 @@ octoprint.accesscontrol.keyvalidator and merely provided for educational purposes): .. onlineinclude:: https://raw.githubusercontent.com/OctoPrint/Plugin-Examples/master/custom_keyvalidator.py - :linenos: :tab-width: 4 :caption: `custom_keyvalidator.py `_ @@ -350,7 +343,6 @@ octoprint.cli.commands OctoPrint: .. onlineinclude:: https://raw.githubusercontent.com/OctoPrint/Plugin-Examples/master/custom_cli_command.py - :linenos: :tab-width: 4 :caption: `custom_cli_command.py `_ @@ -543,7 +535,6 @@ octoprint.comm.protocol.action Logs if the ``custom`` action (``// action:custom``) is received from the printer's firmware. .. onlineinclude:: https://raw.githubusercontent.com/OctoPrint/Plugin-Examples/master/custom_action_command.py - :linenos: :tab-width: 4 :caption: `custom_action_command.py `__ @@ -594,7 +585,6 @@ This describes actually two hooks: different name). .. onlineinclude:: https://raw.githubusercontent.com/OctoPrint/Plugin-Examples/master/custom_atcommand.py - :linenos: :tab-width: 4 :caption: `custom_action_command.py `__ @@ -749,7 +739,6 @@ This actually describes four hooks: parameter) upon queuing and logs all sent ``M106``. .. onlineinclude:: https://raw.githubusercontent.com/OctoPrint/Plugin-Examples/master/rewrite_m107.py - :linenos: :tab-width: 4 :caption: `rewrite_m107.py `_ @@ -792,7 +781,6 @@ octoprint.comm.protocol.gcode.received Looks for the response of an ``M115``, which contains information about the ``MACHINE_TYPE``, among other things. .. onlineinclude:: https://raw.githubusercontent.com/OctoPrint/Plugin-Examples/master/read_m115_response.py - :linenos: :tab-width: 4 :caption: `read_m115_response.py `_ @@ -831,7 +819,6 @@ octoprint.comm.protocol.gcode.error plugin. .. onlineinclude:: https://raw.githubusercontent.com/OctoPrint/Plugin-Examples/master/comm_error_handler_test.py - :linenos: :tab-width: 4 :caption: `comm_error_handler_test.py `_ @@ -868,7 +855,6 @@ octoprint.comm.protocol.scripts Appends an ``M117 OctoPrint connected`` to the configured ``afterPrinterConnected`` GCODE script. .. onlineinclude:: https://raw.githubusercontent.com/OctoPrint/Plugin-Examples/master/message_on_connect.py - :linenos: :tab-width: 4 :caption: `message_on_connect.py `_ @@ -877,7 +863,6 @@ octoprint.comm.protocol.scripts Provides the variable ``myvariable`` to the configured ``beforePrintStarted`` GCODE script. .. onlineinclude:: https://raw.githubusercontent.com/OctoPrint/Plugin-Examples/master/gcode_script_variables.py - :linenos: :tab-width: 4 :caption: `gcode_script_variables.py `_ @@ -918,7 +903,6 @@ octoprint.comm.protocol.temperatures.received The following example shows how to filter out actual temperatures that are outside a sane range of 1°C to 300°C. .. onlineinclude:: https://raw.githubusercontent.com/OctoPrint/Plugin-Examples/master/sanitize_temperatures.py - :linenos: :tab-width: 4 :caption: `sanitize_temperatures.py `_ @@ -984,7 +968,6 @@ octoprint.comm.transport.serial.factory or ``AUTO``. .. code-block:: python - :linenos: def default(comm_instance, port, baudrate, connection_timeout): if port is None or port == 'AUTO': @@ -1043,7 +1026,6 @@ octoprint.events.register_custom_events and ``octoprint.events.Events.PLUGIN_MYPLUGIN_MY_OTHER_CUSTOM_EVENT`` with value ``plugin_myplugin_my_other_custom_event``. .. code-block:: python - :linenos: def register_custom_events(*args, **kwargs): return ["my_custom_event", "my_other_custom_event"] @@ -1078,7 +1060,6 @@ octoprint.filemanager.analysis.factory The following handler would replace the existing analysis queue for ``gcode`` files with a custom implementation: .. code-block:: python - :linenos: from octoprint.filemanager.analysis import AbstractAnalysisQueue @@ -1111,7 +1092,6 @@ octoprint.filemanager.extension_tree and ``s3g``: .. code-block:: python - :linenos: def support_x3g_machinecode(*args, **kwargs): return dict( @@ -1152,7 +1132,6 @@ octoprint.filemanager.preprocessor The following plugin example strips all comments from uploaded/generated GCODE files ending on the name postfix ``_strip``. .. onlineinclude:: https://raw.githubusercontent.com/OctoPrint/Plugin-Examples/master/strip_all_comments.py - :linenos: :tab-width: 4 :caption: `strip_all_comments.py `_ @@ -1496,7 +1475,6 @@ octoprint.server.http.bodysize size (as multipart request with the file upload residing in request parameter ``file``) and observe the behaviour. .. onlineinclude:: https://raw.githubusercontent.com/OctoPrint/Plugin-Examples/master/increase_bodysize.py - :linenos: :tab-width: 4 :caption: `increase_bodysize.py `_ @@ -1556,7 +1534,6 @@ octoprint.server.http.routes in the webserver which roughly replicate the functionality of ``/downloads/files/local`` and ``/downloads/camera/current``. .. onlineinclude:: https://raw.githubusercontent.com/OctoPrint/Plugin-Examples/master/add_tornado_route.py - :linenos: :tab-width: 4 :caption: `add_tornado_route.py `_ @@ -1846,24 +1823,20 @@ octoprint.ui.web.templatetypes First the provider: .. onlineinclude:: https://raw.githubusercontent.com/OctoPrint/Plugin-Examples/master/custom_template_provider/__init__.py - :linenos: :tab-width: 4 :caption: `custom_template_provider/__init__.py `_ .. onlineinclude:: https://raw.githubusercontent.com/OctoPrint/Plugin-Examples/master/custom_template_provider/templates/custom_template_provider_settings.jinja2 - :linenos: :tab-width: 4 :caption: `custom_template_provider/templates/custom_template_provider_settings.jinja2 `_ Then the consumer: .. onlineinclude:: https://raw.githubusercontent.com/OctoPrint/Plugin-Examples/master/custom_template_consumer/__init__.py - :linenos: :tab-width: 4 :caption: `custom_template_consumer/__init__.py `_ .. onlineinclude:: https://raw.githubusercontent.com/OctoPrint/Plugin-Examples/master/custom_template_consumer/templates/custom_template_consumer_awesometemplate.jinja2 - :linenos: :tab-width: 4 :caption: `custom_template_consumer/templates/custom_template_consumer_awesometemplate.jinja2 `_ diff --git a/docs/plugins/mixins.rst b/docs/plugins/mixins.rst index 105fb85e2..edf9e2a23 100644 --- a/docs/plugins/mixins.rst +++ b/docs/plugins/mixins.rst @@ -26,7 +26,6 @@ merged into one big asset map (differing between javascripts and stylesheets of rendition of the UI. .. code-block:: python - :linenos: asset_plugins = pluginManager.get_implementations(octoprint.plugin.AssetPlugin) for name, implementation in asset_plugins.items(): @@ -79,7 +78,6 @@ and ``plugin_d`` don't override :meth:`~octoprint.plugin.core.SortablePlugin.get ``plugin_b`` and ``plugin_c`` both return ``1`` for the sorting context ``StartupPlugin.on_startup``, ``None`` otherwise: .. code-block:: python - :linenos: :caption: plugin_a.py import octoprint.plugin @@ -95,7 +93,6 @@ and ``plugin_d`` don't override :meth:`~octoprint.plugin.core.SortablePlugin.get __plugin_implementation__ = PluginA() .. code-block:: python - :linenos: :caption: plugin_b.py import octoprint.plugin @@ -116,7 +113,6 @@ and ``plugin_d`` don't override :meth:`~octoprint.plugin.core.SortablePlugin.get __plugin_implementation__ = PluginB() .. code-block:: python - :linenos: :caption: plugin_c.py import octoprint.plugin @@ -138,7 +134,6 @@ and ``plugin_d`` don't override :meth:`~octoprint.plugin.core.SortablePlugin.get __plugin_implementation__ = PluginC() .. code-block:: python - :linenos: :caption: plugin_d.py # in this example this is bundled with OctoPrint diff --git a/setup.py b/setup.py index a5a4224e1..5491ca1c1 100644 --- a/setup.py +++ b/setup.py @@ -97,11 +97,11 @@ EXTRA_REQUIRES = { "plugins": ["cookiecutter>=1.7.2,<1.8"], # Dependencies for building the documentation "docs": [ - "readthedocs-sphinx-ext", - "sphinx_rtd_theme", - "sphinx>=3,<4", - "sphinxcontrib-httpdomain", - "sphinxcontrib-mermaid", + "readthedocs-sphinx-ext>=2.1.5,<3", + "sphinx_rtd_theme>=1,<2", + "sphinx>=4,<5", + "sphinxcontrib-httpdomain>=1.8.0,<2", + "sphinxcontrib-mermaid>=0.7.1,<0.8", ], } diff --git a/src/octoprint/plugin/types.py b/src/octoprint/plugin/types.py index b5e7979c1..b6c7241d8 100644 --- a/src/octoprint/plugin/types.py +++ b/src/octoprint/plugin/types.py @@ -631,12 +631,10 @@ class UiPlugin(OctoPrintPlugin, SortablePlugin): at it being a mobile device: .. onlineinclude:: https://raw.githubusercontent.com/OctoPrint/Plugin-Examples/master/dummy_mobile_ui/__init__.py - :linenos: :tab-width: 4 :caption: `dummy_mobile_ui/__init__.py `_ .. onlineinclude:: https://raw.githubusercontent.com/OctoPrint/Plugin-Examples/master/dummy_mobile_ui/templates/dummy_mobile_ui_index.jinja2 - :linenos: :tab-width: 4 :caption: `dummy_mobile_ui/templates/dummy_mobile_ui_index.jinja2 `_ @@ -1191,7 +1189,6 @@ class SimpleApiPlugin(OctoPrintPlugin): Take this example of a plugin registered under plugin identifier ``mysimpleapiplugin``: .. code-block:: python - :linenos: import octoprint.plugin @@ -1327,7 +1324,6 @@ class BlueprintPlugin(OctoPrintPlugin, RestartNeedingPlugin): which behaves exactly the same like Flask's regular ``route`` decorators. Example: .. code-block:: python - :linenos: import octoprint.plugin import flask diff --git a/src/octoprint/plugins/errortracking/__init__.py b/src/octoprint/plugins/errortracking/__init__.py index c1fe9c07f..e15b1bb57 100644 --- a/src/octoprint/plugins/errortracking/__init__.py +++ b/src/octoprint/plugins/errortracking/__init__.py @@ -18,10 +18,10 @@ from octoprint.util.version import ( ) SENTRY_URL_SERVER = ( - "https://4f9abc3158334309ad3c22f6693ee6e7@o118517.ingest.sentry.io/1373987" + "https://b39cd0dcaea5404798ec3eb193b291db@o118517.ingest.sentry.io/1373987" ) SENTRY_URL_COREUI = ( - "https://ef731a61e7a146228b720c54e21c554c@o118517.ingest.sentry.io/1374096" + "https://ab48b21452fe424eaf79468aa6c94bd7@o118517.ingest.sentry.io/1374096" ) SETTINGS_DEFAULTS = { diff --git a/src/octoprint/settings.py b/src/octoprint/settings.py index 9aa7d41ad..3b036d406 100644 --- a/src/octoprint/settings.py +++ b/src/octoprint/settings.py @@ -576,16 +576,30 @@ class HierarchicalChainMap: if d is None: return {} - result = dict() + result = {} for key, value in d.items(): if not key.startswith(prefix): continue subkeys = key[len(prefix) :].split(_CHAINMAP_SEP) current = result + + path = [] for subkey in subkeys[:-1]: - if subkey not in current or current[subkey] is None: + # we only need that for logging in case of data weirdness below + path.append(subkey) + + # make sure the subkey is in the current dict, and that it is a dict + if subkey not in current: current[subkey] = {} + elif not isinstance(current[subkey], dict): + logging.getLogger(__name__).warning( + f"There is a non-dict value on the path to {key} at {path!r}, ignoring." + ) + current[subkey] = {} + + # go down a level current = current[subkey] + current[subkeys[-1]] = value return result diff --git a/src/octoprint/util/__init__.py b/src/octoprint/util/__init__.py index 1057849a3..e1f3f3074 100644 --- a/src/octoprint/util/__init__.py +++ b/src/octoprint/util/__init__.py @@ -1723,7 +1723,7 @@ def serialize(filename, data, encoding="utf-8", compressed=True): If `compressed` is True (the default), the serialized data put through zlib.compress. Supported data types are listed at the bottom of - :ref:`octoprint.util.comprehensive_json`, and include some data types that are not + :func:`octoprint.util.comprehensive_json`, and include some data types that are not supported by json.dumps by default. This is not thread-safe, if concurrent access is required, the caller needs to ensure diff --git a/src/octoprint/util/commandline.py b/src/octoprint/util/commandline.py index dd89fd0f0..67b26ed8f 100644 --- a/src/octoprint/util/commandline.py +++ b/src/octoprint/util/commandline.py @@ -43,7 +43,7 @@ def clean_ansi(line: Union[str, bytes]) -> Union[str, bytes]: Returns: (str or bytes) The line without any ANSI control codes - .. changed:: 1.8.0 + .. versionchanged:: 1.8.0 Usage as ``clean_ansi(line: bytes) -> bytes`` is now deprecated and will be removed in a future version of OctoPrint. diff --git a/tests/settings/test_settings.py b/tests/settings/test_settings.py index 3825f9336..620980ee5 100644 --- a/tests/settings/test_settings.py +++ b/tests/settings/test_settings.py @@ -795,6 +795,10 @@ class ChainmapTest(unittest.TestCase): {_key("a"): None, _key("a", "b"): "b"}, {"a": {"b": "b"}}, ), + ( + {_key("a"): "", _key("a", "b"): "b"}, + {"a": {"b": "b"}}, + ), ) @ddt.unpack def test_unflatten(self, value, expected):