Revert "Avoid using copy.deepcopy()."

This reverts commit d077a8bddc.
This commit is contained in:
Tom Keffer
2020-05-29 17:10:59 -07:00
parent 68747ac2d5
commit d60efc1cb4
2 changed files with 7 additions and 8 deletions

View File

@@ -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"

View File

@@ -1,5 +1,5 @@
#
# Copyright (c) 2009-2020 Tom Keffer <tkeffer@gmail.com>
# Copyright (c) 2009-2019 Tom Keffer <tkeffer@gmail.com>
#
# 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