Skip to content

Commit

Permalink
v5 compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
mKainzbauer committed Oct 27, 2023
1 parent e388c07 commit f748e4e
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 9 deletions.
11 changes: 7 additions & 4 deletions bin/user/historygenerator.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,15 @@
import logging
import os.path

from configobj import ConfigObj
import weewx.units
import weeutil.weeutil

try:
from weeutil.weeutil import accumulateLeaves
except:
from weeutil.config import accumulateLeaves
from weewx.cheetahgenerator import SearchList
from weewx.tags import TimespanBinder
import weeutil.weeutil
import weewx.units

log = logging.getLogger(__name__)

Expand Down Expand Up @@ -105,7 +108,7 @@ def get_extension_list(self, valid_timespan, db_lookup):
for table in self.table_dict.sections:
noaa = True if table == 'NOAA' else False

table_options = weeutil.weeutil.accumulateLeaves(self.table_dict[table])
table_options = accumulateLeaves(self.table_dict[table])


# Get the binding where the data is allocated
Expand Down
15 changes: 10 additions & 5 deletions bin/user/jsonengine.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,17 @@
import json
import os.path

import weeutil.weeutil
import weewx.reportengine
from weewx.units import convert

from user.sunevents import SunEvents
try:
from weeutil.weeutil import accumulateLeaves
except:
from weeutil.config import accumulateLeaves
from weeutil.config import merge_config
from weewx.units import convert
from weeutil.weeutil import to_bool
from user.sunevents import SunEvents


log = logging.getLogger(__name__)

Expand Down Expand Up @@ -80,7 +85,7 @@ def setup(self):

self.show_daynight = True
try:
self.show_daynight = weeutil.weeutil.to_bool(self.chart_dict['show_daynight'])
self.show_daynight = to_bool(self.chart_dict['show_daynight'])
except KeyError:
log.debug('show_daynight is on')

Expand Down Expand Up @@ -113,7 +118,7 @@ def gen_data(self):
self.frontend_data['source_unit_system'][unit_system_item[0]] = unit_system_item[1]
self.frontend_data['units'] = self.units_dict
self.frontend_data['labels'] = self.labels_dict
live_options = weeutil.weeutil.accumulateLeaves(self.json_dict)
live_options = accumulateLeaves(self.json_dict)

for gauge in self.gauge_dict.sections:
data_type = self.gauge_dict[gauge].get('data_type', gauge)
Expand Down

0 comments on commit f748e4e

Please sign in to comment.