You can subscribe to this list here.
| 2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(57) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2003 |
Jan
(44) |
Feb
(151) |
Mar
(131) |
Apr
(171) |
May
(125) |
Jun
(43) |
Jul
(26) |
Aug
(19) |
Sep
(10) |
Oct
|
Nov
(4) |
Dec
(28) |
| 2004 |
Jan
(134) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: <de...@us...> - 2004-01-07 01:11:01
|
Update of /cvsroot/pymerase/smw/smw/profiles In directory sc8-pr-cvs1:/tmp/cvs-serv25358/profiles Log Message: Directory /cvsroot/pymerase/smw/smw/profiles added to the repository |
|
From: <de...@us...> - 2004-01-07 01:11:01
|
Update of /cvsroot/pymerase/smw/smw/sart In directory sc8-pr-cvs1:/tmp/cvs-serv25358/sart Log Message: Directory /cvsroot/pymerase/smw/smw/sart added to the repository |
|
From: <de...@us...> - 2004-01-07 01:11:01
|
Update of /cvsroot/pymerase/smw/smw/repository In directory sc8-pr-cvs1:/tmp/cvs-serv25358/repository Log Message: Directory /cvsroot/pymerase/smw/smw/repository added to the repository |
|
From: <de...@us...> - 2004-01-07 01:11:00
|
Update of /cvsroot/pymerase/smw/smw/mathedit In directory sc8-pr-cvs1:/tmp/cvs-serv25358/mathedit Log Message: Directory /cvsroot/pymerase/smw/smw/mathedit added to the repository |
|
From: <de...@us...> - 2004-01-07 01:11:00
|
Update of /cvsroot/pymerase/smw/smw/examples In directory sc8-pr-cvs1:/tmp/cvs-serv25358/examples Log Message: Directory /cvsroot/pymerase/smw/smw/examples added to the repository |
|
From: <de...@us...> - 2004-01-07 01:11:00
|
Update of /cvsroot/pymerase/smw/smw/doc In directory sc8-pr-cvs1:/tmp/cvs-serv25358/doc Log Message: Directory /cvsroot/pymerase/smw/smw/doc added to the repository |
|
From: <de...@us...> - 2004-01-07 01:11:00
|
Update of /cvsroot/pymerase/smw/smw/diagraminterchange In directory sc8-pr-cvs1:/tmp/cvs-serv25358/diagraminterchange Log Message: Directory /cvsroot/pymerase/smw/smw/diagraminterchange added to the repository |
|
From: <de...@us...> - 2004-01-07 01:11:00
|
Update of /cvsroot/pymerase/smw/smw/chi In directory sc8-pr-cvs1:/tmp/cvs-serv25358/chi Log Message: Directory /cvsroot/pymerase/smw/smw/chi added to the repository |
|
From: <de...@us...> - 2004-01-07 01:09:17
|
Update of /cvsroot/pymerase/smw/smw In directory sc8-pr-cvs1:/tmp/cvs-serv25070/smw Log Message: Directory /cvsroot/pymerase/smw/smw added to the repository |
|
From: <de...@us...> - 2003-12-20 02:26:31
|
Update of /cvsroot/pymerase/pymerase/pymerase/input
In directory sc8-pr-cvs1:/tmp/cvs-serv28505
Modified Files:
parseXMI.py
Log Message:
Support extracting xmi files from .zargo or .zuml files
Index: parseXMI.py
===================================================================
RCS file: /cvsroot/pymerase/pymerase/pymerase/input/parseXMI.py,v
retrieving revision 1.27
retrieving revision 1.28
diff -C2 -d -r1.27 -r1.28
*** parseXMI.py 10 Sep 2003 02:08:21 -0000 1.27
--- parseXMI.py 20 Dec 2003 02:26:28 -0000 1.28
***************
*** 48,51 ****
--- 48,53 ----
import re
import string
+ import tempfile
+ import zipfile
from smw.metamodel import UML14
***************
*** 624,628 ****
base, ext = os.path.splitext(filename)
! model = loadModel(source)
#try:
#except AttributeError, e:
--- 626,652 ----
base, ext = os.path.splitext(filename)
! # try and extract zipfile
! if zipfile.is_zipfile(source):
! # probably a zargo/zuml file
! zarchive = zipfile.ZipFile(source, 'r')
! zmodel_name = None
! for zfile in zarchive.infolist():
! if re.match(".*\.xmi$", zfile.filename):
! # have we already seen an xmi file?
! if zmodel_name is not None:
! raise RuntimeError("Unrecognized file type, too many xmi files")
! else:
! zmodel_name = zfile.filename
! if zmodel_name is None:
! raise RuntimeError("zipfile contained no XMI file")
!
! # save the extracted file in a way that makes smw happy
! extracted_file = tempfile.NamedTemporaryFile(suffix=".xmi")
! extracted_file.write(zarchive.read(zmodel_name))
! extracted_file.flush()
! model = loadModel(extracted_file.name)
! extracted_file.close()
! else:
! model = loadModel(source)
#try:
#except AttributeError, e:
|
|
From: <ki...@us...> - 2003-12-18 22:09:19
|
Update of /cvsroot/pymerase/htdocs/about
In directory sc8-pr-cvs1:/tmp/cvs-serv22289
Modified Files:
index.shtml
Log Message:
Added Luis Rodrigo Gallargo Cruz to the list of contributors. =o)
Index: index.shtml
===================================================================
RCS file: /cvsroot/pymerase/htdocs/about/index.shtml,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** index.shtml 12 Mar 2003 06:26:54 -0000 1.7
--- index.shtml 18 Dec 2003 22:09:16 -0000 1.8
***************
*** 50,53 ****
--- 50,56 ----
Co-Developer and Code Monkey<br>
<br>
+ <u>Contributors - Thank You!</u><br>
+ Luis Rodrigo Gallardo Cruz - Fix for Bug 788408 unable to commit twice<br>
+ <br>
(Please e-mail <a href="http://sourceforge.net/mail/?group_id=63836">
pymerase-devel</a> at lists.sourceforge.net if you would like to
|
|
From: <de...@us...> - 2003-12-18 17:34:05
|
Update of /cvsroot/pymerase/pymerase/pymerase/output/dbAPI In directory sc8-pr-cvs1:/tmp/cvs-serv28441 Removed Files: dbAPI.pyt init.pyt Log Message: removed annoying .pyt files --- dbAPI.pyt DELETED --- --- init.pyt DELETED --- |
|
From: <de...@us...> - 2003-12-18 01:13:57
|
Update of /cvsroot/pymerase/pymerase
In directory sc8-pr-cvs1:/tmp/cvs-serv31821
Added Files:
CREDITS
Log Message:
Where credit is due.
--- NEW FILE: CREDITS ---
Diane Trout - Core development
Brandon King - Many output modules
Luis Rodrigo Gallardo Cruz - Fix for Bug 788408 unable to commit twice
|
|
From: <de...@us...> - 2003-12-18 01:01:36
|
Update of /cvsroot/pymerase/pymerase/pymerase/output/dbAPI
In directory sc8-pr-cvs1:/tmp/cvs-serv29950
Modified Files:
dbAPI.py
Log Message:
Merge in fix for bug 788408 from Luis Rodrigo Gallardo Cruz
Index: dbAPI.py
===================================================================
RCS file: /cvsroot/pymerase/pymerase/pymerase/output/dbAPI/dbAPI.py,v
retrieving revision 1.29
retrieving revision 1.30
diff -C2 -d -r1.29 -r1.30
*** dbAPI.py 18 Dec 2003 00:49:57 -0000 1.29
--- dbAPI.py 18 Dec 2003 01:01:26 -0000 1.30
***************
*** 455,459 ****
self.appended_objects.append(object)
! def commit(self):
"""Commits changes made to linked objects
"""
--- 455,459 ----
self.appended_objects.append(object)
! def commit(self, visited):
"""Commits changes made to linked objects
"""
***************
*** 468,472 ****
for object in self.loaded_objects:
! object.commit()
def getPrimaryKeys(self):
--- 468,472 ----
for object in self.loaded_objects:
! object.commit(visited)
def getPrimaryKeys(self):
***************
*** 614,618 ****
for object in self.loaded_objects:
! object.commit()
def getPrimaryKeys(self):
--- 614,618 ----
for object in self.loaded_objects:
! object.commit(visited)
def getPrimaryKeys(self):
***************
*** 849,856 ****
field.modified = 0
! def commit(self, visited={}):
"""Attempt to write object hierarchy back to the database
"""
# Begin transaction
if visited.has_key(self):
return
--- 849,859 ----
field.modified = 0
! def commit(self, visited=None):
"""Attempt to write object hierarchy back to the database
"""
# Begin transaction
+ if visited == None:
+ visited = {}
+
if visited.has_key(self):
return
***************
*** 867,871 ****
for link in local_links:
# update the one-to-one objects
! link.commit()
# update the local keys with values from the linked to objects
link.updateLinks()
--- 870,874 ----
for link in local_links:
# update the one-to-one objects
! link.commit(visited)
# update the local keys with values from the linked to objects
link.updateLinks()
***************
*** 885,889 ****
link.updateLinks()
# commit the many-to-one objects
! link.commit()
except Exception, e:
--- 888,892 ----
link.updateLinks()
# commit the many-to-one objects
! link.commit(visited)
except Exception, e:
|
|
From: <de...@us...> - 2003-12-18 00:56:15
|
Update of /cvsroot/pymerase/pymerase/examples/school In directory sc8-pr-cvs1:/tmp/cvs-serv28847 Modified Files: .cvsignore Log Message: Ignore the directory we put the generated objects in Index: .cvsignore =================================================================== RCS file: /cvsroot/pymerase/pymerase/examples/school/.cvsignore,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** .cvsignore 18 Dec 2003 00:26:02 -0000 1.1 --- .cvsignore 18 Dec 2003 00:56:11 -0000 1.2 *************** *** 4,5 **** --- 4,6 ---- *.sql psql.log + school/ |
|
From: <de...@us...> - 2003-12-18 00:54:26
|
Update of /cvsroot/pymerase/pymerase/pymerase/output
In directory sc8-pr-cvs1:/tmp/cvs-serv28619
Modified Files:
CreateDBAPI.py
Log Message:
Removed the search and replace on files template system and replaced
it with an interesting %(substitution)s template system (Located in
pymerase/util/Template
This should make installation easier as now everything should be
valid python code so compileall.py should be less grumpy with pymerase.
Index: CreateDBAPI.py
===================================================================
RCS file: /cvsroot/pymerase/pymerase/pymerase/output/CreateDBAPI.py,v
retrieving revision 1.32
retrieving revision 1.33
diff -C2 -d -r1.32 -r1.33
*** CreateDBAPI.py 4 Dec 2003 02:52:41 -0000 1.32
--- CreateDBAPI.py 18 Dec 2003 00:54:23 -0000 1.33
***************
*** 44,49 ****
--- 44,51 ----
import types
import shutil
+ from pymerase.util.Template import Template
from pymerase.util.output import *
from pymerase.util.SortMetaInfo import forwardDeclarationSort
+ from pymerase.util.Template import Template
from pymerase.output.dbAPI import fkeyTypes
***************
*** 109,113 ****
"""Create the top of the PythonAPI file
"""
-
header = []
# FIXME: do I really need to make the modules executable?
--- 111,114 ----
***************
*** 380,394 ****
return packageInformation
! def parsePackageInformation(packageInformation):
! def createImports(packageInformation):
module_list = []
! for moduleName, modulePath in packageInformation:
module_list += ["import %s" % (modulePath)]
return string.join(module_list, os.linesep)
! def createModuleToClassList(packageInformation):
module_list = ""
! for moduleName, packagePath in packageInformation:
if type(packagePath) == types.ListType:
modulePath = packagePath
--- 381,399 ----
return packageInformation
! class PackageTemplate(Template):
! def __init__(self, packageInformation):
! Template.__init__(self)
! self.packageInformation = packageInformation
!
! def import_modules(self):
module_list = []
! for moduleName, modulePath in self.packageInformation:
module_list += ["import %s" % (modulePath)]
return string.join(module_list, os.linesep)
! def classes_list(self):
module_list = ""
! for moduleName, packagePath in self.packageInformation:
if type(packagePath) == types.ListType:
modulePath = packagePath
***************
*** 400,418 ****
return '['+module_list+']'
! def createModulesList(packageInformation):
"""Return list of modules, useful for reloading when reinitializing
"""
module_list = []
! for moduleName, modulePath in packageInformation:
module_list += ["%s" % (modulePath)]
return string.join(module_list, ", ")
- package_macros = {}
-
- package_macros['IMPORT_MODULES'] = createImports(packageInformation)
- package_macros['CLASSES_LIST'] = createModuleToClassList(packageInformation)
- package_macros['MODULES_LIST'] = createModulesList(packageInformation)
-
- return package_macros
def writeTemplateFile(package_macros, source_filename, destination_filename):
--- 405,416 ----
return '['+module_list+']'
! def modules_list(self):
"""Return list of modules, useful for reloading when reinitializing
"""
module_list = []
! for moduleName, modulePath in self.packageInformation:
module_list += ["%s" % (modulePath)]
return string.join(module_list, ", ")
def writeTemplateFile(package_macros, source_filename, destination_filename):
***************
*** 434,467 ****
source_file.close()
destination_file.close()
!
def writePackage(destination, package_information):
# write the package definition
! if 1:
! import pymerase.output.dbAPI
! module_pathname = pymerase.output.dbAPI.__path__[0]
! module_path = module_pathname
! else:
! # this code fragment was used when I was looking for
! # a way to avoid the apparent instability of package.__path__
! # however that may have been a mistake
! # and this doesn't work in jython
! import inspect
! module_pathname = inspect.getabsfile(writePackage)
! module_path, module_filename = os.path.split(module_pathname)
! module_path = os.path.join(module_path, "dbAPI")
warn("module_pathname: %s" % (module_pathname), DebugWarning)
# parse package information
! package_macros = parsePackageInformation(package_information)
! # get module_path
! # FIXME: this is for the better segmented version
! files_to_copy = [('dbAPI.pyt', 'dbAPI.py'),
! ('init.pyt', '__init__.py'),
('../../util/bool.py', 'bool.py'),
! ('fkeyTypes.pyt', 'fkeyTypes.py')]
! # files_to_copy = [('dbAPI.py', '__init__.py'),
! # ('fkeyTypes.py', 'fkeyTypes.py')]
# Get filenames
for source_filename, destination_filename in files_to_copy:
--- 432,476 ----
source_file.close()
destination_file.close()
!
! def writeInit(package_template, destination_pathname):
! init = ["import os"]
! init += ["import sys"]
! init += ["import types"]
! init += ["import pgdb as db_api"]
! init += ["from dbAPI import Functor"]
! init += ["from dbAPI import reloadModuleList"]
! init += ["from dbAPI import DBSessionImpl"]
! init += [""]
! init += ["%(import_modules())s"]
! init += [""]
! init += ["moduleReload = Functor(reloadModuleList, (%(modules_list())s))"]
! init += [""]
! init += ["class DBSession(DBSessionImpl):"]
! init += [" def __init__(self, dsn=None, database=None, user=None, password=None):"]
! init += [" classes_to_load = %(classes_list())s"]
! init += [""]
! init += [" DBSessionImpl.__init__(self, dsn, database, user, password)"]
! init += [" self.loadClasses(classes_to_load)"]
! init += [" self.connect()"]
!
! package_template.writeFile(init, destination_pathname)
!
def writePackage(destination, package_information):
# write the package definition
! import pymerase.output.dbAPI
! module_pathname = pymerase.output.dbAPI.__path__[0]
! module_path = module_pathname
warn("module_pathname: %s" % (module_pathname), DebugWarning)
# parse package information
! package_template = PackageTemplate(package_information)
! writeInit(package_template, os.path.join(destination, "__init__.py"))
!
! files_to_copy = [('dbAPI.py', 'dbAPI.py'),
('../../util/bool.py', 'bool.py'),
! ('fkeyTypes.py', 'fkeyTypes.py')]
!
# Get filenames
for source_filename, destination_filename in files_to_copy:
***************
*** 469,473 ****
destination_pathname = os.path.join(destination, destination_filename)
! writeTemplateFile(package_macros, source_pathname, destination_pathname)
# Create dummy init
--- 478,482 ----
destination_pathname = os.path.join(destination, destination_filename)
! shutil.copy(source_pathname, destination_pathname)
# Create dummy init
|
|
From: <de...@us...> - 2003-12-18 00:50:47
|
Update of /cvsroot/pymerase/pymerase/pymerase/util
In directory sc8-pr-cvs1:/tmp/cvs-serv27991
Modified Files:
Template.py
Log Message:
Added code to handle writing a %substitution template to a file
Index: Template.py
===================================================================
RCS file: /cvsroot/pymerase/pymerase/pymerase/util/Template.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** Template.py 11 Nov 2003 08:05:14 -0000 1.1
--- Template.py 18 Dec 2003 00:50:44 -0000 1.2
***************
*** 1,6 ****
--- 1,10 ----
+ import os
import string
import types
from Functor import Functor
+ # FIXME: this templating system doesn't handle code with %s substitutions well
+ # FIXME: something should be done about this.
+
class Template(object):
"""Base class for defining python templating objects.
***************
*** 46,47 ****
--- 50,67 ----
return eval(key, self.namespace)
+
+ def writeFile(self, template, destination):
+ """Process template and save result to destination
+ """
+ if type(template) is types.ListType:
+ result = []
+ for l in template:
+ result += [l % (self)]
+ result = string.join(result, os.linesep)
+ else:
+ result = template % (self)
+
+ destination_file = open(destination, "w+")
+ destination_file.write(result)
+ destination_file.close()
+
|
|
From: <de...@us...> - 2003-12-18 00:50:00
|
Update of /cvsroot/pymerase/pymerase/pymerase/output/dbAPI
In directory sc8-pr-cvs1:/tmp/cvs-serv27831
Modified Files:
dbAPI.py
Log Message:
Added back in brandon's modification to dbAPI.pyt
Added safe delete function to DBClassImpl
Index: dbAPI.py
===================================================================
RCS file: /cvsroot/pymerase/pymerase/pymerase/output/dbAPI/dbAPI.py,v
retrieving revision 1.28
retrieving revision 1.29
diff -C2 -d -r1.28 -r1.29
*** dbAPI.py 18 Dec 2003 00:47:04 -0000 1.28
--- dbAPI.py 18 Dec 2003 00:49:57 -0000 1.29
***************
*** 907,910 ****
--- 907,922 ----
self.loadSelf(self.id())
+ def safeDelete(self):
+ """Only deletes the object if it has no associations with other objects
+ """
+ for key in self.associations.keys():
+ assoc = self.associations[key]
+ objList = assoc.getObjects()
+ if len(objList) > 0:
+ msg = 'CANNOT DELETE %s SAFELY, ABORTING DELETETION' % (self.getTableName())
+ raise ValueError, msg
+
+ self.delete()
+
def delete(self):
"""Delete the current object from the database.
|
|
From: <de...@us...> - 2003-12-18 00:47:07
|
Update of /cvsroot/pymerase/pymerase/pymerase/output/dbAPI In directory sc8-pr-cvs1:/tmp/cvs-serv27359 Added Files: dbAPI.py Log Message: Resurected dbAPI.py as .pyt templating system was annoying This required moving all of the static code from init.pyt so as to make auto generating it in CreateDBAPI simple |
|
From: <de...@us...> - 2003-12-18 00:40:13
|
Update of /cvsroot/pymerase/pymerase/pymerase/output/dbAPI In directory sc8-pr-cvs1:/tmp/cvs-serv26110 Added Files: fkeyTypes.py Log Message: Stopped using substring replace templating system so this file can just be copied to be installed. |
|
From: <de...@us...> - 2003-12-18 00:39:08
|
Update of /cvsroot/pymerase/pymerase/pymerase/output/dbAPI In directory sc8-pr-cvs1:/tmp/cvs-serv26069 Removed Files: fkeyTypes.pyt Log Message: removed fkeyTypes.pyt as we need to import it during build, not to mention the substring replace templating system was annoying. --- fkeyTypes.pyt DELETED --- |
|
From: <de...@us...> - 2003-12-18 00:36:30
|
Update of /cvsroot/pymerase/pymerase/pymerase/output/dbAPI
In directory sc8-pr-cvs1:/tmp/cvs-serv25609
Modified Files:
init.pyt
Log Message:
Moved as much as possible out of init.pyt. This allows outgenerating it completely in CreateDBAPI instead of using the string substitution template.
Index: init.pyt
===================================================================
RCS file: /cvsroot/pymerase/pymerase/pymerase/output/dbAPI/init.pyt,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** init.pyt 4 Dec 2003 03:16:03 -0000 1.2
--- init.pyt 18 Dec 2003 00:36:27 -0000 1.3
***************
*** 8,264 ****
import pgdb as db_api
! %%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):
! assert callable(function), "function should be a callable obj"
! self._function = function
! self._args = args
! self._kargs = kargs
!
! def __call__(self, *args, **kargs):
! """call function"""
! _args = list(self._args)
! _args.extend(args)
! _kargs = self._kargs.copy()
! _kargs.update(kargs)
! return apply(self._function,_args,_kargs)
! class DBSession:
! """Manages creating and closing a database session.
! """
! default_dsn = "localhost"
! try:
! default_user = os.getlogin()
! except:
! default_user = None
! default_database = None
! default_password=None
!
def __init__(self, dsn=None, database=None, user=None, password=None):
- if dsn is None:
- self.dsn = os.environ.get('DBHOST', DBSession.default_dsn)
- else:
- self.dsn = dsn
- if database is None:
- self.database = os.environ.get('DBDATABASE', DBSession.default_database)
- else:
- self.database = database
- if user is None:
- self.user = os.environ.get('DBUSER', DBSession.default_user)
- else:
- self.user = user
- if password is None:
- self.password = os.environ.get('DBPASSWORD', DBSession.default_password)
- else:
- self.password = password
-
- # 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()
- def __del__(self):
- if self.db is not None:
- self.db.close()
-
- #############################
- # Database session management
- def connect(self):
- if self.db is None:
- self.db = db_api.connect(dsn=self.dsn,
- user=self.user,
- database=self.database,
- password=self.password)
-
- def cursor(self):
- #if self.db is None:
- # self.connect()
- return self.db.cursor()
-
- def rollback(self):
- if self.db is not None:
- self.db.rollback()
-
- def commit(self):
- if self.db is not None:
- self.db.commit()
-
- def close(self):
- if self.db is not None:
- self.db.close()
-
- ############################
- # attribute access
- def __loadClasses(self, module_list):
- for className, classRef in module_list:
- # construct arguments for functor
- _args = [classRef]
- kargs = {'db_session': self}
-
- # create class factory application function
- functor = apply(Functor, _args, kargs)
-
- # store reference to class reference, so we can
- # get access to the class variables when doing
- # certain types of lookups. (Yes this seems icky)
- self.class_references[functor] = classRef
-
- # add constructor to our class object
- setattr(self, className, functor)
-
- return
- for m in module_list:
- self.__loadClass(m)
-
-
- def __getClassRef(self, class_functor):
- """Given a class or class factory reference return a class reference
- """
-
- if type(class_functor) == types.ClassType:
- class_ref = class_functor
- elif isinstance(class_functor, Functor):
- class_ref = self.class_references[class_functor]
- else:
- raise ValueError("unrecognized class type")
-
- return class_ref
-
- def getObjects(self, class_functor, keys):
- """Returns a list of objects from a list of primary keys.
- """
- if keys is None or len(keys) == 0:
- # FIXME: Should this raise an error instead?
- return None
-
- class_ref = self.__getClassRef(class_functor)
- class_inst = class_ref()
-
- sql = "SELECT * FROM \"%s\" where \"%s\" in (" % (
- class_ref.table_name,
- class_inst.getPrimaryKeyName())
- sql += keys[0]
- for k in keys[1:]:
- sql += ", %s" % (k)
- sql += ")"
-
- return self.loadRecords(class_ref, sql)
-
- def getAllObjects(self, class_functor):
- """Return all records of type class_ref as a list.
- """
- class_ref = self.__getClassRef(class_functor)
-
- sql = "SELECT * FROM \"%s\"" % (class_ref.table_name)
- return self.loadRecords(class_ref, sql)
-
- def getObjectsWhere(self, class_functor, where_clause):
- """Returns all records of type class ref that matches the sql where expr.
- """
- class_ref = self.__getClassRef(class_functor)
-
- sql = "SELECT * FROM \"%s\" where %s" % (class_ref.table_name, where_clause)
- return self.loadRecords(class_ref, sql)
-
- def getObjectCount(self, class_functor):
- """
- Returns the number of objects which exist for a given class
- """
- class_ref = self.__getClassRef(class_functor)
-
- sql = "SELECT count(*) FROM \"%s\"" % (class_ref.table_name)
-
- try:
- cursor = self.db.cursor()
- try:
- cursor.execute(sql)
- record = cursor.fetchone()
- finally:
- cursor.close()
- except Exception, e:
- # pgdb isn't too informative about exception
- sys.stderr.write(str(e))
- sys.stderr.write(os.linesep)
-
- return record.pop()
-
- def getObjectCountWhere(self, class_functor, where_clause):
- """
- Returns the number of objects which exist for a given class,
- given a where clause.
- """
- class_ref = self.__getClassRef(class_functor)
-
- sql = "SELECT count(*) FROM \"%s\" where %s" % (class_ref.table_name,
- where_clause)
-
- try:
- cursor = self.db.cursor()
- try:
- cursor.execute(sql)
- record = cursor.fetchone()
- finally:
- cursor.close()
- except Exception, e:
- # pgdb isn't too informative about exception
- sys.stderr.write(str(e))
- sys.stderr.write(os.linesep)
-
- return record.pop()
-
- def loadRecords(self, class_ref, sql):
- """Returns a list of objects selected by an sql statement.
-
- Given a class_reference and an sql statement for each record returned
- bind the values to an object instantiated from the class_ref.
- """
- objects = []
- try:
- cursor = self.db.cursor()
- try:
- cursor.execute(sql)
-
- record = cursor.fetchone()
- while record is not None:
- o = class_ref(db_session=self)
- # tag this object as having been loaded from the database
- o.loaded = 1
- o.bindFields(cursor.description, record)
- objects.append(o)
- record = cursor.fetchone()
- finally:
- cursor.close()
- except Exception, e:
- # pgdb isn't too informative about exception
- sys.stderr.write(str(e))
- sys.stderr.write(os.linesep)
- self.rollback()
- else:
- self.commit()
-
- return objects
--- 8,24 ----
import pgdb as db_api
! from dbAPI import Functor
! from dbAPI import reloadModuleList
! %%IMPORT_MODULES%%
! moduleReload = Functor(reloadModuleList, (%%MODULES_LIST%%))
! class DBSession(DBSessionImpl):
def __init__(self, dsn=None, database=None, user=None, password=None):
classes_to_load = %%CLASSES_LIST%%
+ DBSessionImpl.__init__(self, dsn, database, user, password)
+ self.loadClasses(classes_to_load)
self.connect()
|
|
From: <de...@us...> - 2003-12-18 00:33:06
|
Update of /cvsroot/pymerase/pymerase/pymerase/output/CppAPI In directory sc8-pr-cvs1:/tmp/cvs-serv25058 Added Files: .cvsignore Log Message: Ignore uninteresting files --- NEW FILE: .cvsignore --- *.pyc *.class |
|
From: <de...@us...> - 2003-12-18 00:32:06
|
Update of /cvsroot/pymerase/pymerase/pymerase/output
In directory sc8-pr-cvs1:/tmp/cvs-serv24848
Added Files:
CreateJava.py
Log Message:
Begin a java/ojb output module
--- NEW FILE: CreateJava.py ---
###########################################################################
# #
# C O P Y R I G H T N O T I C E #
# Copyright (c) 2001 by: #
# * California Institute of Technology #
# #
# All Rights Reserved. #
# #
# Permission is hereby granted, free of charge, to any person #
# obtaining a copy of this software and associated documentation files #
# (the "Software"), to deal in the Software without restriction, #
# including without limitation the rights to use, copy, modify, merge, #
# publish, distribute, sublicense, and/or sell copies of the Software, #
# and to permit persons to whom the Software is furnished to do so, #
# subject to the following conditions: #
# #
# The above copyright notice and this permission notice shall be #
# included in all copies or substantial portions of the Software. #
# #
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, #
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF #
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND #
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS #
# BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN #
# ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN #
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE #
# SOFTWARE. #
###########################################################################
# Authors: $Author: detrout $
# Last Modified: $Date: 2003/12/18 00:32:03 $
"""Creates Java API"""
from __future__ import nested_scopes
import os
import sys
import string
import re
import types
import shutil
from pymerase.util.Template import Template
from pymerase.util.output import *
from pymerase.util.SortMetaInfo import forwardDeclarationSort
from pymerase.util.Template import Template
from pymerase.output.dbAPI import fkeyTypes
import warnings
from pymerase.util.Warnings import DebugWarning
from warnings import warn
############################
# helper files
def getMITCopyright():
return """
###########################################################################
# #
# C O P Y R I G H T N O T I C E #
# Copyright (c) %4s by: #
# * California Institute of Technology #
# #
# All Rights Reserved. #
# #
# Permission is hereby granted, free of charge, to any person #
# obtaining a copy of this software and associated documentation files #
# (the "Software"), to deal in the Software without restriction, #
# including without limitation the rights to use, copy, modify, merge, #
# publish, distribute, sublicense, and/or sell copies of the Software, #
# and to permit persons to whom the Software is furnished to do so, #
# subject to the following conditions: #
# #
# The above copyright notice and this permission notice shall be #
# included in all copies or substantial portions of the Software. #
# #
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, #
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF #
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND #
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS #
# BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN #
# ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN #
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE #
# SOFTWARE. #
###########################################################################
""" % (str(2003))
TRANSLATOR_NAME='CreateJava'
SQL_TRANSLATOR_NAME='CreateSQL'
class JavaTemplate(Template):
def __init__(self):
Template.__init__(self)
#######################################
# Output Translater Interface
def writeClass(destination, classMetaInfo):
"""Generate the java classes.
"""
c = []
c += ["/** "]
c += [" * Create a new %(ClassName)s"]
c += [" *"]
c += [" * All collections will be initialized (as empty)."]
c += [" */"]
c += [""]
c += ["public %(ClassName)s()"]
c += ["{"]
if not classMetaInfo.isBaseClass():
c += [" super();"]
c += [""]
c += ["%(ClasInitializer)s"]
c += [""]
c += ["/**"]
c += [" * Create a new %(ClassName)s with all fields initialized."]
c += [" */"]
c += ["%(DefaultConstructor)s"]
c += [""]
c += ["/**"]
c += [" * Prints a string represenation of this class to aid in deubbing"]
c += [" */"]
c += ["public void debugPrint()"]
c += ["{"]
c += [" System.out.println(class %(ClassName)s)"]
c += [" debugDumpAttributes();"]
c += [" System.out.println();"]
c += ["}"]
c += [""]
c += ["protected void de"]
c += [""]
c += [""]
c += [""]
c += [""]
c += [""]
c += [""]
c += [""]
c += [""]
c += [""]
c += [""]
def write(destination, parsedInput):
# Write out all the individual package members
if not os.path.exists(destination):
os.mkdir(destination)
elif not os.path.isdir(destination):
msg = "PATH(%s) is not a directory!" % (destination)
raise ValueError(msg)
package_information = []
for t in tables:
try:
package_information.append(writeClass(destination, t))
except NotImplementedError, e:
warn("Skipping %s" % ( t.getName() ), DebugWarning)
|
|
From: <de...@us...> - 2003-12-18 00:30:28
|
Update of /cvsroot/pymerase/pymerase/examples/varTypes In directory sc8-pr-cvs1:/tmp/cvs-serv24493 Added Files: .cvsignore Log Message: Ignore uninteresting files --- NEW FILE: .cvsignore --- *.pyc *.class *.sql *.xmi |