problems with circular references
Michael Chermside
mcherm at destiny.com
Fri Mar 29 13:50:53 EST 2002
[Jim wants self-contained modules that define error codes
and error messages]
[Handling an error requires a MessageCatalog module, which
imports ALL the modules to build an error message list.]
[Susan suggests that the classes register themselves with
the MessageCatalog instead of being imported by it.]
I think Susan's solution is an excellent one. MessageCatalog shouldn't
have (hard-coded) knowledge of what other modules there are, because it
is intended to be generic. So have all the OTHER modules register their
errors with the MessageCatalog during their import.
Of course, not all of the modules get imported as this is a CGI
application, but the fact that some error code which was generated must
indicate that the module which defines it already got imported (since it
was running!). So while the MessageCatalog may not be *complete*, it
will certainly have all errors which could have occurred.
-- Michael Chermside
More information about the Python-list
mailing list