modeling-cvs Mailing List for Object-Relational Bridge for python (Page 23)
Status: Abandoned
Brought to you by:
sbigaret
You can subscribe to this list here.
2003 |
Jan
|
Feb
|
Mar
(54) |
Apr
(29) |
May
(94) |
Jun
(47) |
Jul
(156) |
Aug
(132) |
Sep
(40) |
Oct
(6) |
Nov
(18) |
Dec
(24) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2004 |
Jan
(18) |
Feb
(59) |
Mar
(7) |
Apr
|
May
(8) |
Jun
(2) |
Jul
(12) |
Aug
(15) |
Sep
(12) |
Oct
(6) |
Nov
(25) |
Dec
(1) |
2005 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2006 |
Jan
|
Feb
(27) |
Mar
|
Apr
(16) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2009 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
Update of /cvsroot/modeling/ProjectModeling/Modeling/tests In directory sc8-pr-cvs1:/tmp/cvs-serv7471/ProjectModeling/Modeling/tests Modified Files: test_EditingContext_Global.py test_EditingContext_Global_Inheritance.py test_EditingContext_ParentChild.py test_Model.py Added Files: test_PyModel.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: test_EditingContext_Global.py =================================================================== RCS file: /cvsroot/modeling/ProjectModeling/Modeling/tests/test_EditingContext_Global.py,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** test_EditingContext_Global.py 4 Jul 2003 16:19:17 -0000 1.25 --- test_EditingContext_Global.py 7 Jul 2003 14:57:14 -0000 1.26 *************** *** 40,44 **** utils.fixpath() ! from Modeling import ModelSet from Modeling.EditingContext import EditingContext from Modeling.FetchSpecification import FetchSpecification --- 40,44 ---- utils.fixpath() ! from Modeling import ModelSet, Model from Modeling.EditingContext import EditingContext from Modeling.FetchSpecification import FetchSpecification *************** *** 1085,1089 **** author_books_model=ModelSet.defaultModelSet().modelNamed('AuthorBooks') # Initialization of model's caracs. ! ModelSet.updateModelWithCFG(author_books_model, database_cfg) # MySQL specifics: change TIMESTAMP to DATETIME --- 1085,1089 ---- author_books_model=ModelSet.defaultModelSet().modelNamed('AuthorBooks') # Initialization of model's caracs. ! Model.updateModelWithCFG(author_books_model, database_cfg) # MySQL specifics: change TIMESTAMP to DATETIME Index: test_EditingContext_Global_Inheritance.py =================================================================== RCS file: /cvsroot/modeling/ProjectModeling/Modeling/tests/test_EditingContext_Global_Inheritance.py,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** test_EditingContext_Global_Inheritance.py 12 Jun 2003 11:38:06 -0000 1.12 --- test_EditingContext_Global_Inheritance.py 7 Jul 2003 14:57:14 -0000 1.13 *************** *** 40,44 **** utils.fixpath() ! from Modeling import ModelSet from Modeling.EditingContext import EditingContext from Modeling.FetchSpecification import FetchSpecification --- 40,44 ---- utils.fixpath() ! from Modeling import ModelSet, Model from Modeling.EditingContext import EditingContext from Modeling.FetchSpecification import FetchSpecification *************** *** 435,439 **** # Initialization of model's caracs. model=ModelSet.defaultModelSet().modelNamed('StoreEmployees') ! ModelSet.updateModelWithCFG(model, database_cfg) if reinitDB_flag: reinitDB(); return --- 435,439 ---- # Initialization of model's caracs. model=ModelSet.defaultModelSet().modelNamed('StoreEmployees') ! Model.updateModelWithCFG(model, database_cfg) if reinitDB_flag: reinitDB(); return Index: test_EditingContext_ParentChild.py =================================================================== RCS file: /cvsroot/modeling/ProjectModeling/Modeling/tests/test_EditingContext_ParentChild.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** test_EditingContext_ParentChild.py 11 Jun 2003 11:10:20 -0000 1.8 --- test_EditingContext_ParentChild.py 7 Jul 2003 14:57:14 -0000 1.9 *************** *** 18,22 **** utils.fixpath() ! from Modeling import ModelSet from Modeling.EditingContext import EditingContext from Modeling.FetchSpecification import FetchSpecification --- 18,22 ---- utils.fixpath() ! from Modeling import ModelSet, Model from Modeling.EditingContext import EditingContext from Modeling.FetchSpecification import FetchSpecification *************** *** 534,539 **** store_employee_model=ModelSet.defaultModelSet().modelNamed('StoreEmployees') # Initialization of model's caracs. ! ModelSet.updateModelWithCFG(author_books_model, database_cfg) ! ModelSet.updateModelWithCFG(store_employee_model, database_cfg) # MySQL specifics: change TIMESTAMP to DATETIME --- 534,539 ---- store_employee_model=ModelSet.defaultModelSet().modelNamed('StoreEmployees') # Initialization of model's caracs. ! Model.updateModelWithCFG(author_books_model, database_cfg) ! Model.updateModelWithCFG(store_employee_model, database_cfg) # MySQL specifics: change TIMESTAMP to DATETIME Index: test_Model.py =================================================================== RCS file: /cvsroot/modeling/ProjectModeling/Modeling/tests/test_Model.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** test_Model.py 10 Feb 2003 11:32:38 -0000 1.3 --- test_Model.py 7 Jul 2003 14:57:14 -0000 1.4 *************** *** 31,36 **** from Modeling import Model class TestModel(unittest.TestCase): ! "Empty for now" def test_truc(self): "[Model] Tests that 1 is equal to 1" --- 31,70 ---- from Modeling import Model + class TestModuleFunctions(unittest.TestCase): + "Tests for module Model" + def checkStoreEmployee(self, model): + "Minimum checking of model StoreEmployees" + entities=('Store','Employee','Executive','SalesClerk','Mark','Address') + self.failIf(len(model.entities()) != len(entities)) + for e in entities: + self.failIf(e not in model.entitiesNames(), "%s not in model"%e) + + def test_01_loadModel(self): + "[module Model] loadModel" + from Modeling.ModelSet import defaultModelSet + self.assertRaises(ImportError, Model.loadModel, + 'testPackages/StoreEmployees/does_not_exists.py') + self.assertRaises(IOError, Model.loadModel, + 'testPackages/StoreEmployees/does_not_exists.xml') + self.assertRaises(ValueError, Model.loadModel, + 'testPackages/StoreEmployees/Mark.py') + # PyModel + model=Model.loadModel('testPackages/StoreEmployees/pymodel_StoreEmployees.py') + self.failUnless(model) + self.failIf(model in defaultModelSet().models()) + self.checkStoreEmployee(model) + # xml-model in .py + model=Model.loadModel('testPackages/StoreEmployees/model_StoreEmployees.py') + self.failUnless(model) + self.failIf(model in defaultModelSet().models()) + self.checkStoreEmployee(model) + # xml-model in .xml + model=Model.loadModel('testPackages/StoreEmployees/model_StoreEmployees.xml') + self.failUnless(model) + self.failIf(model in defaultModelSet().models()) + self.checkStoreEmployee(model) + class TestModel(unittest.TestCase): ! "Tests for class Model. Empty for now" def test_truc(self): "[Model] Tests that 1 is equal to 1" *************** *** 40,43 **** --- 74,78 ---- def test_suite(): suite = unittest.TestSuite() + suite.addTest(unittest.makeSuite(TestModuleFunctions, "test_")) suite.addTest(unittest.makeSuite(TestModel, "test_")) return suite |
Update of /cvsroot/modeling/ProjectModeling/Modeling In directory sc8-pr-cvs1:/tmp/cvs-serv7471/ProjectModeling/Modeling Modified Files: Attribute.py CHANGES ClassDescription.py Entity.py Model.py ModelSet.py Relationship.py Added Files: PyModel.py mems_lib.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: Attribute.py =================================================================== RCS file: /cvsroot/modeling/ProjectModeling/Modeling/Attribute.py,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** Attribute.py 31 May 2003 15:09:46 -0000 1.14 --- Attribute.py 7 Jul 2003 14:57:13 -0000 1.15 *************** *** 37,40 **** --- 37,41 ---- from XMLutils import * from Model import ModelError + from KeyValueCoding import KeyValueCoding import Validation from Modeling.utils import capitalizeFirstLetter *************** *** 85,89 **** from Persistent import Persistent ! class Attribute(Persistent, XMLCapability): "Describes an attribute" # + public/private _TBD --- 86,90 ---- from Persistent import Persistent ! class Attribute(Persistent, XMLCapability, KeyValueCoding): "Describes an attribute" # + public/private _TBD *************** *** 124,128 **** self._precision=0 self._scale=0 ! self._type = 'string' # see Modeling.Types for defaults self._width=0 if anEntity: --- 125,129 ---- self._precision=0 self._scale=0 ! self._type = types.StringType.__name__ self._width=0 if anEntity: *************** *** 496,502 **** --- 497,505 ---- if type(value)==types.LongType: if self.type()!=types.IntType.__name__: + #print 'int!=',self.type() _error.addErrorForKey(Validation.TYPE_MISMATCH, self.name()) elif type(value).__name__!=self.type(): _error.addErrorForKey(Validation.TYPE_MISMATCH, self.name()) + #print self.name(),': type(value).__name__: ',type(value).__name__, '!= self.type():',self.type() # String should not exceed width *************** *** 505,508 **** --- 508,512 ---- if len(value)>self.width(): _error.addErrorForKey(Validation.TYPE_MISMATCH, self.name()) + #print 'len(value): %s != self.width(): %s'%(len(value),self.width()) _error.finalize() *************** *** 677,678 **** --- 681,690 ---- raise 'Unimplemented' + ## + ## KeyValueCoding error handling + ## + def handleAssignementForUnboundKey(self, value, key): + if key=='doc': self.setComment(value) + else: + raise AttributeError, key + handleTakeStoredValueForUnboundKey=handleAssignementForUnboundKey Index: CHANGES =================================================================== RCS file: /cvsroot/modeling/ProjectModeling/Modeling/CHANGES,v retrieving revision 1.120 retrieving revision 1.121 diff -C2 -d -r1.120 -r1.121 *** CHANGES 4 Jul 2003 17:30:47 -0000 1.120 --- CHANGES 7 Jul 2003 14:57:13 -0000 1.121 *************** *** 8,11 **** --- 8,33 ---- -------------------------------------------------------- + + [Merged branch brch-0_9pre7-1-PyModel] + + * Fixed: adaptorModel() could raise instead of returning None when model's + adaptorName is not set + + * Model: added updateModelWithCFG(), loadModel(), searchModel() + ModelSet: DEPRECATED method: updateModelWithCFG() --moved in Model, will + be removed in v0.9.1 + + * Added Modeling.PyModel and Modeling.tests.test_PyModel + + * Added tests/testPackages/StoreEmployees/pymodel_StoreEmployees.py + and updated StoreEmployees/__init__.py: now loads the model from the + PyModel + + * Changed ClassDescription's delete rules: constants DELETE_CASCADE, + DELETE_DENY, DELETE_NULLIFY and DELETE_NOACTION are now strings (were: + integers) + --> Relationship.setDeleteRule() updated to accept old integer values + (backward compatibility) + 0.9-pre-9 (2003/07/04) ---------------------- *************** *** 16,20 **** KeyValueCoding.valuesForKeys(). ! Deprecated methods KeyValueCoding.setValueForKey(), setValueForKeyPath(), setStoredValueForKey() (will be removed in v0.9.1) --- 38,42 ---- KeyValueCoding.valuesForKeys(). ! DEPRECATED methods KeyValueCoding.setValueForKey(), setValueForKeyPath(), setStoredValueForKey() (will be removed in v0.9.1) Index: ClassDescription.py =================================================================== RCS file: /cvsroot/modeling/ProjectModeling/Modeling/ClassDescription.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** ClassDescription.py 10 Jan 2003 10:45:44 -0000 1.9 --- ClassDescription.py 7 Jul 2003 14:57:13 -0000 1.10 *************** *** 54,62 **** # Integer constants ! DELETE_NULLIFY=0 ! DELETE_DENY=1 ! DELETE_CASCADE=2 ! DELETE_NOACTION=3 # careful here... # Notification ClassDescriptionNeededForEntityNameNotification='ClassDescriptionNeededForEntityName' --- 54,68 ---- # Integer constants ! DELETE_NULLIFY='nullify' ! DELETE_DENY='deny' ! DELETE_CASCADE='cascade' ! DELETE_NOACTION='noaction' # careful here... + # For backward compatibility, used in Relationship.setDeleteRule() + old_delete_rules= { 0: DELETE_NULLIFY, + 1: DELETE_DENY, + 2: DELETE_CASCADE, + 3: DELETE_NOACTION, + } # Notification ClassDescriptionNeededForEntityNameNotification='ClassDescriptionNeededForEntityName' Index: Entity.py =================================================================== RCS file: /cvsroot/modeling/ProjectModeling/Modeling/Entity.py,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** Entity.py 10 Jun 2003 16:31:32 -0000 1.13 --- Entity.py 7 Jul 2003 14:57:13 -0000 1.14 *************** *** 33,36 **** --- 33,37 ---- from XMLutils import * from EntityClassDescription import EntityClassDescription + from KeyValueCoding import KeyValueCoding from Model import ModelError from Attribute import Attribute *************** *** 115,119 **** from Persistent import Persistent ! class Entity(XMLCapability, Persistent): """ Describes an entity --- 116,120 ---- from Persistent import Persistent ! class Entity(XMLCapability, Persistent, KeyValueCoding): """ Describes an entity *************** *** 1414,1419 **** ## ! ## Validation of an Entity ! ## - ## --- 1415,1429 ---- ## ! ## KeyValueCoding error handling ! ## ! def handleAssignementForUnboundKey(self, value, key): ! if key=='doc': self.setComment(value) ! else: ! raise AttributeError, key ! handleTakeStoredValueForUnboundKey=handleAssignementForUnboundKey ! ! ## ! ## TBD Validation of an Entity ! ## ## Index: Model.py =================================================================== RCS file: /cvsroot/modeling/ProjectModeling/Modeling/Model.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Model.py 27 May 2003 19:37:28 -0000 1.5 --- Model.py 7 Jul 2003 14:57:13 -0000 1.6 *************** *** 40,44 **** from utils import isaValidName from XMLutils import * ! import types --- 40,44 ---- from utils import isaValidName from XMLutils import * ! from KeyValueCoding import KeyValueCoding import types *************** *** 49,53 **** from Persistent import Persistent ! class Model(Persistent, XMLCapability): "Describes a model" _is_a_model = 1 --- 49,248 ---- from Persistent import Persistent ! def updateModelWithCFG(model, cfg_path=None): ! """ ! Updates the model's connection dictionary and adaptorName with the values ! in file 'cfg_path'. If cfg_path is omitted or None, the value stored ! in the environment variable MDL_DB_CONNECTIONS_CFG is used instead. ! ! A sample configuration file is like:: ! ! [DEFAULT] ! host: localhost ! ! [ModelName_1] ! user: user_1 ! password: pwd_1 ! ! [ModelName_2] ! adaptor: MySQL ! user: user_2 ! password: pwd_2 ! ! The special field 'adaptor', if present, changes the adaptorName of the ! model. ! ! Raises IOError if file 'cfg_path' cannot be found. ! ! See also: ModelSet.addModel() ! ! Parameters: ! ! model -- the model whose conn.dict. should be updated ! ! cfg_path -- the full path to the configuration file, or if omitted or ! None, defaults to the value stored in the env. variable ! MDL_DB_CONNECTIONS_CFG ! ! """ ! import os ! if cfg_path is None: ! cfg_path=os.environ.get('MDL_DB_CONNECTIONS_CFG') ! if cfg_path is None: ! return ! ! from ConfigParser import ConfigParser ! defaults=model.connectionDictionary() ! cp=ConfigParser() ! try: ! cp.readfp(open(cfg_path)) ! except IOError: ! import traceback, cStringIO, sys ! exc_raised=sys.exc_info()[:2] ! err_msg="Unable to open file '%s' (passed in parameter 'cfg_path' or taken from env. variable MDL_DB_CONNECTIONS_CFG"%cfg_path ! exc=cStringIO.StringIO() ! traceback.print_exception(exc_raised[0], exc_raised[1], None, file=exc) ! err_msg+="\nOriginal exception was: %s"%exc.getvalue() ! raise IOError, err_msg ! ! try: options=cp.options(model.name()) ! except: return ! try: options.remove('adaptor') ! except ValueError: pass ! for key in options: ! defaults[key]=cp.get(model.name(), key) ! model.setConnectionDictionary(defaults) ! try: ! model.setAdaptorName(cp.get(model.name(), 'adaptor')) ! except: ! pass ! ! def loadModel(path): ! """ ! Load a model stored in the file 'path'. The lookup procedure is: ! ! - if path ends with '.py', we assume it is a python module. This module is ! imported and the following attributes are searched within it, in that ! order: ! ! 1. 'model' (either an attribute or a function): if found, we assume ! this is an instance of Modeling.Model.Model and we return the value ! ! 2. 'pymodel' (id.): if found, we assume this is an instance of ! Modeling.PyModel.Model and we return its 'component' attribute ! ! 3. 'model_src' (id.): if found, we assume this is a string and return ! the model build from it with ModelSet.addModelFromXML() ! ! - if path ends with '.xml', we assume this is a xml-file and we return the ! model build with ModelSet.addModelFromXML() ! ! Returns: the loaded Modeling.Model.Model instance ! ! Raises ValueError if file 'path' cannot be handled, or IOError or ! ImportError if the files does no exists, has errors, etc. ! ! Parameter: ! ! path -- the path of the file where the model is stored ! ! """ ! if path[-3:]=='.py': ! import os,imp ! dir,filename=os.path.dirname(path),os.path.basename(path) ! modulename=filename[:-3] ! file=None ! try: ! try: ! file,pathname,description=imp.find_module(modulename, [dir]) ! module=imp.load_module(modulename,file,pathname,description) ! ! if hasattr(module, 'model'): ! model=module.model ! from mems_lib import isinstance ! if callable(model) and not isinstance(model, Model): ! # Model.Model derives from ZODB.Persistent, hence it is callable ! # but it shouldn't be called! ! model=model() ! import PyModel ! if isinstance(model, PyModel.Model): ! model=model.component ! updateModelWithCFG(model) ! return model ! ! if hasattr(module, 'pymodel'): ! pymodel=module.pymodel ! if callable(pymodel): ! pymodel=pymodel() ! updateModelWithCFG(pymodel.component) ! return pymodel.component ! ! if hasattr(module, 'model_src'): ! model_src=module.model_src ! if callable(model_src): ! model_src=model_src() ! from ModelSet import ModelSet ! model=ModelSet().addModelFromXML({'string': model_src}) ! updateModelWithCFG(model) ! return model ! ! raise ValueError, "Couldn't find any of these attributes in python file '%s': model, pymodel (PyModel) or model_src (xml)"%path ! ! except ImportError: ! raise ! except: ! import cStringIO, traceback ! exc=cStringIO.StringIO() ! traceback.print_exc(file=exc) ! raise ValueError, 'Unable to handle python file %s\nReason: exception raised:\n%s'%(path,exc.getvalue()) ! ! finally: ! if file: file.close() ! elif path[-4:]=='.xml': ! from ModelSet import ModelSet ! return ModelSet().addModelFromXML({'file': path}) ! ! else: ! raise ValueError, 'Unable to handle file %s: unrecognized format (filename should end with either with .py or .xml)'%path ! ! def searchModel(modelName, path=None, verbose=0): ! """ ! Searches for the model named 'modelName' by trying loadModel() with the ! following paths: 'pymodel_<modelName>.py', 'model_<modelName>.py' and ! 'model_<modelName>.xml' in the current directory and the MDL/ directory. ! ! Returns the model, or None if it cannot be found/loaded ! ! """ ! if verbose: ! import sys ! mylog=lambda msg, stderr=sys.stderr:stderr.write('[Model.searchModel] %s\n'%msg) ! else: ! mylog=lambda msg: None ! ! searchList=('pymodel_%s.py', 'model_%s.py', 'model_%s.xml', ! 'MDL/pymodel_%s.py', 'MDL/model_%s.py', 'MDL/model_%s.xml') ! for file in searchList: ! model=None ! file=file%modelName ! if path: ! import os ! file=os.path.join(path, file) ! try: ! mylog('Trying %s'%file) ! model=loadModel(file) ! except (IOError, ValueError): ! import cStringIO, traceback ! exc=cStringIO.StringIO() ! traceback.print_exc(file=exc) ! mylog('Not found: %s\n Exception:%s'%(file,exc.getvalue())) ! del exc ! pass ! if model: ! return model ! mylog('Not found: %s'%file) ! mylog('modelName %s: All possibilities exhausted -- returning None'%modelName) ! return None ! ! class Model(Persistent, XMLCapability, KeyValueCoding): "Describes a model" _is_a_model = 1 *************** *** 329,332 **** --- 524,537 ---- } + ## + ## KeyValueCoding error handling + ## + def handleAssignementForUnboundKey(self, value, key): + if key=='connDict': self.setConnectionDictionary(value) + elif key=='doc': self.setComment(value) + else: + raise AttributeError, key + handleTakeStoredValueForUnboundKey=handleAssignementForUnboundKey + # Validation # Index: ModelSet.py =================================================================== RCS file: /cvsroot/modeling/ProjectModeling/Modeling/ModelSet.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** ModelSet.py 27 May 2003 19:37:28 -0000 1.8 --- ModelSet.py 7 Jul 2003 14:57:13 -0000 1.9 *************** *** 101,162 **** def updateModelWithCFG(model, cfg_path): """ ! Updates the model's connection dictionary and adaptorName with the values ! in file 'cfg_path'. ! ! A sample configuration file is like:: ! ! [DEFAULT] ! host: localhost ! ! [ModelName_1] ! user: user_1 ! password: pwd_1 ! ! [ModelName_2] ! adaptor: MySQL ! user: user_2 ! password: pwd_2 ! ! The special field 'adaptor', if present, changes the adaptorName of the ! model. ! ! Raises IOError if file 'cfg_path' cannot be found. ! ! See also: ModelSet.addModel() ! ! Parameters: ! ! model -- the model whose conn.dict. should be updated ! ! cfg_path -- the full path to the configuration file ! """ ! from ConfigParser import ConfigParser ! import os ! defaults=model.connectionDictionary() ! cp=ConfigParser() ! try: ! cp.readfp(open(cfg_path)) ! except IOError: ! import traceback, cStringIO, sys ! exc_raised=sys.exc_info()[:2] ! err_msg="Unable to open file '%s' pointed by env. variable MDL_DB_CONNECTIONS_CFG"%cfg_path ! exc=cStringIO.StringIO() ! traceback.print_exception(exc_raised[0], exc_raised[1], None, file=exc) ! err_msg+="\nOriginal exception was: %s"%exc.getvalue() ! raise IOError, err_msg - try: options=cp.options(model.name()) - except: return - try: options.remove('adaptor') - except ValueError: pass - for key in options: - defaults[key]=cp.get(model.name(), key) - model.setConnectionDictionary(defaults) - try: - model.setAdaptorName(cp.get(model.name(), 'adaptor')) - except: - pass - class ModelSet(Persistent): """Holds a set of Modeling.Models that can co-exist at runtime --- 101,113 ---- def updateModelWithCFG(model, cfg_path): """ ! Deprecated: use Model.updateModelWithCFG instead. This method will be ! removed in v0.9.1 """ ! from utils import deprecated ! deprecated('ModelSet.updateModelWithCFG','Model.updateModelWithCFG()', ! '0.9.1') ! from Modeling import Model ! return Model.updateModelWithCFG(model, cfg_path) class ModelSet(Persistent): """Holds a set of Modeling.Models that can co-exist at runtime *************** *** 185,189 **** If the environment variable 'MDL_DB_CONNECTIONS_CFG' is set, the file it points to is used to update aModel's connection dictionary (and ! possibly its adaptorName as well). See updateModelWithCFG() for details. """ #assert --- 136,141 ---- If the environment variable 'MDL_DB_CONNECTIONS_CFG' is set, the file it points to is used to update aModel's connection dictionary (and ! possibly its adaptorName as well). See Model.updateModelWithCFG() for ! details. """ #assert *************** *** 205,210 **** cfg_path=os.environ.get('MDL_DB_CONNECTIONS_CFG') if cfg_path: updateModelWithCFG(aModel, cfg_path) ! # XML Import/Export facilities def addModelFromXML(self, xmlSource): --- 157,163 ---- cfg_path=os.environ.get('MDL_DB_CONNECTIONS_CFG') if cfg_path: + from Model import updateModelWithCFG updateModelWithCFG(aModel, cfg_path) ! # XML Import/Export facilities def addModelFromXML(self, xmlSource): Index: Relationship.py =================================================================== RCS file: /cvsroot/modeling/ProjectModeling/Modeling/Relationship.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** Relationship.py 27 May 2003 19:37:28 -0000 1.9 --- Relationship.py 7 Jul 2003 14:57:13 -0000 1.10 *************** *** 32,35 **** --- 32,36 ---- from Join import Join from utils import isaValidName, toBoolean + from KeyValueCoding import KeyValueCoding from XMLutils import * import Validation *************** *** 49,53 **** # Relationships props ! from EntityClassDescription import DELETE_NULLIFY, DELETE_DENY, DELETE_CASCADE from utils import isListOrTuple --- 50,54 ---- # Relationships props ! from ClassDescription import DELETE_NULLIFY, DELETE_DENY, DELETE_CASCADE, DELETE_NOACTION, old_delete_rules from utils import isListOrTuple *************** *** 64,70 **** ! class Relationship(Persistent, XMLCapability): "See interfaces.Relationship for detail" - # _isClassProperty=1 --- 65,70 ---- ! class Relationship(Persistent, XMLCapability, KeyValueCoding): "See interfaces.Relationship for detail" # _isClassProperty=1 *************** *** 161,170 **** DELETE_NULLIFY, DELETE_CASCADE and DELETE_DENY """ if rule not in (DELETE_NULLIFY, DELETE_CASCADE, DELETE_DENY): raise ValueError, \ ! ("Parameter 'rule' should be one of DELETE_NULLIFY (%i), "+\ ! "DELETE_CASCADE (%i) or DELETE_DENY (%i)") \ ! % (DELETE_NULLIFY, DELETE_CASCADE, DELETE_DENY) ! rule=int(rule) self._deleteRule=rule --- 161,173 ---- DELETE_NULLIFY, DELETE_CASCADE and DELETE_DENY """ + #backward compatibility + if type(rule) in (type(0), type(0L), type(0.0)) or\ + rule in ('0', '1', '2', '3'): + rule=old_delete_rules.get(int(rule), rule) if rule not in (DELETE_NULLIFY, DELETE_CASCADE, DELETE_DENY): raise ValueError, \ ! ("Parameter 'rule' (%s) should be one of DELETE_NULLIFY (%s), "+\ ! "DELETE_CASCADE (%s) or DELETE_DENY (%s)") \ ! % (rule, DELETE_NULLIFY, DELETE_CASCADE, DELETE_DENY) self._deleteRule=rule *************** *** 205,213 **** upperBound -- must be a strictly positive integer, or -1 for a non ! constrained to-many relationship. Special value '*' is ! equivalent to -1. """ ! if upperBound=='*': upperBound=-1 assert(int(upperBound)>0 or int(upperBound)==-1) self._multUpper=int(upperBound) --- 208,216 ---- upperBound -- must be a strictly positive integer, or -1 for a non ! constrained to-many relationship. Special values '*' ! and None are equivalent to -1. """ ! if upperBound in ('*', None): upperBound=-1 assert(int(upperBound)>0 or int(upperBound)==-1) self._multUpper=int(upperBound) *************** *** 295,299 **** lambda self=None,p=None: None, self.name), ! 'deleteRule' : ('number', self.setDeleteRule, self.deleteRule), --- 298,302 ---- lambda self=None,p=None: None, self.name), ! 'deleteRule' : ('string', self.setDeleteRule, self.deleteRule), *************** *** 801,804 **** --- 804,818 ---- return d + ## + ## KeyValueCoding error handling + ## + def handleAssignementForUnboundKey(self, value, key): + if key=='doc': self.setComment(value) + elif key=='delete': + self.setDeleteRule(value) + else: + raise AttributeError, key + handleTakeStoredValueForUnboundKey=handleAssignementForUnboundKey + class FlattenedRelationship(Relationship): *************** *** 1161,1165 **** return d - # Validation # --- 1175,1178 ---- |
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.") |
From: <sbi...@us...> - 2003-07-07 14:57:17
|
Update of /cvsroot/modeling/ProjectModeling/Modeling/ModelMasons/Python_bricks In directory sc8-pr-cvs1:/tmp/cvs-serv7471/ProjectModeling/Modeling/ModelMasons/Python_bricks Modified Files: init.tmpl 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: init.tmpl =================================================================== RCS file: /cvsroot/modeling/ProjectModeling/Modeling/ModelMasons/Python_bricks/init.tmpl,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** init.tmpl 26 May 2003 15:44:48 -0000 1.6 --- init.tmpl 7 Jul 2003 14:57:14 -0000 1.7 *************** *** 1,71 **** ## This template will build the __init__.py file - #import time - # Generated by mdl_generate_python_code.py / time.strftime("%Y/%m/%d %H:%M") #set $model_name = str($model().name()) # Load the model ! #--------------------------------------- ! def loadModel(): ! """Load model from either the pickled model created by mdl_compile_model.py ! or from the string stored in model_$(model_name).model_src ! The module containing the pickled model is usually generated with the ! script mdl_compile_model.py ! Simply returns if a model named "$model_name" has already been loaded ! """ ! from Modeling import ModelSet ! import os, warnings, cStringIO, traceback ! if ModelSet.defaultModelSet().modelNamed("$(model_name)") is not None: ! return ! try: ! #if $base_dir: ! from $(base_dir).model_$(model_name)_pickle import model_pickle ! #else ! from model_$(model_name)_pickle import model_pickle ! #end if ! import cPickle ! m=cPickle.loads(model_pickle) ! ModelSet.defaultModelSet().addModel(m) ! model=ModelSet.defaultModelSet().modelNamed("$(model_name)") ! except: ! exc=cStringIO.StringIO() ! traceback.print_exc(file=exc) ! warnings.warn("Couldn't load model from pickle'\n"\ ! "Reason:\n%s"%exc.getvalue()) ! del exc else: ! return ! ! try: ! #if $base_dir: ! from $(base_dir).model_$(model_name) import model_src ! #else ! from model_$(model_name) import model_src ! #end if ! ModelSet.defaultModelSet().addModelFromXML({'string': model_src}) ! model=ModelSet.defaultModelSet().modelNamed("$(model_name)") ! except: ! exc=cStringIO.StringIO() ! traceback.print_exc(file=exc) ! warnings.warn("Couldn't load model 'model_$(model_name).xml'\nReason:\n%s"%exc.getvalue()) ! del exc ! ! # Or, alternatively: use the xml file (ok for dev. mode, not for install w/ ! # distutils) ! # ! # try: ! # from os import getcwd, path ! # mydir = os.path.abspath(os.path.dirname(__file__)) ! # xmlmodelPath=path.join(mydir,'model_$(model_name).xml') ! # ModelSet.defaultModelSet().addModelFromXML({'file': xmlmodelPath}) ! # model=ModelSet.defaultModelSet().modelNamed('$(model_name)') ! # except: ! # exc=cStringIO.StringIO() ! # traceback.print_exc(file=exc) ! # warnings.warn("Couldn't load model 'model_$(model_name).xml'\nReason:\n%s"%exc.getvalue()) ! # del exc ! # ! # del os, warnings, StringIO, traceback ! #--------------------------------------- ! loadModel() --- 1,16 ---- ## This template will build the __init__.py file #set $model_name = str($model().name()) # Load the model ! from Modeling import ModelSet, Model ! if ModelSet.defaultModelSet().modelNamed("$(model_name)") is None: ! import os ! mydir = os.path.abspath(os.path.dirname(__file__)) ! model=Model.searchModel('$(model_name)', mydir, verbose=0) ! if not model: ! import warnings ! warnings.warn("Couldn't load model '$(model_name)'") else: ! ModelSet.defaultModelSet().addModel(model) |
From: <sbi...@us...> - 2003-07-07 14:27:28
|
Update of /cvsroot/modeling/ProjectModeling/Modeling/tests In directory sc8-pr-cvs1:/tmp/cvs-serv1981/tests Modified Files: test_EditingContext.py Log Message: Fixed: both models AuthorBoks and StoreEmployees needs to have their adaptor's name defined Index: test_EditingContext.py =================================================================== RCS file: /cvsroot/modeling/ProjectModeling/Modeling/tests/test_EditingContext.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** test_EditingContext.py 26 May 2003 15:40:27 -0000 1.5 --- test_EditingContext.py 7 Jul 2003 14:27:25 -0000 1.6 *************** *** 38,42 **** utils.fixpath() ! from Modeling import ModelSet from Modeling.EditingContext import EditingContext from Modeling.FetchSpecification import FetchSpecification --- 38,42 ---- utils.fixpath() ! from Modeling import ModelSet, Model from Modeling.EditingContext import EditingContext from Modeling.FetchSpecification import FetchSpecification *************** *** 47,52 **** ms=ModelSet.defaultModelSet() ! ModelSet.updateModelWithCFG(ms.modelNamed('AuthorBooks'), 'Postgresql.cfg') ! ModelSet.updateModelWithCFG(ms.modelNamed('StoreEmployees'), 'Postgresql.cfg') del ms --- 47,52 ---- ms=ModelSet.defaultModelSet() ! Model.updateModelWithCFG(ms.modelNamed('AuthorBooks'), 'Postgresql.cfg') ! Model.updateModelWithCFG(ms.modelNamed('StoreEmployees'), 'Postgresql.cfg') del ms |
From: <sbi...@us...> - 2003-07-07 14:24:23
|
Update of /cvsroot/modeling/ProjectModeling/Modeling In directory sc8-pr-cvs1:/tmp/cvs-serv1606 Modified Files: utils.py Log Message: Fixed stupid bug: not including the parameters in msg... Also now points to the calling method Index: utils.py =================================================================== RCS file: /cvsroot/modeling/ProjectModeling/Modeling/utils.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** utils.py 3 Jul 2003 23:03:38 -0000 1.11 --- utils.py 7 Jul 2003 14:24:20 -0000 1.12 *************** *** 171,179 **** def deprecated(methodName, replacement=None,removed_in_version=None): ! msg="Method %s is deprecated." if replacement: ! msg+=" Please use %s instead." if removed_in_version: msg+="\nThis method will be removed for version %s"%removed_in_version import warnings ! warnings.warn(msg, DeprecationWarning, 2) --- 171,179 ---- def deprecated(methodName, replacement=None,removed_in_version=None): ! msg="Method %s is deprecated."%methodName if replacement: ! msg+=" Please use %s instead."%replacement if removed_in_version: msg+="\nThis method will be removed for version %s"%removed_in_version import warnings ! warnings.warn(msg, DeprecationWarning, 3) |
From: <sbi...@us...> - 2003-07-07 12:05:26
|
Update of /cvsroot/modeling/ProjectModeling/Modeling In directory sc8-pr-cvs1:/tmp/cvs-serv13231 Modified Files: Tag: brch-0_9pre7-1-PyModel ModelSet.py Log Message: misc. fix Index: ModelSet.py =================================================================== RCS file: /cvsroot/modeling/ProjectModeling/Modeling/ModelSet.py,v retrieving revision 1.7.2.1 retrieving revision 1.7.2.2 diff -C2 -d -r1.7.2.1 -r1.7.2.2 *** ModelSet.py 17 Jun 2003 16:57:43 -0000 1.7.2.1 --- ModelSet.py 7 Jul 2003 12:05:23 -0000 1.7.2.2 *************** *** 105,108 **** --- 105,109 ---- import warnings warnings.warn("ModelSet.updateModelWithCFG() is deprecated: use Model.updateModelWithCFG() instead. This method will be removed in v0.9.1", DeprecationWarning) + from Modeling import Model return Model.updateModelWithCFG(model, cfg_path) |
From: <sbi...@us...> - 2003-07-07 12:04:53
|
Update of /cvsroot/modeling/ProjectModeling/Modeling In directory sc8-pr-cvs1:/tmp/cvs-serv13130 Added Files: Tag: brch-0_9pre7-1-PyModel mems_lib.py Log Message: Added --- NEW FILE: mems_lib.py --- ## ## The following code is taken from the ZODB Programmer's Guide ## from types import ClassType,TypeType import __builtin__ # The built-in 'isinstance()' and 'issubclass()' won't work on # ExtensionClasses, so you have to use the versions supplied here. # (But those versions work fine on regular instances and classes too, # so you should *always* use them.) def issubclass (class1, class2): """A version of 'issubclass' that works with extension classes as well as regular Python classes. """ # Both class objects are regular Python classes, so use the # built-in 'issubclass()'. if type(class1) is ClassType and type(class2) is ClassType: return __builtin__.issubclass(class1, class2) # Both so-called class objects have a '__bases__' attribute: ie., # they aren't regular Python classes, but they sure look like them. # Assume they are extension classes and reimplement what the builtin # 'issubclass()' does behind the scenes. elif hasattr(class1, '__bases__') and hasattr(class2, '__bases__'): # XXX it appears that "ec.__class__ is type(ec)" for an # extension class 'ec': could we/should we use this as an # additional check for extension classes? # Breadth-first traversal of class1's superclass tree. Order # doesn't matter because we're just looking for a "yes/no" # answer from the tree; if we were trying to resolve a name, # order would be important! stack = [class1] while stack: if stack[0] is class2: return 1 stack.extend(list(stack[0].__bases__)) del stack[0] else: return 0 # Not a regular class, not an extension class: blow up for consistency # with builtin 'issubclass()" else: raise TypeError, "arguments must be class or ExtensionClass objects" # issubclass () def isinstance (object, klass): """A version of 'isinstance' that works with extension classes as well as regular Python classes.""" if type(klass) is TypeType: return __builtin__.isinstance(object, klass) elif hasattr(object, '__class__'): return issubclass(object.__class__, klass) else: return 0 |
From: <sbi...@us...> - 2003-07-07 11:50:12
|
Update of /cvsroot/modeling/ProjectModeling/Modeling In directory sc8-pr-cvs1:/tmp/cvs-serv11080 Modified Files: Tag: brch-0_9pre7-1-PyModel CHANGES Log Message: Adapted init.tmpl to use the new Model.searchModel() Index: CHANGES =================================================================== RCS file: /cvsroot/modeling/ProjectModeling/Modeling/CHANGES,v retrieving revision 1.102.2.3 retrieving revision 1.102.2.4 diff -C2 -d -r1.102.2.3 -r1.102.2.4 *** CHANGES 28 Jun 2003 15:34:36 -0000 1.102.2.3 --- CHANGES 7 Jul 2003 11:50:06 -0000 1.102.2.4 *************** *** 10,13 **** --- 10,15 ---- Branch brch-0_9pre7-1-PyModel ----------------------------- + + * adapted scripts mdl_* * Fixed: adaptorModel() could raise instead of returning None when model's |
From: <sbi...@us...> - 2003-07-07 11:50:11
|
Update of /cvsroot/modeling/ProjectModeling/Modeling/ModelMasons/Python_bricks In directory sc8-pr-cvs1:/tmp/cvs-serv11080/ModelMasons/Python_bricks Modified Files: Tag: brch-0_9pre7-1-PyModel init.tmpl Log Message: Adapted init.tmpl to use the new Model.searchModel() Index: init.tmpl =================================================================== RCS file: /cvsroot/modeling/ProjectModeling/Modeling/ModelMasons/Python_bricks/init.tmpl,v retrieving revision 1.5 retrieving revision 1.5.2.1 diff -C2 -d -r1.5 -r1.5.2.1 *** init.tmpl 25 Apr 2003 18:39:13 -0000 1.5 --- init.tmpl 7 Jul 2003 11:50:06 -0000 1.5.2.1 *************** *** 3,61 **** # Load the model ! #--------------------------------------- ! def loadModel(): ! """Load model from either the pickled model created by mdl_compile_model.py ! or from the string stored in model_$(model_name).model_src ! The module containing the pickled model is usually generated with the ! script mdl_compile_model.py ! Simply returns if a model named "$model_name" has already been loaded ! """ ! from Modeling import ModelSet ! import os, warnings, cStringIO, traceback ! if ModelSet.defaultModelSet().modelNamed("$(model_name)") is not None: ! return ! try: ! from model_$(model_name)_pickle import model_pickle ! import cPickle ! m=cPickle.loads(model_pickle) ! ModelSet.defaultModelSet().addModel(m) ! model=ModelSet.defaultModelSet().modelNamed("$(model_name)") ! except: ! exc=cStringIO.StringIO() ! traceback.print_exc(file=exc) ! warnings.warn("Couldn't load model from pickle'\n"\ ! "Reason:\n%s"%exc.getvalue()) ! del exc else: ! return ! ! try: ! from model_$(model_name) import model_src ! ModelSet.defaultModelSet().addModelFromXML({'string': model_src}) ! model=ModelSet.defaultModelSet().modelNamed("$(model_name)") ! except: ! exc=cStringIO.StringIO() ! traceback.print_exc(file=exc) ! warnings.warn("Couldn't load model 'model_$(model_name).xml'\nReason:\n%s"%exc.getvalue()) ! del exc ! ! # Or, alternatively: use the xml file (ok for dev. mode, not for install w/ ! # distutils) ! # ! # try: ! # from os import getcwd, path ! # mydir = os.path.abspath(os.path.dirname(__file__)) ! # xmlmodelPath=path.join(mydir,'model_$(model_name).xml') ! # ModelSet.defaultModelSet().addModelFromXML({'file': xmlmodelPath}) ! # model=ModelSet.defaultModelSet().modelNamed('$(model_name)') ! # except: ! # exc=cStringIO.StringIO() ! # traceback.print_exc(file=exc) ! # warnings.warn("Couldn't load model 'model_$(model_name).xml'\nReason:\n%s"%exc.getvalue()) ! # del exc ! # ! # del os, warnings, StringIO, traceback ! #--------------------------------------- ! loadModel() --- 3,16 ---- # Load the model ! from Modeling import ModelSet, Model ! if ModelSet.defaultModelSet().modelNamed("$(model_name)") is None: ! import os ! mydir = os.path.abspath(os.path.dirname(__file__)) ! model=Model.searchModel('$(model_name)', mydir, verbose=0) ! if not model: ! import warnings ! warnings.warn("Couldn't load model '$(model_name)'") else: ! ModelSet.defaultModelSet().addModel(model) |
From: <sbi...@us...> - 2003-07-06 12:00:14
|
Update of /cvsroot/modeling/ProjectModeling/Modeling/doc/HomePage In directory sc8-pr-cvs1:/tmp/cvs-serv26783/ProjectModeling/Modeling/doc/HomePage Modified Files: contributors.tex Log Message: Changed on request by Mario Index: contributors.tex =================================================================== RCS file: /cvsroot/modeling/ProjectModeling/Modeling/doc/HomePage/contributors.tex,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** contributors.tex 4 Jul 2003 17:30:47 -0000 1.1 --- contributors.tex 6 Jul 2003 12:00:10 -0000 1.2 *************** *** 15,19 **** \item Yannick Gingras \item Ernesto Revilla ! \item Mario Ruggier (documentation reviewer) \end{itemize} --- 15,19 ---- \item Yannick Gingras \item Ernesto Revilla ! \item Mario Ruggier \end{itemize} |
From: <sbi...@us...> - 2003-07-04 18:23:00
|
Update of /cvsroot/modeling/ProjectModeling/Modeling/doc/HomePage In directory sc8-pr-cvs1:/tmp/cvs-serv5078/Modeling/doc/HomePage Modified Files: status.tex Log Message: Checked-in modifications on behalf of Mario :) Index: status.tex =================================================================== RCS file: /cvsroot/modeling/ProjectModeling/Modeling/doc/HomePage/status.tex,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** status.tex 4 Jul 2003 17:47:53 -0000 1.3 --- status.tex 4 Jul 2003 18:22:57 -0000 1.4 *************** *** 12,18 **** \item[Example of projects using the framework] ! Even if the framework is still in a beta stage (see below), it is already used ! in at least two applications that has been put in production since november ! 2002 (the only ones we are aware of): \begin{enumerate} --- 12,18 ---- \item[Example of projects using the framework] ! The framework is still considered to be in beta stage (see below), even if ! some applications have been in production for some time now, e.g. two ! applications by the author that have been in production since november 2002: \begin{enumerate} |
From: <sbi...@us...> - 2003-07-04 17:47:55
|
Update of /cvsroot/modeling/ProjectModeling/Modeling/doc/HomePage In directory sc8-pr-cvs1:/tmp/cvs-serv718/ProjectModeling/Modeling/doc/HomePage Modified Files: status.tex Log Message: misc. Index: status.tex =================================================================== RCS file: /cvsroot/modeling/ProjectModeling/Modeling/doc/HomePage/status.tex,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** status.tex 28 Jun 2003 15:48:29 -0000 1.2 --- status.tex 4 Jul 2003 17:47:53 -0000 1.3 *************** *** 13,17 **** Even if the framework is still in a beta stage (see below), it is already used ! in two applications that has been put in production since november 2002. \begin{enumerate} --- 13,18 ---- Even if the framework is still in a beta stage (see below), it is already used ! in at least two applications that has been put in production since november ! 2002 (the only ones we are aware of): \begin{enumerate} |
From: <sbi...@us...> - 2003-07-04 17:46:34
|
Update of /cvsroot/modeling/ProjectModeling/Modeling/doc/UserGuide In directory sc8-pr-cvs1:/tmp/cvs-serv561/ProjectModeling/Modeling/doc/UserGuide Modified Files: EnvironmentVariables.tex Log Message: Removed useless note --bug w/ psycopg is fixed Index: EnvironmentVariables.tex =================================================================== RCS file: /cvsroot/modeling/ProjectModeling/Modeling/doc/UserGuide/EnvironmentVariables.tex,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** EnvironmentVariables.tex 4 Jul 2003 17:01:38 -0000 1.8 --- EnvironmentVariables.tex 4 Jul 2003 17:46:31 -0000 1.9 *************** *** 52,63 **** When this environment variable is set to any true value, the same database connection is re-used for subsequent requests.\newline ! ~\newline ! {\bf Important:} If you are running the framework in a multi-threaded ! environment (in Zope e.g.) you are strongly advised {\bf against} setting this ! variable to true. Most python adaptors are not MT-safe ; even ! \module{psycopg}, which is designed to be MT-safe, has a bug that is sometimes ! triggered when the same cursor is used concurrently in two different ! threads. This has been reported to the psycopg mailing-list, see ! \url{http://lists.initd.org/pipermail/psycopg/2003-March/001885.html}. }{e.g. '1', 'YES' (plus the empty string for de-activation)} \end{longtableiii} --- 52,63 ---- When this environment variable is set to any true value, the same database connection is re-used for subsequent requests.\newline ! %~\newline ! %{\bf Important:} If you are running the framework in a multi-threaded ! %environment (in Zope e.g.) you are strongly advised {\bf against} setting this ! %variable to true. Most python adaptors are not MT-safe ; even ! %\module{psycopg}, which is designed to be MT-safe, has a bug that is sometimes ! %triggered when the same cursor is used concurrently in two different ! %threads. This has been reported to the psycopg mailing-list, see ! %\url{http://lists.initd.org/pipermail/psycopg/2003-March/001885.html}. }{e.g. '1', 'YES' (plus the empty string for de-activation)} \end{longtableiii} |
From: <sbi...@us...> - 2003-07-04 17:43:50
|
Update of /cvsroot/modeling/ProjectModeling/Modeling/doc/HomePage In directory sc8-pr-cvs1:/tmp/cvs-serv32678/ProjectModeling/Modeling/doc/HomePage Modified Files: main.tex Log Message: misc. date Index: main.tex =================================================================== RCS file: /cvsroot/modeling/ProjectModeling/Modeling/doc/HomePage/main.tex,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** main.tex 4 Jul 2003 17:29:29 -0000 1.17 --- main.tex 4 Jul 2003 17:43:47 -0000 1.18 *************** *** 13,17 **** \author{S\'ebastien Bigaret} \email{sbi...@us...} ! \date{May 26, 2003} %\date{\today} --- 13,17 ---- \author{S\'ebastien Bigaret} \email{sbi...@us...} ! \date{Jun 04, 2003} %\date{\today} |
From: <sbi...@us...> - 2003-07-04 17:41:54
|
Update of /cvsroot/modeling/ProjectModeling In directory sc8-pr-cvs1:/tmp/cvs-serv32460/ProjectModeling Modified Files: DEPENDENCIES Log Message: Updated DEPENDENCIES Index: DEPENDENCIES =================================================================== RCS file: /cvsroot/modeling/ProjectModeling/DEPENDENCIES,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** DEPENDENCIES 12 Jun 2003 10:13:21 -0000 1.10 --- DEPENDENCIES 4 Jul 2003 17:41:51 -0000 1.11 *************** *** 26,30 **** (postgresql servers v7.2 and 7.3 are supported) ! - psycopg v1.1.4 -- http://initd.org/software/psycopg - Or pgdb v3.3 (debian module python2.1-pygresql v7.2.1-2 ) --- 26,30 ---- (postgresql servers v7.2 and 7.3 are supported) ! - psycopg v1.1.5.1 -- http://initd.org/software/psycopg - Or pgdb v3.3 (debian module python2.1-pygresql v7.2.1-2 ) |
From: <sbi...@us...> - 2003-07-04 17:30:50
|
Update of /cvsroot/modeling/ProjectModeling/Modeling In directory sc8-pr-cvs1:/tmp/cvs-serv30875/ProjectModeling/Modeling Modified Files: CHANGES Log Message: Added page 'Contributors' Index: CHANGES =================================================================== RCS file: /cvsroot/modeling/ProjectModeling/Modeling/CHANGES,v retrieving revision 1.119 retrieving revision 1.120 diff -C2 -d -r1.119 -r1.120 *** CHANGES 4 Jul 2003 17:29:29 -0000 1.119 --- CHANGES 4 Jul 2003 17:30:47 -0000 1.120 *************** *** 21,28 **** * Added SortOrdering.sortOrderingsWithString() ! * documentation: added Project's status page. Moved the section on ! KeyValueCoding and RelationshipManipulation to an 'advanced techniques' ! part. Added raw material about fetching and inheritance. Updated to ! reflect the API change. * Fixed: ModelValidation does not issue an error anymore when a model --- 21,28 ---- * Added SortOrdering.sortOrderingsWithString() ! * documentation: added Project's status page, and contributors. Moved the ! section on KeyValueCoding and RelationshipManipulation to an 'advanced ! techniques' part. Added raw material about fetching and ! inheritance. Updated to reflect the API change. * Fixed: ModelValidation does not issue an error anymore when a model |
From: <sbi...@us...> - 2003-07-04 17:30:50
|
Update of /cvsroot/modeling/ProjectModeling/Modeling/doc/www In directory sc8-pr-cvs1:/tmp/cvs-serv30875/ProjectModeling/Modeling/doc/www Modified Files: menu-inline-begin.tex Log Message: Added page 'Contributors' Index: menu-inline-begin.tex =================================================================== RCS file: /cvsroot/modeling/ProjectModeling/Modeling/doc/www/menu-inline-begin.tex,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** menu-inline-begin.tex 24 Jun 2003 17:07:13 -0000 1.5 --- menu-inline-begin.tex 4 Jul 2003 17:30:47 -0000 1.6 *************** *** 5,8 **** --- 5,9 ---- <a href="index.html">Home</a><br><br> <a href="status.html">Project's status</a><br> + <a href="contributors.html">Contributors</a><br> <br> |
From: <sbi...@us...> - 2003-07-04 17:30:50
|
Update of /cvsroot/modeling/ProjectModeling/Modeling/doc/HomePage In directory sc8-pr-cvs1:/tmp/cvs-serv30875/ProjectModeling/Modeling/doc/HomePage Added Files: contributors.tex Log Message: Added page 'Contributors' --- NEW FILE: contributors.tex --- \documentclass{article} \title{Contributors} %\author{S\'ebastien Bigaret} %\authoraddress{Email: \email{sbi...@us...}} \date{\today} \begin{document} \input{www/menu-inline-begin} \maketitle ~\newline We'd like to thank the following people who have contributed suggestions, patches and useful critics ;) \begin{itemize} \item Yannick Gingras \item Ernesto Revilla \item Mario Ruggier (documentation reviewer) \end{itemize} \newline Brave Early Testers: \begin{itemize} \item Ludovic Bellier \item Yves Cadour \item Jérôme Kerdreux, aka Soaf ``Oops I did it again'' -- {\em the} bughunter! \end{itemize} %% end (all in alphabetical order) \input{www/menu-inline-end} \end{document} |
From: <sbi...@us...> - 2003-07-04 17:29:32
|
Update of /cvsroot/modeling/ZModeling In directory sc8-pr-cvs1:/tmp/cvs-serv30625/ZModeling Modified Files: CHANGES Log Message: Release 0.9pre9 Index: CHANGES =================================================================== RCS file: /cvsroot/modeling/ZModeling/CHANGES,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** CHANGES 12 Jun 2003 00:28:24 -0000 1.19 --- CHANGES 4 Jul 2003 17:29:29 -0000 1.20 *************** *** 1,5 **** -*- text -*- ! Current release is: 0.9-pre-8 * ZModelizationTool: Added SQLite to the list of supported adaptors --- 1,8 ---- -*- text -*- ! Current release is: 0.9-pre-9 ! ! 0.9-pre-9 (2003/07/04) ! ---------------------- * ZModelizationTool: Added SQLite to the list of supported adaptors |
From: <sbi...@us...> - 2003-07-04 17:29:32
|
Update of /cvsroot/modeling/ProjectModeling/Modeling/doc/HomePage In directory sc8-pr-cvs1:/tmp/cvs-serv30625/ProjectModeling/Modeling/doc/HomePage Modified Files: downloads.tex main.tex Log Message: Release 0.9pre9 Index: downloads.tex =================================================================== RCS file: /cvsroot/modeling/ProjectModeling/Modeling/doc/HomePage/downloads.tex,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** downloads.tex 27 May 2003 20:05:02 -0000 1.9 --- downloads.tex 4 Jul 2003 17:29:29 -0000 1.10 *************** *** 10,14 **** \begin{enumerate} ! \item[\bf Current version: 0.9-pre-8] Download it here:\begin{rawhtml}<a --- 10,14 ---- \begin{enumerate} ! \item[\bf Current version: 0.9-pre-9] Download it here:\begin{rawhtml}<a Index: main.tex =================================================================== RCS file: /cvsroot/modeling/ProjectModeling/Modeling/doc/HomePage/main.tex,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** main.tex 11 Jun 2003 11:36:01 -0000 1.16 --- main.tex 4 Jul 2003 17:29:29 -0000 1.17 *************** *** 7,11 **** % Increment the release number whenever significant changes are made. % The author and/or editor can define 'significant' however they like. ! %\release{0.9-pre-8} % At minimum, give your name and an email address. You can include a --- 7,11 ---- % Increment the release number whenever significant changes are made. % The author and/or editor can define 'significant' however they like. ! %\release{0.9-pre-9} % At minimum, give your name and an email address. You can include a |
From: <sbi...@us...> - 2003-07-04 17:29:32
|
Update of /cvsroot/modeling/ProjectModeling/Modeling In directory sc8-pr-cvs1:/tmp/cvs-serv30625/ProjectModeling/Modeling Modified Files: CHANGES Log Message: Release 0.9pre9 Index: CHANGES =================================================================== RCS file: /cvsroot/modeling/ProjectModeling/Modeling/CHANGES,v retrieving revision 1.118 retrieving revision 1.119 diff -C2 -d -r1.118 -r1.119 *** CHANGES 4 Jul 2003 17:06:52 -0000 1.118 --- CHANGES 4 Jul 2003 17:29:29 -0000 1.119 *************** *** 3,13 **** Module Modeling --------------- ! Current release is: 0.9-pre-8 / See also: TODO, INSTALL and doc/ * ** Distributed under the GNU General Public License ** -------------------------------------------------------- * API change (see mailing-list archives): Added EditingContext.insert(), ! delete(), fetch(), fetchCOunt(), autoInsertion(), setAutoInsertion(). Added CustomObject.globalID(). Added KeyValueCoding.valuesForKeys(). --- 3,16 ---- Module Modeling --------------- ! Current release is: 0.9-pre-9 / See also: TODO, INSTALL and doc/ * ** Distributed under the GNU General Public License ** -------------------------------------------------------- + 0.9-pre-9 (2003/07/04) + ---------------------- + * API change (see mailing-list archives): Added EditingContext.insert(), ! delete(), fetch(), fetchCount(), autoInsertion(), setAutoInsertion(). Added CustomObject.globalID(). Added KeyValueCoding.valuesForKeys(). |
From: <sbi...@us...> - 2003-07-04 17:29:32
|
Update of /cvsroot/modeling/ProjectModeling/Modeling/doc In directory sc8-pr-cvs1:/tmp/cvs-serv30625/ProjectModeling/Modeling/doc Modified Files: Tutorial.tex UserGuide.tex Log Message: Release 0.9pre9 Index: Tutorial.tex =================================================================== RCS file: /cvsroot/modeling/ProjectModeling/Modeling/doc/Tutorial.tex,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Tutorial.tex 4 Jul 2003 17:06:52 -0000 1.4 --- Tutorial.tex 4 Jul 2003 17:29:29 -0000 1.5 *************** *** 14,18 **** \date{February 10, 2003} %\date{\today} ! \release{0.9-pre-8} %\setreleaseinfo{5} \setshortversion{0.9} --- 14,18 ---- \date{February 10, 2003} %\date{\today} ! \release{0.9-pre-9} %\setreleaseinfo{5} \setshortversion{0.9} Index: UserGuide.tex =================================================================== RCS file: /cvsroot/modeling/ProjectModeling/Modeling/doc/UserGuide.tex,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** UserGuide.tex 4 Jul 2003 17:06:52 -0000 1.22 --- UserGuide.tex 4 Jul 2003 17:29:29 -0000 1.23 *************** *** 12,18 **** % the rest is at your discretion. \authoraddress{Email: \email{sbi...@us...}} ! \date{May 27, 2003} %\date{\today} ! \release{0.9-pre-8} %\setreleaseinfo{pre-8} \setshortversion{0.9} --- 12,18 ---- % the rest is at your discretion. \authoraddress{Email: \email{sbi...@us...}} ! \date{Jun 04, 2003} %\date{\today} ! \release{0.9-pre-9} %\setreleaseinfo{pre-8} \setshortversion{0.9} |
From: <sbi...@us...> - 2003-07-04 17:29:32
|
Update of /cvsroot/modeling/ProjectModeling In directory sc8-pr-cvs1:/tmp/cvs-serv30625/ProjectModeling Modified Files: setup.py vertoo.data Log Message: Release 0.9pre9 Index: setup.py =================================================================== RCS file: /cvsroot/modeling/ProjectModeling/setup.py,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** setup.py 27 May 2003 20:05:03 -0000 1.25 --- setup.py 4 Jul 2003 17:29:29 -0000 1.26 *************** *** 46,50 **** setup(name="ModelingCore", ! version="0.9-pre-8", licence ="GNU General Public License", description=short_description, --- 46,50 ---- setup(name="ModelingCore", ! version="0.9-pre-9", licence ="GNU General Public License", description=short_description, Index: vertoo.data =================================================================== RCS file: /cvsroot/modeling/ProjectModeling/vertoo.data,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** vertoo.data 4 Jul 2003 17:07:45 -0000 1.1 --- vertoo.data 4 Jul 2003 17:29:29 -0000 1.2 *************** *** 1 **** ! Modeling = major:0; minor:9; pre:8; release:x; date:May 27, 2003; \ No newline at end of file --- 1 ---- ! Modeling = major:0; minor:9; pre:9; release:x; date:Jun 04, 2003; \ No newline at end of file |
From: <sbi...@us...> - 2003-07-04 17:07:48
|
Update of /cvsroot/modeling/ProjectModeling In directory sc8-pr-cvs1:/tmp/cvs-serv27600 Added Files: vertoo.config vertoo.data Log Message: Added --config. file for version control, cf. vertoo.sf.net --- NEW FILE: vertoo.config --- #versionFormatInfo = VersionFormatInfo(BasicVersionPart) registry.registerScheme('normal', '%major.%minor') registry.registerScheme('full', '%major.%minor%[pre?-pre-%pre:]%[release?.%release:]') #registry.registerScheme('pre', '%major.%minor%[pre?-pre-%pre:]') registry.registerScheme('short_pre', '%major.%minor') registry.registerScheme('date', '%date') #registry.registerScheme('full', '%major.%minor%[release?.%release:]') MDL = ModuleInfo('Modeling', [ FileInfo("setup.py", [ AnchorInfo('simple', 1, arguments(pattern="version=%Q", format='@full')), ]), FileInfo("Modeling/CHANGES", [ AnchorInfo('simple', 1, arguments(pattern="is: %v", format='@full')), ]), FileInfo([ "Modeling/doc/UserGuide.tex", "Modeling/doc/HomePage/main.tex", "Modeling/doc/Tutorial.tex" ], [ AnchorInfo('simple', 1, arguments(pattern=r"\release{%v}", format='@full')), AnchorInfo('simple', 1, arguments(pattern=r"\setshortversion{%v}", format='@short_pre')), AnchorInfo('simple', 1, arguments(pattern=r"\date{%v}", format='@date')), ]), FileInfo("Modeling/doc/HomePage/downloads.tex", [ AnchorInfo('simple', 1, arguments(pattern="Current version: %v", format='@full')), ]), # FileInfo("ReadMe.txt", [ # AnchorInfo('simple', 1, # arguments(pattern="Vertoo %v", format="@public")), # ]), # FileInfo("setup.py", [ # AnchorInfo('simple', 1, # arguments(pattern="version=%q", format="@public")), # ]), # FileInfo("setup.cfg", [ # AnchorInfo('simple', 1, # arguments(pattern="release = %v", # format="%[release?%release:1]")), # ]), # FileInfo("admin/release-source-tarball.sh", [ # AnchorInfo('simple', 1, # arguments(pattern="vertoo-%v", format="@public")), # ]), # FileInfo("Makefile", [ # AnchorInfo('simple', 1, # arguments(pattern="vertoo-%v", format="@public")), # ]), ]) modules = [MDL] # vim:set ft=python fdm=manual: --- NEW FILE: vertoo.data --- Modeling = major:0; minor:9; pre:8; release:x; date:May 27, 2003; |