diff --git a/pyalchemybiz/controllers/customer.py b/pyalchemybiz/controllers/customer.py index bc6f059..5e779bf 100644 --- a/pyalchemybiz/controllers/customer.py +++ b/pyalchemybiz/controllers/customer.py @@ -24,8 +24,12 @@ class CustomerController(BaseController): """ Display a customer's details. """ + if id is None: + abort(404) cust_q = meta.Session.query(customer.Customer) c.customer = cust_q.get(int(id)) + if c.customer is None: + abort(404) return render('/derived/customer/view.mako') def new(self): @@ -52,7 +56,7 @@ class CustomerController(BaseController): meta.Session.delete(cust) meta.Session.commit() - redirect_to(action='list') + redirect_to(action='list', id=None) def create(self): """ @@ -67,7 +71,7 @@ class CustomerController(BaseController): meta.Session.add(cust.person) meta.Session.commit() - redirect_to(action='list') + redirect_to(action='list', id=None) def save(self, id): """ @@ -81,4 +85,4 @@ class CustomerController(BaseController): meta.Session.add(cust.person) meta.Session.commit() - redirect_to(action='list') + redirect_to(action='list', id=None)