diff options
Diffstat (limited to 'ipsilon/util/data.py')
-rwxr-xr-x | ipsilon/util/data.py | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/ipsilon/util/data.py b/ipsilon/util/data.py index 5045ee2..ee0bdca 100755 --- a/ipsilon/util/data.py +++ b/ipsilon/util/data.py @@ -46,6 +46,10 @@ class SqlStore(Log): def connection(self): return self._dbengine.connect() + @property + def config_changed(self): + return True + def SqlAutotable(f): def at(self, *args, **kwargs): @@ -124,21 +128,31 @@ class FileStore(Log): def __init__(self, name): self._filename = name self.is_readonly = True - self._timestamp = None + self._timestamp = 0 self._config = None - def get_config(self): + def _stat_conf_file(self): try: - stat = os.stat(self._filename) + return os.stat(self._filename) except OSError, e: self.error("Unable to check config file %s: [%s]" % ( self._filename, e)) self._config = None raise - timestamp = stat.st_mtime - if self._config is None or timestamp > self._timestamp: + + @property + def config_changed(self): + stat = self._stat_conf_file() + if stat.st_mtime != self._timestamp: + return True + return False + + def get_config(self): + stat = self._stat_conf_file() + if self._config is None or stat.st_mtime != self._timestamp: self._config = ConfigParser.RawConfigParser() self._config.read(self._filename) + self._timestamp = stat.st_mtime return self._config @@ -252,6 +266,10 @@ class Store(Log): def is_readonly(self): return self._db.is_readonly + @property + def config_changed(self): + return self._db.config_changed + def _row_to_dict_tree(self, data, row): name = row[0] if len(row) > 2: |