Skip to content

Commit

Permalink
Drop version number from weather.ini updating
Browse files Browse the repository at this point in the history
Signed-off-by: Jim Easterbrook <jim@jim-easterbrook.me.uk>
  • Loading branch information
jim-easterbrook committed Sep 7, 2018
1 parent a8fd02b commit 7689ef9
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 18 deletions.
4 changes: 2 additions & 2 deletions src/pywws/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
__version__ = '18.9.0'
_release = '1628'
_commit = '556e9bc'
_release = '1629'
_commit = 'a8fd02b'
30 changes: 14 additions & 16 deletions src/pywws/storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@
else:
from ConfigParser import RawConfigParser

from pywws import _release
from pywws.constants import DAY
from pywws.weatherstation import WSDateTime, WSFloat, WSInt, WSStatus

Expand Down Expand Up @@ -791,22 +790,22 @@ def __init__(self, data_dir, live_logging):
self.shutdown = threading.Event()

def update_params(self):
current_version = int(_release)
file_version = int(self.params.get('config', 'config version', '0'))
if file_version < 1488:
# convert day end hour
day_end_str = self.params.get('config', 'day end hour')
if day_end_str and not ',' in day_end_str:
logger.error('updating "day end hour" in weather.ini')
day_end_str += ', False'
self.params.set('config', 'day end hour', day_end_str)
if file_version < 1582:
# convert uploads to use pywws.service.{copy,ftp,sftp,twitter}
if self.params.get('ftp', 'local site') == 'True':
# convert day end hour
day_end_str = self.params.get('config', 'day end hour')
if day_end_str and not ',' in day_end_str:
logger.error('updating "day end hour" in weather.ini')
day_end_str += ', False'
self.params.set('config', 'day end hour', day_end_str)
# convert uploads to use pywws.service.{copy,ftp,sftp,twitter}
local_site = self.params.get('ftp', 'local site')
secure = self.params.get('ftp', 'secure')
privkey = self.params.get('ftp', 'privkey')
if local_site or secure or privkey:
if local_site == 'True':
self.params.set(
'copy', 'directory', self.params.get('ftp', 'directory', ''))
mod = 'copy'
elif self.params.get('ftp', 'secure') == 'True':
elif secure == 'True':
for key in ('site', 'user', 'directory', 'port',
'password', 'privkey'):
self.params.set('sftp', key, self.params.get('ftp', key, ''))
Expand Down Expand Up @@ -847,8 +846,7 @@ def update_params(self):
logger.error('updating %s in [%s]', t_p, section)
self.params.set(section, t_p, repr(templates))
self.params.set(section, 'services', repr(services))
if file_version < current_version:
self.params.set('config', 'config version', str(current_version))
self.params.unset('config', 'config version')

def terminate(self):
if self.live_logging:
Expand Down

0 comments on commit 7689ef9

Please sign in to comment.