DuplicationError caught in admin when creating app providing wrong error message when error is in app

Bug #638763 reported by jhsware
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
grok
Fix Released
Low
Uli Fouquet

Bug Description

in admin/view.py the code

       try:
           new_app = app()
           grok.notify(grok.ObjectCreatedEvent(new_app))
           self.context.root[name] = new_app
           self.flash(u'Added %s `%s`.' % (application, name))
       except DuplicationError:
           self.flash(u'Name `%s` already in use. '
                      u'Please choose another name.' % (name,))

Catches errors in application and hides the traceback. It would be nicer to have:

       if self.context.root.has_key(name):
           self.flash(u'Name `%s` already in use. '
                      u'Please choose another name.' % (name,))
 else:
           new_app = app()
           grok.notify(grok.ObjectCreatedEvent(new_app))
           self.context.root[name] = new_app
           self.flash(u'Added %s `%s`.' % (application, name))

Revision history for this message
Uli Fouquet (uli-gnufix) wrote :

It only catches DuplicationErrors but I understand that also these can happen during application creation.

Changed in grok:
assignee: nobody → Uli Fouquet (uli-gnufix)
status: New → Confirmed
importance: Undecided → Low
Revision history for this message
jhsware (sebastian-urbantalk) wrote :

Correct. In my case it was code running in the app.__init__() method which caused a DuplicationError and it took a while to figure out what was wrong.

If we want to catch the error, I think it still should output to the error log. Our first reaction was to look in the error log to see what might have gone wrong.

Uli Fouquet (uli-gnufix)
Changed in grok:
status: Confirmed → In Progress
Uli Fouquet (uli-gnufix)
Changed in grok:
status: In Progress → Fix Committed
Changed in grok:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.