switch to explicit routing

This commit is contained in:
Jan Dittberner 2009-03-17 22:38:39 +01:00
parent 97d1cd7090
commit d86d2349af
5 changed files with 10 additions and 10 deletions

View file

@ -10,7 +10,7 @@ from routes import Mapper
def make_map(): def make_map():
"""Create, configure and return the routes Mapper""" """Create, configure and return the routes Mapper"""
map = Mapper(directory=config['pylons.paths']['controllers'], map = Mapper(directory=config['pylons.paths']['controllers'],
always_scan=config['debug']) always_scan=config['debug'], explicit = True)
map.minimization = False map.minimization = False
# The ErrorController route (handles 404/500 error pages); it should # The ErrorController route (handles 404/500 error pages); it should

View file

@ -93,7 +93,7 @@ class CustomerController(BaseController):
meta.Session.delete(cust) meta.Session.delete(cust)
meta.Session.commit() meta.Session.commit()
redirect_to(action='list', id=None) redirect_to(controller='customer', action='list')
@restrict('POST') @restrict('POST')
@validate(schema=NewCustomerForm(), form='new') @validate(schema=NewCustomerForm(), form='new')
@ -110,7 +110,7 @@ class CustomerController(BaseController):
meta.Session.add(cust.person) meta.Session.add(cust.person)
meta.Session.commit() meta.Session.commit()
redirect_to(action='list', id=None) redirect_to(controller='customer', action='list')
@restrict('POST') @restrict('POST')
@validate(schema=NewCustomerForm(), form='edit') @validate(schema=NewCustomerForm(), form='edit')
@ -129,4 +129,4 @@ class CustomerController(BaseController):
meta.Session.add(cust.person) meta.Session.add(cust.person)
meta.Session.commit() meta.Session.commit()
redirect_to(action='list', id=None) redirect_to(controller='customer', action='list')

View file

@ -1,6 +1,6 @@
<%inherit file="/base/customer.mako" /> <%inherit file="/base/customer.mako" />
<%namespace file="fields.mako" name="fields" import="*"/> <%namespace file="fields.mako" name="fields" import="*"/>
${h.form(h.url_for(action='save'))} ${h.form(h.url_for(controller='customer', action='save', id=c.id))}
<fieldset id="editcustomerform"> <fieldset id="editcustomerform">
<legend>${_('Edit customer')}</legend> <legend>${_('Edit customer')}</legend>
${fields.body()} ${fields.body()}

View file

@ -1,6 +1,6 @@
<%inherit file="/base/customer.mako" /> <%inherit file="/base/customer.mako" />
<%namespace file="fields.mako" name="fields" import="*"/> <%namespace file="fields.mako" name="fields" import="*"/>
${h.form(h.url_for(action='create'))} ${h.form(h.url_for(controller='customer', action='create'))}
<fieldset id="createcustomerform"> <fieldset id="createcustomerform">
<legend>${_('Create new customer')}</legend> <legend>${_('Create new customer')}</legend>
${fields.body()} ${fields.body()}

View file

@ -15,10 +15,10 @@
<%def name="footer()"> <%def name="footer()">
<p> <p>
${h.link_to(_('All Customers'), h.url_for(controller='customer', action='list', id=None))} ${h.link_to(_('All Customers'), h.url_for(controller='customer', action='list'))}
| ${h.link_to(_('New Customer'), h.url_for(controller='customer', action='new', id=None))} | ${h.link_to(_('New Customer'), h.url_for(controller='customer', action='new'))}
| ${h.link_to(_('Edit Customer'), h.url_for(controller='customer', action='edit'))} | ${h.link_to(_('Edit Customer'), h.url_for(controller='customer', action='edit', id=c.id))}
| ${h.link_to(_('Delete Customer'), h.url_for(controller='customer', action='delete'))} | ${h.link_to(_('Delete Customer'), h.url_for(controller='customer', action='delete', id=c.id))}
</p> </p>
${parent.footer()} ${parent.footer()}
</%def> </%def>