slightly better error on missing title/url on URL item.
authorgfawcett <gfawcett@6d9bc8c9-1ec2-4278-b937-99fde70a366f>
Wed, 29 Dec 2010 19:45:28 +0000 (19:45 +0000)
committergfawcett <gfawcett@6d9bc8c9-1ec2-4278-b937-99fde70a366f>
Wed, 29 Dec 2010 19:45:28 +0000 (19:45 +0000)
git-svn-id: svn://svn.open-ils.org/ILS-Contrib/servres/trunk@1152 6d9bc8c9-1ec2-4278-b937-99fde70a366f

conifer/syrup/views/_common.py
conifer/syrup/views/items.py

index 183766e..6fa8430 100644 (file)
@@ -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):
index d6a83e0..8227eb0 100644 (file)
@@ -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,