changeset 70:9a2affee4a45

Updated defaults bug of htmlfill + changed routing
author Marcin Kuzminski <marcin@python-blog.com>
date Sun, 11 Apr 2010 17:25:47 +0200
parents 76b23189f987
children ae17858de050
files pylons_app/config/routing.py pylons_app/controllers/users.py pylons_app/templates/user_edit.html
diffstat 3 files changed, 8 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/pylons_app/config/routing.py	Sun Apr 11 17:24:57 2010 +0200
+++ b/pylons_app/config/routing.py	Sun Apr 11 17:25:47 2010 +0200
@@ -19,14 +19,15 @@
     map.connect('/error/{action}/{id}', controller='error')
 
     # CUSTOM ROUTES HERE
-    with map.submapper(path_prefix='/_admin', controller='admin') as m:
-        m.connect('admin_home', '/', action='index')#main page
-        m.connect('admin_add_repo', '/add_repo/{new_repo:[a-z0-9\. _-]*}', action='add_repo')
+    map.connect('hg_home', '/', controller='hg', action='index')
     
     map.resource('repo', 'repos', path_prefix='/_admin')
     map.resource('user', 'users', path_prefix='/_admin')
     
-    map.connect('hg_home', '/', controller='hg', action='index')
+    
+    with map.submapper(path_prefix='/_admin', controller='admin') as m:
+        m.connect('admin_home', '/', action='index')#main page
+        m.connect('admin_add_repo', '/add_repo/{new_repo:[a-z0-9\. _-]*}', action='add_repo')
         
     map.connect('hg', '/{path_info:.*}', controller='hg',
                 action="view", path_info='/')
--- a/pylons_app/controllers/users.py	Sun Apr 11 17:24:57 2010 +0200
+++ b/pylons_app/controllers/users.py	Sun Apr 11 17:25:47 2010 +0200
@@ -105,10 +105,10 @@
         """GET /users/id/edit: Form to edit an existing item"""
         # url('edit_user', id=ID)
         c.user = self.sa.query(Users).get(id)
-        print c.user.__dict__
+        defaults = c.user.__dict__
         return htmlfill.render(
             render('/user_edit.html'),
-            defaults=c.user.__dict__,
+            defaults=defaults,
             encoding="UTF-8",
             force_defaults=False
         )    
--- a/pylons_app/templates/user_edit.html	Sun Apr 11 17:24:57 2010 +0200
+++ b/pylons_app/templates/user_edit.html	Sun Apr 11 17:25:47 2010 +0200
@@ -36,7 +36,7 @@
         	</tr>
         	<tr>
         		<td>${_('Active')}</td>
-        		<td>${h.checkbox('active')}</td>
+        		<td>${h.checkbox('active',value=True)}</td>
         	</tr>
         	<tr>
         		<td></td>