Skip to content

Commit

Permalink
fixed dictionaries processing within DataPoint formula
Browse files Browse the repository at this point in the history
  • Loading branch information
epuzanov committed Jun 14, 2012
1 parent e54827e commit 456b705
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 6 additions & 2 deletions ZenPacks/community/SQLDataSource/zenperfsql.py
Expand Up @@ -373,7 +373,7 @@ def _fetchPerf(self, ignored):
log.debug("Datasource %s %squery:'%s'", datasource.name,
self._preferences.options.showconnectionstring and \
"connection string: '%s', " % datasource.connectionString or "",
datasource.sqlp)
datasource.sql)
datasource.deviceConfig = self._device
task = self._executor.submit(datasource)
task.addBoth(self._processDatasourceResults)
Expand Down Expand Up @@ -421,7 +421,11 @@ def _processDatasourceResults(self, datasource):
try:
if dp.expr:
if dp.expr.__contains__(':'):
dpvalue = eval('{%s}'%dp.expr).get(str(dpvalue))
ed = eval('{%s}'%dp.expr.lower())
if isinstance(dpvalue, float):
dpvalue = int(dpvalue)
dpvalue = ed.get(str(dpvalue).lower()) or ed.get(
'unknown')
else:
dpvalue = rrpn(dp.expr, dpvalue)
values.append(float(dpvalue))
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Expand Up @@ -3,7 +3,7 @@
# or saved. Do not modify them directly here.
# NB: PACKAGES is deprecated
NAME = "ZenPacks.community.SQLDataSource"
VERSION = "2.2.3"
VERSION = "2.2.4"
AUTHOR = "Egor Puzanov"
LICENSE = ""
NAMESPACE_PACKAGES = ['ZenPacks', 'ZenPacks.community']
Expand Down

0 comments on commit 456b705

Please sign in to comment.