changeset 28:e54a6405a496

display errors for preferences form
author k0s <k0scist@gmail.com>
date Sat, 31 Oct 2009 23:04:20 -0400
parents 4101fdb16ab2
children 6a1c85adc671
files bitsyblog/bitsyblog.py bitsyblog/settings.py bitsyblog/templates/preferences.html
diffstat 3 files changed, 9 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/bitsyblog/bitsyblog.py	Sat Oct 31 01:36:25 2009 -0400
+++ b/bitsyblog/bitsyblog.py	Sat Oct 31 23:04:20 2009 -0400
@@ -13,8 +13,7 @@
 
 ### imports
 
-import dateutil.parser  # XXX separate, for now
-import parser # bitsyblog dateutil parser
+import dateutil.parser
 
 import cgi
 import datetime
@@ -818,6 +817,7 @@
         data['users'] = [ i for i in list(self.users.users()) 
                           if i != user ]
         data['message'] = message
+        data['errors'] = errors or {}
 
         # render the template
         template = self.loader.load('preferences.html')
--- a/bitsyblog/settings.py	Sat Oct 31 01:36:25 2009 -0400
+++ b/bitsyblog/settings.py	Sat Oct 31 23:04:20 2009 -0400
@@ -1,6 +1,6 @@
 """user settings / preferences"""
 
-import parser # dateutils.parser with mods to retain strftime format
+import parser # bitsyblog dateutils.parser with mods to retain strftime format
 import urllib2
 import utils
 
--- a/bitsyblog/templates/preferences.html	Sat Oct 31 01:36:25 2009 -0400
+++ b/bitsyblog/templates/preferences.html	Sat Oct 31 23:04:20 2009 -0400
@@ -34,6 +34,9 @@
           <td>
             <input type="text" name="Date format" value="${now}" size="22"/>
           </td>
+          <td class="error" py:if="'Date format' in errors">
+            ${errors['Date format']}
+          </td>
         </tr>
 
         <tr>
@@ -60,6 +63,9 @@
         <tr>
           <td><span title="upload a CSS file to theme your webpage"><strong>CSS file:</strong></span></td>
           <td><input type="file" name="CSS file"/></td>
+          <td class="error" py:if="'CSS file' in errors">
+            ${errors['CSS file']}
+          </td>
         </tr>
 
         <tr py:if="users">