[Mpuls-commits] r5166 - in base/trunk: . mpulsweb/controllers mpulsweb/model
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Thu Jul 14 14:20:58 CEST 2011
Author: roland
Date: 2011-07-14 14:20:56 +0200 (Thu, 14 Jul 2011)
New Revision: 5166
Modified:
base/trunk/ChangeLog
base/trunk/mpulsweb/controllers/settings.py
base/trunk/mpulsweb/model/agencysettings.py
Log:
issue2252: manually convert 'on'/'off' values to boolean to avoid problems with htmlfill
Modified: base/trunk/ChangeLog
===================================================================
--- base/trunk/ChangeLog 2011-07-14 08:01:41 UTC (rev 5165)
+++ base/trunk/ChangeLog 2011-07-14 12:20:56 UTC (rev 5166)
@@ -1,3 +1,9 @@
+2011-07-14 Roland Geider <roland.geider at intevation.de>
+
+ * mpulsweb/model/agencysettings.py,
+ mpulsweb/controllers/settings.py: issue2252: manually convert 'on'/'off'
+ values to boolean to avoid problems with htmlfill
+
2011-07-14 Torsten Irländer <torsten.irlaender at intevation.de>
* mpulsweb/lib/translation.py: Added new function "N_" for
Modified: base/trunk/mpulsweb/controllers/settings.py
===================================================================
--- base/trunk/mpulsweb/controllers/settings.py 2011-07-14 08:01:41 UTC (rev 5165)
+++ base/trunk/mpulsweb/controllers/settings.py 2011-07-14 12:20:56 UTC (rev 5166)
@@ -31,7 +31,7 @@
def edit(self):
c.agency = Agency()
c.form_errors = {}
- c.form_result = c.agency.conf
+ c.form_result = c.agency.conf
form = render('/settings/edit.mako')
return formencode.htmlfill.render(form,
defaults=c.form_result,
Modified: base/trunk/mpulsweb/model/agencysettings.py
===================================================================
--- base/trunk/mpulsweb/model/agencysettings.py 2011-07-14 08:01:41 UTC (rev 5165)
+++ base/trunk/mpulsweb/model/agencysettings.py 2011-07-14 12:20:56 UTC (rev 5166)
@@ -59,8 +59,17 @@
cur = conn.cursor(cursor_factory=psycopg2.extras.DictCursor)
cur.execute(FETCH_SETTINGS_SQL)
rows = cur.fetchall()
+
+ # Manually convert on/off-values to boolean so they can be passed
+ # to htmlfill
for row in rows:
- self.conf[row['bez']] = ensure_unicode(row['wert'])
+ if row['wert'] == 'on':
+ wert = True
+ elif row['wert'] == 'off':
+ wert = False
+ else:
+ wert = ensure_unicode(row['wert'])
+ self.conf[row['bez']] = wert
finally:
db.recycleConnection(conn, cur)
@@ -89,8 +98,7 @@
traceback.print_exc(file=sys.stderr)
def isAnonTransfer(self):
- anon = self.conf.get('anon_transfer', '').strip().lower()
- return anon == 'on' or anon == '1'
+ return self.conf.get('anon_transfer', True)
def getFKZ(self):
return self.conf.get('fkz', u'')
More information about the Mpuls-commits
mailing list