[Grok-dev] Frustrating error when trying to add grok app instances...

Sebastian Ware sebastian at urbantalk.se
Wed Sep 15 04:49:56 EDT 2010


Uli!

I have filed a bug report:

  https://bugs.launchpad.net/grok/+bug/638763

with the suggested fix.

Mvh Sebastian

14 sep 2010 kl. 19.03 skrev Sebastian Ware:

> We have a Grokproject that has had several apps created and deleted. Now it refuses to create ned instances from the Grok server admin. We have tried stop sever > delete Data.fs > start server but we keep on getting the same error in the UI:
> 
>  Name `sdfdsf` already in use. Please choose another name
> 
> Regardless of what name we choose. Note, no error in the console, only an error in the UI. The app-code has been updated.
> 
> I have looked in the code and found this:
> 
>        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,))
> 
> But might some other error when creating the app raise a DuplicationError? In which case this is hidden by catching the exception. 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))
> 
> Thus exposing the potential error in the application code.
> 
> Mvh Sebastian
> 
> 
> _______________________________________________
> Grok-dev mailing list
> Grok-dev at zope.org
> https://mail.zope.org/mailman/listinfo/grok-dev



More information about the Grok-dev mailing list