19 Dec
2003
19 Dec
'03
5:44 p.m.
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