[Grok-doc] Poller Tutorial - NameChooser

Vinay Shastry vinayshastry at gmail.com
Thu Sep 9 02:03:41 EDT 2010


Hi,

Ref: http://grok.zope.org/documentation/tutorial/grok-poller-tutorial/implementing-the-name-chooser

In the chooseName function,

name = name.replace(u' ', u'_').lower()

must come before

name = super(PollerNameChooser, self).chooseName(name, obj)


If not done so, adding "foo bar" the first time will use the name "foo_bar".
The second time, the chooseName picks "foo bar", replaces space with
underscore and sets name as foo_bar, and adding fails with a KeyError
as the name is already taken.


-- 
Vinay S Shastry
http://thenub.one09.net


More information about the grok-doc mailing list