[Modeling-cvs] ProjectModeling/Modeling/scripts mdl_generate_DB_schema.py,1.3,1.3.2.1 mdl_generate_p
Status: Abandoned
Brought to you by:
sbigaret
|
From: <sbi...@us...> - 2003-06-28 15:34:39
|
Update of /cvsroot/modeling/ProjectModeling/Modeling/scripts
In directory sc8-pr-cvs1:/tmp/cvs-serv11059/scripts
Modified Files:
Tag: brch-0_9pre7-1-PyModel
mdl_generate_DB_schema.py mdl_generate_python_code.py
mdl_validate_model.py
Log Message:
Scripts adapted to handle PyModel files
Index: mdl_generate_DB_schema.py
===================================================================
RCS file: /cvsroot/modeling/ProjectModeling/Modeling/scripts/mdl_generate_DB_schema.py,v
retrieving revision 1.3
retrieving revision 1.3.2.1
diff -C2 -d -r1.3 -r1.3.2.1
*** mdl_generate_DB_schema.py 22 Apr 2003 12:11:08 -0000 1.3
--- mdl_generate_DB_schema.py 28 Jun 2003 15:34:36 -0000 1.3.2.1
***************
*** 29,33 ****
__version__='$Revision$'[11:-2]
- from Modeling.ModelSet import ModelSet
from Modeling.SchemaGeneration import SchemaGeneration, \
DropPrimaryKeySupportKey, DropForeignKeyConstraintsKey, \
--- 29,32 ----
***************
*** 116,121 ****
def usage(prgName):
_usage="""
! %s [options] model.xml
! Generates and/or executes the SQL code
General options
--- 115,122 ----
def usage(prgName):
_usage="""
! %s [options] model.(xml|py)
!
! Generates and/or executes the SQL code from a model, either an xml file or a
! PyModel.
General options
***************
*** 321,329 ****
model_file=args[0]
# load the model
! ms=ModelSet()
! ms.addModelFromXML({'file':model_file})
if user_connection_dict:
! ms.models()[0].setConnectionDictionary(user_connection_dict)
! result=databaseSchemaWithOptions(ms.models()[0], _defaultOptions,
administrativeConnectionDictionary=admin_connection_dict,
continue_on_errors=continue_on_errors,
--- 322,338 ----
model_file=args[0]
# load the model
! log("Loading the model...")
! try:
! from Modeling import Model
! model=Model.loadModel(model_file)
! if not model:
! raise RuntimeError, "Abnormal: got no exception but Model is None"
! except Exception, exc:
! log("Serious: couldn't load the model")
! log(tracebackInfoFromStack(exc))
! return 3
if user_connection_dict:
! model.setConnectionDictionary(user_connection_dict)
! result=databaseSchemaWithOptions(model, _defaultOptions,
administrativeConnectionDictionary=admin_connection_dict,
continue_on_errors=continue_on_errors,
Index: mdl_generate_python_code.py
===================================================================
RCS file: /cvsroot/modeling/ProjectModeling/Modeling/scripts/mdl_generate_python_code.py,v
retrieving revision 1.4
retrieving revision 1.4.4.1
diff -C2 -d -r1.4 -r1.4.4.1
*** mdl_generate_python_code.py 20 Apr 2003 16:10:41 -0000 1.4
--- mdl_generate_python_code.py 28 Jun 2003 15:34:36 -0000 1.4.4.1
***************
*** 34,38 ****
__version__='$Revision$'[11:-2]
- from Modeling.ModelSet import ModelSet
import getopt, sys
--- 34,37 ----
***************
*** 93,98 ****
"Writes usage on sys.stderr"
_usage="""
! %s [options] model.xml [directory]
! Generates python code from a model
Parameter:
--- 92,97 ----
"Writes usage on sys.stderr"
_usage="""
! %s [options] model.(xml|py) [directory]
! Generates python code from a model, either a xml-model file or a PyModel.
Parameter:
***************
*** 146,161 ****
# load the model
! ms=ModelSet()
try:
! ms.addModelFromXML({'file':model_file})
! if not ms.models():
! raise RuntimeError, "Abnormal: got no exception but ModelSet is empty"
except Exception, exc:
- log("Serious: couldn't load the model")
if verbose: log(tracebackInfoFromStack(exc))
else: log('(-v will give you the traceback)')
return 1
- model=ms.models()[0]
try:
build_python_code(model, generation_scheme, rootPath, verbose_mode=verbose)
--- 145,159 ----
# load the model
! if verbose: log("Loading the model...")
try:
! from Modeling import Model
! model=Model.loadModel(model_file)
! if not model:
! raise RuntimeError, "Abnormal: got no exception but Model is None"
except Exception, exc:
if verbose: log(tracebackInfoFromStack(exc))
else: log('(-v will give you the traceback)')
return 1
try:
build_python_code(model, generation_scheme, rootPath, verbose_mode=verbose)
Index: mdl_validate_model.py
===================================================================
RCS file: /cvsroot/modeling/ProjectModeling/Modeling/scripts/mdl_validate_model.py,v
retrieving revision 1.3
retrieving revision 1.3.2.1
diff -C2 -d -r1.3 -r1.3.2.1
*** mdl_validate_model.py 22 Apr 2003 11:08:00 -0000 1.3
--- mdl_validate_model.py 28 Jun 2003 15:34:36 -0000 1.3.2.1
***************
*** 29,33 ****
__version__='$Revision$'[11:-2]
- from Modeling.ModelSet import ModelSet
from Modeling import ModelValidation as MV
from Modeling.ModelValidation import NOT_SUPPORTED, ERROR, WARNING, INFO
--- 29,32 ----
***************
*** 54,59 ****
def usage(prgName):
_usage="""
! %s [options] model.xml
Validate a model. Errors and warnings messages are written on sys.stderr.
Return status:
--- 53,59 ----
def usage(prgName):
_usage="""
! %s [options] model.(xml|py)
Validate a model. Errors and warnings messages are written on sys.stderr.
+ The model file can be either a xml model file or a PyModel.
Return status:
***************
*** 114,122 ****
# load the model
if verbose: log("Loading the model...")
- ms=ModelSet()
try:
! ms.addModelFromXML({'file':model_file})
! if not ms.models():
! raise RuntimeError, "Abnormal: got no exception but ModelSet is empty"
except Exception, exc:
log("Serious: couldn't load the model")
--- 114,122 ----
# load the model
if verbose: log("Loading the model...")
try:
! from Modeling import Model
! model=Model.loadModel(model_file)
! if not model:
! raise RuntimeError, "Abnormal: got no exception but Model is None"
except Exception, exc:
log("Serious: couldn't load the model")
***************
*** 125,129 ****
if verbose: log("Done.")
if verbose: log("Validating...")
! errors=validate_model(ms.models()[0], ignore_levels)
if verbose: log("Done.")
--- 125,129 ----
if verbose: log("Done.")
if verbose: log("Validating...")
! errors=validate_model(model, ignore_levels)
if verbose: log("Done.")
|