[Modeling-cvs] ProjectModeling/Modeling/scripts mdl_generate_DB_schema.py,1.3,1.4 mdl_generate_pytho
Status: Abandoned
Brought to you by:
sbigaret
From: <sbi...@us...> - 2003-07-07 14:57:17
|
Update of /cvsroot/modeling/ProjectModeling/Modeling/scripts In directory sc8-pr-cvs1:/tmp/cvs-serv7471/ProjectModeling/Modeling/scripts Modified Files: mdl_generate_DB_schema.py mdl_generate_python_code.py mdl_validate_model.py Log Message: Merged branch brch-0_9pre7-1-PyModel. Introducing: ability to express models in plain python rather than in xml files. See CHANGES for details. 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.4 diff -C2 -d -r1.3 -r1.4 *** mdl_generate_DB_schema.py 22 Apr 2003 12:11:08 -0000 1.3 --- mdl_generate_DB_schema.py 7 Jul 2003 14:57:14 -0000 1.4 *************** *** 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.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** mdl_generate_python_code.py 26 May 2003 15:44:49 -0000 1.5 --- mdl_generate_python_code.py 7 Jul 2003 14:57:14 -0000 1.6 *************** *** 34,38 **** __version__='$Revision$'[11:-2] - from Modeling.ModelSet import ModelSet import getopt, sys --- 34,37 ---- *************** *** 96,101 **** "Writes usage on sys.stderr" _usage=""" ! %s [options] model.xml [directory] ! Generates python code from a model Parameter: --- 95,100 ---- "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: *************** *** 170,185 **** # 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, --- 169,183 ---- # 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.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** mdl_validate_model.py 24 Jun 2003 08:51:10 -0000 1.4 --- mdl_validate_model.py 7 Jul 2003 14:57:14 -0000 1.5 *************** *** 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,DEBUG --- 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.") |