From 866f6ca2afec2569a1145c0d5a904996239b0e6b Mon Sep 17 00:00:00 2001 From: gfawcett Date: Wed, 29 Dec 2010 19:45:28 +0000 Subject: [PATCH] slightly better error on missing title/url on URL item. git-svn-id: svn://svn.open-ils.org/ILS-Contrib/servres/trunk@1152 6d9bc8c9-1ec2-4278-b937-99fde70a366f --- conifer/syrup/views/_common.py | 6 +++++- conifer/syrup/views/items.py | 4 +--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/conifer/syrup/views/_common.py b/conifer/syrup/views/_common.py index 183766e..6fa8430 100644 --- a/conifer/syrup/views/_common.py +++ b/conifer/syrup/views/_common.py @@ -124,8 +124,12 @@ def simple_message(title, content, go_back=True, **kwargs): def custom_500_handler(request): cls, inst, tb = sys.exc_info() + if settings.DEBUG: + body = repr((request.__dict__, inst)) + else: + body = '' msg = simple_message(_('Error: %s') % repr(inst), - repr((request.__dict__, inst))) + body) return HttpResponse(msg._container, status=501) def custom_400_handler(request): diff --git a/conifer/syrup/views/items.py b/conifer/syrup/views/items.py index d6a83e0..8227eb0 100644 --- a/conifer/syrup/views/items.py +++ b/conifer/syrup/views/items.py @@ -154,9 +154,7 @@ def item_add(request, site_id, item_id): publisher = clean('publisher') published = clean('published') if not (title and url): - raise Exception(locals()) - # fixme, better error handling. - return HttpResponseRedirect(request.get_full_path()) + raise Exception('Missing title and/or URL.') else: item = models.Item( site=site, -- 2.11.0