[Mpuls-commits] r5188 - in base/tags/2.0.15.1: . mpulsweb/controllers mpulsweb/model

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Fri Jul 22 11:34:50 CEST 2011


Author: roland
Date: 2011-07-22 11:34:49 +0200 (Fri, 22 Jul 2011)
New Revision: 5188

Modified:
   base/tags/2.0.15.1/ChangeLog
   base/tags/2.0.15.1/mpulsweb/controllers/settings.py
   base/tags/2.0.15.1/mpulsweb/model/agencysettings.py
Log:
Backported changes for Issue2252, hotfix

Modified: base/tags/2.0.15.1/ChangeLog
===================================================================
--- base/tags/2.0.15.1/ChangeLog	2011-07-21 11:39:17 UTC (rev 5187)
+++ base/tags/2.0.15.1/ChangeLog	2011-07-22 09:34:49 UTC (rev 5188)
@@ -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-06-15  Roland Geider  <roland.geider at intevation.de>
 
 	* mpulsweb/public/styles/all.css: issue2192: align the phase buttons

Modified: base/tags/2.0.15.1/mpulsweb/controllers/settings.py
===================================================================
--- base/tags/2.0.15.1/mpulsweb/controllers/settings.py	2011-07-21 11:39:17 UTC (rev 5187)
+++ base/tags/2.0.15.1/mpulsweb/controllers/settings.py	2011-07-22 09:34:49 UTC (rev 5188)
@@ -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/tags/2.0.15.1/mpulsweb/model/agencysettings.py
===================================================================
--- base/tags/2.0.15.1/mpulsweb/model/agencysettings.py	2011-07-21 11:39:17 UTC (rev 5187)
+++ base/tags/2.0.15.1/mpulsweb/model/agencysettings.py	2011-07-22 09:34:49 UTC (rev 5188)
@@ -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