Changeset - 9a2affee4a45
[Not reviewed]
default
0 3 0
Marcin Kuzminski - 16 years ago 2010-04-11 17:25:47
marcin@python-blog.com
Updated defaults bug of htmlfill + changed routing
3 files changed with 8 insertions and 7 deletions:
0 comments (0 inline, 0 general)
pylons_app/config/routing.py
Show inline comments
 
@@ -16,19 +16,20 @@ def make_map(config):
 
    # The ErrorController route (handles 404/500 error pages); it should
 
    # likely stay at the top, ensuring it can always be resolved
 
    map.connect('/error/{action}', controller='error')
 
    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='/')
 

	
 
    return map
pylons_app/controllers/users.py
Show inline comments
 
@@ -102,13 +102,13 @@ class UsersController(BaseController):
 
    
 
    
 
    def edit(self, id, format='html'):
 
        """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
 
        )    
pylons_app/templates/user_edit.html
Show inline comments
 
@@ -33,13 +33,13 @@
 
        	<tr>
 
        		<td>${_('New password')}</td>
 
        		<td>${h.text('new_password')}</td>
 
        	</tr>
 
        	<tr>
 
        		<td>${_('Active')}</td>
 
        		<td>${h.checkbox('active')}</td>
 
        		<td>${h.checkbox('active',value=True)}</td>
 
        	</tr>
 
        	<tr>
 
        		<td></td>
 
        		<td>${h.submit('save','save')}</td>
 
        	</tr>
 
        	        	        	
0 comments (0 inline, 0 general)