[Zope] Defining classes in scripts in Zope 2.7, examples are broken

Jeff Kowalczyk jtk at yahoo.com
Fri Dec 19 12:44:33 EST 2003


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





More information about the Zope mailing list