[Zope] Defining classes in scripts in Zope 2.7, examples are
broken
Stefan H. Holek
stefan at epy.co.at
Fri Dec 19 16:22:41 EST 2003
Please file a collector issue.
<http://zope.org/Collectors/Zope>
Stefan
--On Freitag, 19. Dezember 2003 12:44 -0500 Jeff Kowalczyk <jtk at yahoo.com>
wrote:
> What is the new convention for creating classes in scripts? Is
> it disallowed now?
>
> The examples (File Library, Guest Book) define exception
> classes in their add/upload scripts, which results in an error on
> Zope2.7b3 Win32.
>
> Thanks.
>
> Error Type: NameError
> Error Value: global name '__name__' is not defined
>
>
> """Create a guest book entry. """
> class LimitExceeded(Exception):
> """raised when too many entries are submitted"""
>
> entries_folder=container.Entries
>
># create up-to 5 unique entry ids, a real app might not impose such a
># small limit, but we do because this is just an example after all
> n=len(entries_folder.objectIds())
> if n > 4: raise LimitExceeded, "limit on number of entries (5) exceeded"
> id='entry_%d' % n
>
>
>
> _______________________________________________
> Zope maillist - Zope at zope.org
> http://mail.zope.org/mailman/listinfo/zope
> ** No cross posts or HTML encoding! **
> (Related lists -
> http://mail.zope.org/mailman/listinfo/zope-announce
> http://mail.zope.org/mailman/listinfo/zope-dev )
--
The time has come to start talking about whether the emperor is as well
dressed as we are supposed to think he is. /Pete McBreen/
More information about the Zope
mailing list