From d60efc1cb43a1dbd54e111c213936dc667af2398 Mon Sep 17 00:00:00 2001 From: Tom Keffer Date: Fri, 29 May 2020 17:10:59 -0700 Subject: [PATCH] Revert "Avoid using copy.deepcopy()." This reverts commit d077a8bddc98a7b00f84ac33b17a5fa2f0823736. --- bin/weewx/cheetahgenerator.py | 3 +-- bin/weewx/reportengine.py | 12 ++++++------ 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/bin/weewx/cheetahgenerator.py b/bin/weewx/cheetahgenerator.py index c8cbb8a5..d1058a4c 100644 --- a/bin/weewx/cheetahgenerator.py +++ b/bin/weewx/cheetahgenerator.py @@ -62,7 +62,6 @@ import logging import os.path import time -import configobj import Cheetah.Filters import Cheetah.Template import six @@ -129,7 +128,7 @@ class CheetahGenerator(weewx.reportengine.ReportGenerator): self.setup() # Make a deep copy of the skin dictionary (we will be modifying it): - gen_dict = configobj.ConfigObj(self.skin_dict.dict()) + gen_dict = copy.deepcopy(self.skin_dict) # Look for options in [CheetahGenerator], section_name = "CheetahGenerator" diff --git a/bin/weewx/reportengine.py b/bin/weewx/reportengine.py index 159b2076..6c94a2f1 100644 --- a/bin/weewx/reportengine.py +++ b/bin/weewx/reportengine.py @@ -1,5 +1,5 @@ # -# Copyright (c) 2009-2020 Tom Keffer +# Copyright (c) 2009-2019 Tom Keffer # # See the file LICENSE.txt for your full rights. # @@ -8,6 +8,7 @@ from __future__ import absolute_import # System imports: +import copy import datetime import ftplib import glob @@ -140,9 +141,8 @@ class StdReportEngine(threading.Thread): # Fetch and build the skin_dict: try: skin_dict = self._build_skin_dict(report) - except SyntaxError as e: - log.error("Syntax error: %s", e) - log.error(" **** Report ignored") + except SyntaxError: + log.error(" **** Report ignored") continue # Default action is to run the report. Only reason to not run it is @@ -216,7 +216,7 @@ class StdReportEngine(threading.Thread): # Start with the defaults in the defaults module. Because we will be modifying it, we need to make a deep # copy. - skin_dict = configobj.ConfigObj(weewx.defaults.defaults.dict()) + skin_dict = copy.deepcopy(weewx.defaults.defaults) # Add the report name: skin_dict['REPORT_NAME'] = report @@ -245,7 +245,7 @@ class StdReportEngine(threading.Thread): # Now add on the [StdReport][[Defaults]] section, if present: if 'Defaults' in self.config_dict['StdReport']: - merge_dict = self.config_dict['StdReport']['Defaults'].dict() + merge_dict = copy.deepcopy(self.config_dict['StdReport']['Defaults']) weeutil.config.merge_config(skin_dict, merge_dict) # Inject any scalar overrides. This is for backwards compatibility. These options should now go