Update of /cvsroot/modeling/ProjectModeling/Modeling
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv570/Modeling
Modified Files:
dynamic.py
Log Message:
Fixed bug #981123 reported by Ernesto Revilla: dynamic.build() now accepts PyModels
In the same method: also fixed the generated module's '__name__', and added attribute '__module__' to the generated classes
Index: dynamic.py
===================================================================
RCS file: /cvsroot/modeling/ProjectModeling/Modeling/dynamic.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** dynamic.py 20 Jul 2004 06:21:37 -0000 1.2
--- dynamic.py 24 Nov 2004 15:11:19 -0000 1.3
***************
*** 140,143 ****
--- 140,160 ----
def build(model, define_properties=0):
+ """
+ Takes a model and builds the corresponding package and modules
+
+ :Parameters:
+
+ - `model`: either a `Modeling.Model.Model` or a
+ `Modeling.PyModel.Model`. Please note that if it is a pymodel, its
+ method build() is called
+
+ - `define_properties`:
+
+ """
+ from Modeling import PyModel
+ if isinstance(model, PyModel.Model):
+ if not model.is_built:
+ model.build()
+ model=model.component
module_name=model.packageName()
classes={}
***************
*** 149,153 ****
classes[e.name()]=c
modules[e.name()]=m
! m.__name__='AB.'+e.name() # Not required? but in accordance to observations
add_init(c, e)
add_entityName(c, e)
--- 166,170 ----
classes[e.name()]=c
modules[e.name()]=m
! m.__name__= module_name+'.'+e.name()
add_init(c, e)
add_entityName(c, e)
***************
*** 156,160 ****
if define_properties:
add_properties(c, e)
!
p=new.module(module_name)
--- 173,177 ----
if define_properties:
add_properties(c, e)
! c.__module__=module_name+'.'+e.name()
p=new.module(module_name)
|