better handling for not-defined items in Genshi
authorgfawcett <gfawcett@6d9bc8c9-1ec2-4278-b937-99fde70a366f>
Sun, 8 Mar 2009 20:01:43 +0000 (20:01 +0000)
committergfawcett <gfawcett@6d9bc8c9-1ec2-4278-b937-99fde70a366f>
Sun, 8 Mar 2009 20:01:43 +0000 (20:01 +0000)
In days of yore, Genshi had special handling for references to
undefined variables. They were basically treated as null/empty values;
they would evaluate as False in tests; and they would display as
''. That changed out from underneath me, somewhere along the Genshi
path. The modern way is to use a test, "defined('foo')" before
attempting to access 'foo'.

git-svn-id: svn://svn.open-ils.org/ILS-Contrib/servres/trunk@151 6d9bc8c9-1ec2-4278-b937-99fde70a366f

conifer/syrup/views.py
conifer/templates/auth/login.xhtml

index 21a8c79..1223e14 100644 (file)
@@ -27,12 +27,7 @@ def auth_handler(request, path):
                 return HttpResponseRedirect(next)
             else:
                 return g.render('auth/login.xhtml', 
-                                next=request.GET.get('next'),
-                                err=None # fixme, this shouldn't be
-                                         # necessary. Genshi should treat
-                                         # missing names as None, but something
-                                         # is wrong.
-                                )
+                                next=request.GET.get('next'))
         else:
             userid, password = request.POST['userid'], request.POST['password']
             next = request.POST['next']
index abe6c42..67ec62c 100644 (file)
@@ -15,7 +15,7 @@ title = _('Syrup E-Reserves: Please log in')
   <h1>Please log in.</h1>
   <form action="." method="post">
     <input type="hidden" name="next" value="${next}"/>
-    <div class="errors" py:if="err">${err}</div>
+    <div class="errors" py:if="defined('err')">${err}</div>
   <table>
     <tr>
       <th>User ID:</th>