From: <de...@us...> - 2003-04-05 00:27:04
|
Update of /cvsroot/pymerase/pymerase/pymerase/output/dbAPI In directory sc8-pr-cvs1:/tmp/cvs-serv16130 Modified Files: init.py Log Message: Renamed MODULES to CLASSES_LIST as it was a better name, since it was representing the mapping between classes and the modules they contained Added the modulesReload module-level function which allows the programmer to force reloading all of the API class modules. (Useful for after you generated a new API from within the same python session). Index: init.py =================================================================== RCS file: /cvsroot/pymerase/pymerase/pymerase/output/dbAPI/init.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** init.py 2 Apr 2003 23:25:32 -0000 1.5 --- init.py 5 Apr 2003 00:27:01 -0000 1.6 *************** *** 10,13 **** --- 10,29 ---- %%IMPORT_MODULES%% + + def moduleReload(): + """Reload all support modules + + This is needed if you want to reimport an API after regenerating it + within the same python session. + """ + # if we're being reinitialized reload all of our modules + modules = %%MODULES_LIST%% + + for module in modules: + if sys.modules.has_key(module.__name__): + #print "reloading module %s" % (module.__name__) + reload(module) + + class Functor: def __init__(self, function, *args, **kargs): *************** *** 53,64 **** # object pointing to the low level database api self.db = None ! # class references is used to lookup the table class variable information # in getObjects and getAllObjects self.class_references = {} ! modules_to_load = %%MODULES%% ! self.__loadClasses(modules_to_load) self.connect() --- 69,80 ---- # object pointing to the low level database api self.db = None ! # class references is used to lookup the table class variable information # in getObjects and getAllObjects self.class_references = {} ! classes_to_load = %%CLASSES_LIST%% ! self.__loadClasses(classes_to_load) self.connect() |