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: <ki...@us...> - 2002-12-11 22:34:55
|
Update of /cvsroot/pymerase/pymerase/output
In directory sc8-pr-cvs1:/tmp/cvs-serv27845
Modified Files:
CreateDBEditor.py
Log Message:
removed depandency on mx.datatime
Index: CreateDBEditor.py
===================================================================
RCS file: /cvsroot/pymerase/pymerase/output/CreateDBEditor.py,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** CreateDBEditor.py 15 Aug 2002 00:09:20 -0000 1.12
--- CreateDBEditor.py 11 Dec 2002 22:34:51 -0000 1.13
***************
*** 36,40 ****
import string
! from mx import DateTime
from output.webUtil import makePackage
--- 36,40 ----
import string
! #from mx import DateTime
from output.webUtil import makePackage
***************
*** 82,86 ****
# Authors: Brandon King
# Last Modified: $Date$
! #""" % (DateTime.localtime())
return text
--- 82,86 ----
# Authors: Brandon King
# Last Modified: $Date$
! #"""
return text
|
|
From: <de...@us...> - 2002-12-11 22:31:35
|
Update of /cvsroot/pymerase/pymerase/util
In directory sc8-pr-cvs1:/tmp/cvs-serv26520
Modified Files:
xor_string.py
Log Message:
Replace the array with a list of ords to make this code compatible
with jython.
Index: xor_string.py
===================================================================
RCS file: /cvsroot/pymerase/pymerase/util/xor_string.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** xor_string.py 15 Aug 2002 00:09:21 -0000 1.2
--- xor_string.py 11 Dec 2002 22:31:30 -0000 1.3
***************
*** 32,36 ****
#
- import array
import operator
--- 32,35 ----
***************
*** 40,57 ****
else:
length = len(s)
! tmp = array.array('B', s)
tmp = map(operator.xor, tmp, [val]*length)
return reduce(operator.add, map(chr, tmp))
-
-
-
-
-
-
-
-
-
-
-
-
-
--- 39,43 ----
else:
length = len(s)
! tmp = map(ord, s)
tmp = map(operator.xor, tmp, [val]*length)
return reduce(operator.add, map(chr, tmp))
|
|
From: <de...@us...> - 2002-12-11 20:31:08
|
Update of /cvsroot/pymerase/pymerase/util
In directory sc8-pr-cvs1:/tmp/cvs-serv11300
Modified Files:
NameMangling.py
Log Message:
Add new Name Mangler that is useful for converting names to things
like english. (Capitalize first word, use spaces between components)
Index: NameMangling.py
===================================================================
RCS file: /cvsroot/pymerase/pymerase/util/NameMangling.py,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** NameMangling.py 11 Oct 2002 19:24:10 -0000 1.3
--- NameMangling.py 11 Dec 2002 20:30:53 -0000 1.4
***************
*** 79,80 ****
--- 79,103 ----
return "append_%s" % (self.mangle(name))
+ class EnglishWord(nullMangler):
+ """Given a string convert it to english sentance conventions
+
+ capitalize first word, put spaces between other elements.
+ """
+ def mangle(self, name):
+ if type(name) == types.StringType or type(name) == types.UnicodeType:
+ if len(name) > 0:
+ s = string.lower(re.sub('(\w)([A-Z][^A-Z])', "\\1 \\2", name))
+ return string.upper(s[0]) + s[1:]
+
+ return ""
+ #raise ValueError("mangle requires a string not a %s" % str(type(name)))
+
+ def createGetter(self, name):
+ return "get_%s" % (self.mangle(name))
+
+ def createSetter(self, name):
+ return "set_%s" % (self.mangle(name))
+
+ def createAppender(self, name):
+ return "append_%s" % (self.mangle(name))
+
|
|
From: <de...@us...> - 2002-12-11 20:30:01
|
Update of /cvsroot/pymerase/pymerase
In directory sc8-pr-cvs1:/tmp/cvs-serv11115
Modified Files:
pymerase.py
Log Message:
Add a default of EnglishWord for name managling HTML Form variables
Index: pymerase.py
===================================================================
RCS file: /cvsroot/pymerase/pymerase/pymerase.py,v
retrieving revision 1.25
retrieving revision 1.26
diff -C2 -d -r1.25 -r1.26
*** pymerase.py 19 Nov 2002 00:54:47 -0000 1.25
--- pymerase.py 11 Dec 2002 20:29:57 -0000 1.26
***************
*** 79,82 ****
--- 79,83 ----
self.pymeraseConfigVersion=0
self.nameManglers = {None: util.NameMangling.CapWord(),
+ 'CreateHTMLForm': util.NameMangling.EnglishWord(),
'CreateSQL': util.NameMangling.underscore_word()}
self.defaultPackage = defaultPackage
|
|
From: <de...@us...> - 2002-12-11 20:29:17
|
Update of /cvsroot/pymerase/pymerase
In directory sc8-pr-cvs1:/tmp/cvs-serv10696
Modified Files:
ClassMembers.py
Log Message:
Default to name if friendly name is unset.
Index: ClassMembers.py
===================================================================
RCS file: /cvsroot/pymerase/pymerase/ClassMembers.py,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** ClassMembers.py 11 Dec 2002 17:30:43 -0000 1.12
--- ClassMembers.py 11 Dec 2002 20:29:12 -0000 1.13
***************
*** 101,105 ****
def getFriendlyName(self):
! return self.friendlyName
def setDescription(self, value):
--- 101,108 ----
def getFriendlyName(self):
! if self.friendlyName is None:
! return self.name
! else:
! return self.friendlyName
def setDescription(self, value):
|
|
From: <ki...@us...> - 2002-12-11 20:26:37
|
Update of /cvsroot/pymerase/pymerase/output
In directory sc8-pr-cvs1:/tmp/cvs-serv9674
Modified Files:
CreateHtmlForms.py
Log Message:
changed getName(...) back to getFriendlyName(...)
deleted fixmes
Index: CreateHtmlForms.py
===================================================================
RCS file: /cvsroot/pymerase/pymerase/output/CreateHtmlForms.py,v
retrieving revision 1.16
retrieving revision 1.17
diff -C2 -d -r1.16 -r1.17
*** CreateHtmlForms.py 11 Dec 2002 17:35:09 -0000 1.16
--- CreateHtmlForms.py 11 Dec 2002 20:26:31 -0000 1.17
***************
*** 141,154 ****
#Process Integers and Doubles
elif type == "integer" or type == "double precision":
- #FIXME: first attribute.getName(...) should be getFriendlyName
html = util.insertInputBox(html,
! attribute.getName(TRANSLATOR_NAME),
attribute.getName(TRANSLATOR_NAME),
"4",
notNull=attribute.isRequired())
elif type == "name":
- #FIXME: first attribute.getName(...) should be getFriendlyName
html = util.insertInputBox(html,
! attribute.getName(TRANSLATOR_NAME),
attribute.getName(TRANSLATOR_NAME),
"31",
--- 141,152 ----
#Process Integers and Doubles
elif type == "integer" or type == "double precision":
html = util.insertInputBox(html,
! attribute.getFriendlyName(TRANSLATOR_NAME),
attribute.getName(TRANSLATOR_NAME),
"4",
notNull=attribute.isRequired())
elif type == "name":
html = util.insertInputBox(html,
! attribute.getFriendlyName(TRANSLATOR_NAME),
attribute.getName(TRANSLATOR_NAME),
"31",
***************
*** 157,170 ****
#Process Text
elif type == "text":
- #FIXME: first attribute.getName(...) should be getFriendlyName
html = util.insertTextBox(html,
! attribute.getName(TRANSLATOR_NAME),
attribute.getName(TRANSLATOR_NAME),
notNull=attribute.isRequired())
#Process Variable Characters
elif PymeraseType.isVarchar(type):
- #FIXME: first attribute.getName(...) should be getFriendlyName
html = util.insertInputBox(html,
! attribute.getName(TRANSLATOR_NAME),
attribute.getName(TRANSLATOR_NAME),
"30",
--- 155,166 ----
#Process Text
elif type == "text":
html = util.insertTextBox(html,
! attribute.getFriendlyName(TRANSLATOR_NAME),
attribute.getName(TRANSLATOR_NAME),
notNull=attribute.isRequired())
#Process Variable Characters
elif PymeraseType.isVarchar(type):
html = util.insertInputBox(html,
! attribute.getFriendlyName(TRANSLATOR_NAME),
attribute.getName(TRANSLATOR_NAME),
"30",
***************
*** 173,179 ****
#Process Characters
elif PymeraseType.isChar(type):
- #FIXME: first attribute.getName(...) should be getFriendlyName
html = util.insertInputBox(html,
! attribute.getName(TRANSLATOR_NAME),
attribute.getName(TRANSLATOR_NAME),
PymeraseType.getVarcharLen(type),
--- 169,174 ----
#Process Characters
elif PymeraseType.isChar(type):
html = util.insertInputBox(html,
! attribute.getFriendlyName(TRANSLATOR_NAME),
attribute.getName(TRANSLATOR_NAME),
PymeraseType.getVarcharLen(type),
***************
*** 186,192 ****
#Process Time Stamps
elif type == "timestamp with time zone":
- #FIXME: first attribute.getName(...) should be getFriendlyName
html = util.insertDatetime(html,
! attribute.getName(TRANSLATOR_NAME),
attribute.getName(TRANSLATOR_NAME),
notNull=attribute.isRequired())
--- 181,186 ----
#Process Time Stamps
elif type == "timestamp with time zone":
html = util.insertDatetime(html,
! attribute.getFriendlyName(TRANSLATOR_NAME),
attribute.getName(TRANSLATOR_NAME),
notNull=attribute.isRequired())
|
|
From: <ki...@us...> - 2002-12-11 17:47:35
|
Update of /cvsroot/pymerase/pymerase/output
In directory sc8-pr-cvs1:/tmp/cvs-serv8877
Added Files:
CreateReport.py
Log Message:
Generates a report about classes, attributes, and associations.
--- NEW FILE: CreateReport.py ---
###########################################################################
# #
# C O P Y R I G H T N O T I C E #
# Copyright (c) 2002 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: Brandon King
# Last Modified: $Date: 2002/12/11 17:47:32 $
#
"""Creates a report of each Class/Table"""
#Imported System Packages.
import os
import string
from ClassMembers import getAllAttributes
from ClassMembers import getAllAssociations
############################
# Globals
TRANSLATOR_NAME='CreateReport'
############################
# Writer components
def write(destination, tables):
"""
Create Report in destination dirctory.
"""
text = []
#Iterate through the tables/classes and process the data
for tbl in tables:
#Set Web Page Title
text.append("CLASS: %s" % (tbl.getName(TRANSLATOR_NAME)))
#Process each attribute in a given table (class)
for attribute in getAllAttributes(tables, tbl, TRANSLATOR_NAME):
#get attribute type
type = attribute.getType().getSQLType()
text.append(" ATTRIBUTE:")
text.append(" Name = %s" % (attribute.getName(TRANSLATOR_NAME)))
text.append(" Type = %s" % (type))
text.append(" isRequired = %s" % (attribute.isRequired()))
text.append(" isUnique = %s" % (attribute.isUnique()))
text.append(" isIndexed = %s" % (attribute.isIndexed()))
text.append(" isPrimaryKey = %s" % (attribute.isPrimaryKey()))
for assocEnd in tbl.getAssociationEnds().values():
text.append(" ASSOC END:")
text.append(" Name = %s" % (assocEnd.getAttributeName(TRANSLATOR_NAME)))
text.append(" Multiplicity = %s" % (assocEnd.getMultiplicity()))
text.append(" isNavigable = %s" % (assocEnd.isNavigable()))
text.append(" OppositeEnd = %s.%s" % \
(assocEnd.getOppositeEnd().getClassName(TRANSLATOR_NAME),
assocEnd.getOppositeEnd().getAttributeName(TRANSLATOR_NAME)))
text.append("")
text = string.join(text, '\n')
f = open(destination, 'w')
f.write(text)
f.close()
print os.linesep \
+ "Report Generation Complete... Good Bye." \
+ os.linesep
|
|
From: <ki...@us...> - 2002-12-11 17:45:23
|
Update of /cvsroot/pymerase/pymerase/examples/dvd/schema
In directory sc8-pr-cvs1:/tmp/cvs-serv8304
Modified Files:
Dvd.xml
Log Message:
Changed name to match XMI model
Index: Dvd.xml
===================================================================
RCS file: /cvsroot/pymerase/pymerase/examples/dvd/schema/Dvd.xml,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** Dvd.xml 7 Nov 2002 02:58:12 -0000 1.2
--- Dvd.xml 11 Dec 2002 17:45:20 -0000 1.3
***************
*** 8,12 ****
not_null="1"
comment="Title of Movie"/>
! <column name="release_year"
full_name="Year Released"
type="varchar(128)"
--- 8,12 ----
not_null="1"
comment="Title of Movie"/>
! <column name="yearReleased"
full_name="Year Released"
type="varchar(128)"
|
|
From: <ki...@us...> - 2002-12-11 17:39:58
|
Update of /cvsroot/pymerase/pymerase/examples/dvd In directory sc8-pr-cvs1:/tmp/cvs-serv6154 Added Files: dvd.zargo Log Message: DVD UML Schema --- NEW FILE: dvd.zargo --- (This appears to be a binary file; contents omitted.) |
|
From: <ki...@us...> - 2002-12-11 17:39:18
|
Update of /cvsroot/pymerase/pymerase/examples/dvd
In directory sc8-pr-cvs1:/tmp/cvs-serv5900
Added Files:
createhtml.py
Log Message:
Generates html forms for DVD Database
--- NEW FILE: createhtml.py ---
#!/usr/bin/env python
import sys
import os
import pymerase
import input.parseXMI
import output.CreateHtmlForms
if __name__ == "__main__":
schema = os.path.abspath("./dvd_.xmi")
outputPath = os.path.abspath("./html")
pymerase.run(schema, input.parseXMI, outputPath, output.CreateHtmlForms)
|
|
From: <ki...@us...> - 2002-12-11 17:38:45
|
Update of /cvsroot/pymerase/pymerase/examples/dvd
In directory sc8-pr-cvs1:/tmp/cvs-serv5604
Added Files:
createreport.py
Log Message:
create a report of schema
--- NEW FILE: createreport.py ---
#!/usr/bin/env python
import sys
import os
import pymerase
import input.parseXMI
import output.CreateReport
if __name__ == "__main__":
schema = os.path.abspath("./dvd_.xmi")
outputPath = os.path.abspath("./report.txt")
pymerase.run(schema, input.parseXMI, outputPath, output.CreateReport)
|
|
From: <ki...@us...> - 2002-12-11 17:37:51
|
Update of /cvsroot/pymerase/pymerase/examples/dvd
In directory sc8-pr-cvs1:/tmp/cvs-serv5498
Added Files:
createapi.py
Log Message:
DvdAPI generation
--- NEW FILE: createapi.py ---
#!/usr/bin/env python
import sys
import os
import pymerase
# NOTE: Jython can't use the python way to load modules based on their name
# NOTE: so we have to manually import the modules we're using
# NOTE: and pass them to pymerase.run
import input.parseXMI
import output.CreateDBAPI
if __name__ == "__main__":
schema = os.path.abspath("./dvd_.xmi")
outputPath = os.path.abspath("./DvdAPI")
#pymerase.run(schema, 'parseXMI', output, 'CreateDBAPI')
pymerase.run(schema, input.parseXMI, outputPath, output.CreateDBAPI)
|
|
From: <ki...@us...> - 2002-12-11 17:37:30
|
Update of /cvsroot/pymerase/pymerase/examples/dvd
In directory sc8-pr-cvs1:/tmp/cvs-serv5289
Added Files:
createsql.py
Log Message:
for generating the sql for dvd database
--- NEW FILE: createsql.py ---
#!/usr/bin/env python
import sys
import os
import pymerase
import input.parseXMI
import output.CreateDBAPI
if __name__ == "__main__":
schema = os.path.abspath("./dvd_.xmi")
outputPath = os.path.abspath("./dvd.sql")
pymerase.run(schema, input.parseXMI, outputPath, output.CreateSQL)
|
|
From: <ki...@us...> - 2002-12-11 17:35:12
|
Update of /cvsroot/pymerase/pymerase/output
In directory sc8-pr-cvs1:/tmp/cvs-serv3577
Modified Files:
CreateHtmlForms.py
Log Message:
changed cdToDestination() to checkDestination() and now uses abspath
updated for namemangling
FIXME: getFriendlyName() = None in XMI output --> Changed to getName()
Index: CreateHtmlForms.py
===================================================================
RCS file: /cvsroot/pymerase/pymerase/output/CreateHtmlForms.py,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -d -r1.15 -r1.16
*** CreateHtmlForms.py 15 Aug 2002 00:09:20 -0000 1.15
--- CreateHtmlForms.py 11 Dec 2002 17:35:09 -0000 1.16
***************
*** 52,55 ****
--- 52,57 ----
WEB_NAME = "Generic Data Annotator"
+ TRANSLATOR_NAME='CreateHtmlForms'
+
############################
# Writer components
***************
*** 73,86 ****
return 0
! def cdToDestination(destination):
"""
Checks to see if the destination path exists, if it doesn't it creates the directory and moves into it.
"""
! #FIXME: Should use absolute paths rather than changing directories.
! if os.path.isdir(destination):
! os.chdir(destination)
! else:
os.mkdir(destination)
! os.chdir(destination)
--- 75,88 ----
return 0
! def checkDestination(destination):
"""
Checks to see if the destination path exists, if it doesn't it creates the directory and moves into it.
"""
! if os.path.exists(destination) == 0:
os.mkdir(destination)
! elif os.path.isdir(destination) == 0:
! print "%s exists but is not a directory." % (destination)
! sys.exit(2)
!
***************
*** 95,101 ****
"""
! #FIXME: should use absolute paths
#Change directory to destination
! cdToDestination(destination)
#Get html helper util
--- 97,103 ----
"""
!
#Change directory to destination
! checkDestination(destination)
#Get html helper util
***************
*** 109,117 ****
#Set Web Page Title
! title = "%s - %s" % (WEB_NAME, tbl.getName())
#Set html filename
! filename = "%s.html" % (tbl.getName())
#Set scriptname to handle form
! scriptName = "%s_web.py" % (tbl.getName())
#Insert Title into html template
--- 111,120 ----
#Set Web Page Title
! title = "%s - %s" % (WEB_NAME, tbl.getName(TRANSLATOR_NAME))
#Set html filename
! filename = "%s.html" % (tbl.getName(TRANSLATOR_NAME))
! filePath = os.path.join(destination, filename)
#Set scriptname to handle form
! scriptName = "%s_web.py" % (tbl.getName(TRANSLATOR_NAME))
#Insert Title into html template
***************
*** 121,133 ****
#Process each attribute in a given table (class)
! for attribute in getAllAttributes(tables, tbl):
#get attribute type
type = attribute.getType().getSQLType()
! print "Processing(%s:%s)" % (tbl.getName(), type)
#Process Foriegn keys
! if isFKey(attribute.getName()) or type == "serial":
! comment = "INSERT_%s_HERE" % (attribute.getName())
if attribute.isRequired() == 0:
html = util.insertComment(html, comment)
--- 124,137 ----
#Process each attribute in a given table (class)
! for attribute in getAllAttributes(tables, tbl, TRANSLATOR_NAME):
#get attribute type
type = attribute.getType().getSQLType()
! print "Processing(%s:%s)" % (tbl.getName(TRANSLATOR_NAME), type)
#Process Foriegn keys
! if isFKey(attribute.getName(TRANSLATOR_NAME)) or type == "serial":
! print "ACCESSING isFKey"
! comment = "INSERT_%s_HERE" % (attribute.getName(TRANSLATOR_NAME))
if attribute.isRequired() == 0:
html = util.insertComment(html, comment)
***************
*** 137,149 ****
#Process Integers and Doubles
elif type == "integer" or type == "double precision":
html = util.insertInputBox(html,
! attribute.getFriendlyName(),
! attribute.getName(),
"4",
notNull=attribute.isRequired())
elif type == "name":
html = util.insertInputBox(html,
! attribute.getFriendlyName(),
! attribute.getName(),
"31",
"31",
--- 141,155 ----
#Process Integers and Doubles
elif type == "integer" or type == "double precision":
+ #FIXME: first attribute.getName(...) should be getFriendlyName
html = util.insertInputBox(html,
! attribute.getName(TRANSLATOR_NAME),
! attribute.getName(TRANSLATOR_NAME),
"4",
notNull=attribute.isRequired())
elif type == "name":
+ #FIXME: first attribute.getName(...) should be getFriendlyName
html = util.insertInputBox(html,
! attribute.getName(TRANSLATOR_NAME),
! attribute.getName(TRANSLATOR_NAME),
"31",
"31",
***************
*** 151,163 ****
#Process Text
elif type == "text":
html = util.insertTextBox(html,
! attribute.getFriendlyName(),
! attribute.getName(),
notNull=attribute.isRequired())
#Process Variable Characters
elif PymeraseType.isVarchar(type):
html = util.insertInputBox(html,
! attribute.getFriendlyName(),
! attribute.getName(),
"30",
PymeraseType.getVarcharLen(type),
--- 157,171 ----
#Process Text
elif type == "text":
+ #FIXME: first attribute.getName(...) should be getFriendlyName
html = util.insertTextBox(html,
! attribute.getName(TRANSLATOR_NAME),
! attribute.getName(TRANSLATOR_NAME),
notNull=attribute.isRequired())
#Process Variable Characters
elif PymeraseType.isVarchar(type):
+ #FIXME: first attribute.getName(...) should be getFriendlyName
html = util.insertInputBox(html,
! attribute.getName(TRANSLATOR_NAME),
! attribute.getName(TRANSLATOR_NAME),
"30",
PymeraseType.getVarcharLen(type),
***************
*** 165,171 ****
#Process Characters
elif PymeraseType.isChar(type):
html = util.insertInputBox(html,
! attribute.getFriendlyName(),
! attribute.getName(),
PymeraseType.getVarcharLen(type),
PymeraseType.getVarcharLen(type),
--- 173,180 ----
#Process Characters
elif PymeraseType.isChar(type):
+ #FIXME: first attribute.getName(...) should be getFriendlyName
html = util.insertInputBox(html,
! attribute.getName(TRANSLATOR_NAME),
! attribute.getName(TRANSLATOR_NAME),
PymeraseType.getVarcharLen(type),
PymeraseType.getVarcharLen(type),
***************
*** 173,193 ****
#Process Boolean
elif type == "boolean":
! html = util.insertBooleanRadio(html, attribute.getName())
#Process Time Stamps
elif type == "timestamp with time zone":
html = util.insertDatetime(html,
! attribute.getFriendlyName(),
! attribute.getName(),
notNull=attribute.isRequired())
#Write out what is not being handled.
else:
print "Table(%s), Type(%s), Attribute(%s) not processed." % \
! (tbl.getName(),
type,
! attribute.getName())
#Write html template to file
! util.saveHtml(html, filename)
print os.linesep \
--- 182,203 ----
#Process Boolean
elif type == "boolean":
! html = util.insertBooleanRadio(html, attribute.getName(TRANSLATOR_NAME))
#Process Time Stamps
elif type == "timestamp with time zone":
+ #FIXME: first attribute.getName(...) should be getFriendlyName
html = util.insertDatetime(html,
! attribute.getName(TRANSLATOR_NAME),
! attribute.getName(TRANSLATOR_NAME),
notNull=attribute.isRequired())
#Write out what is not being handled.
else:
print "Table(%s), Type(%s), Attribute(%s) not processed." % \
! (tbl.getName(TRANSLATOR_NAME),
type,
! attribute.getName(TRANSLATOR_NAME))
#Write html template to file
! util.saveHtml(html, filePath)
print os.linesep \
|
|
From: <ki...@us...> - 2002-12-11 17:32:18
|
Update of /cvsroot/pymerase/pymerase/util
In directory sc8-pr-cvs1:/tmp/cvs-serv3191
Modified Files:
PymeraseType.py
Log Message:
updated for xmi use
Index: PymeraseType.py
===================================================================
RCS file: /cvsroot/pymerase/pymerase/util/PymeraseType.py,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** PymeraseType.py 19 Nov 2002 00:50:08 -0000 1.7
--- PymeraseType.py 11 Dec 2002 17:32:15 -0000 1.8
***************
*** 54,58 ****
"""
print type
! match = re.search('character varying', type)
if match != None:
return 1
--- 54,58 ----
"""
print type
! match = re.search('varchar', type)
if match != None:
return 1
***************
*** 65,70 ****
"""
print type
! match1 = re.search('character varying', type)
! match2 = re.search('character', type)
if match1 == None and match2 != None:
return 1
--- 65,70 ----
"""
print type
! match1 = re.search('varchar', type)
! match2 = re.search('char', type)
if match1 == None and match2 != None:
return 1
|
|
From: <ki...@us...> - 2002-12-11 17:30:47
|
Update of /cvsroot/pymerase/pymerase
In directory sc8-pr-cvs1:/tmp/cvs-serv2557
Modified Files:
ClassMembers.py
Log Message:
updated getAll util inheritance functions for namemangling
Index: ClassMembers.py
===================================================================
RCS file: /cvsroot/pymerase/pymerase/ClassMembers.py,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** ClassMembers.py 19 Nov 2002 00:53:11 -0000 1.11
--- ClassMembers.py 11 Dec 2002 17:30:43 -0000 1.12
***************
*** 23,27 ****
from util.iPymeraseUtil import getClassByName
! def getBasePrimaryKeyName(tables, tbl):
"""
Takes a list of all the table objects and a tbl object which you would like
--- 23,27 ----
from util.iPymeraseUtil import getClassByName
! def getBasePrimaryKeyName(tables, tbl, TRANSLATOR_NAME):
"""
Takes a list of all the table objects and a tbl object which you would like
***************
*** 34,38 ****
return tbl.getBasePrimaryKeyName()
! def getAllAttributes(tables, tbl):
"""
Takes a list of all the table objects, and a tbl object which you would like
--- 34,38 ----
return tbl.getBasePrimaryKeyName()
! def getAllAttributes(tables, tbl, TRANSLATOR_NAME):
"""
Takes a list of all the table objects, and a tbl object which you would like
***************
*** 42,47 ****
"""
atts = []
! if len(tbl.getBaseClassNames()) > 0:
! for tblName in tbl.getBaseClassNames():
atts += getAllAttributes(tables, getClassByName(tables, tblName))
atts += tbl.getAttributes()
--- 42,47 ----
"""
atts = []
! if len(tbl.getBaseClassNames(TRANSLATOR_NAME)) > 0:
! for tblName in tbl.getBaseClassNames(TRANSLATOR_NAME):
atts += getAllAttributes(tables, getClassByName(tables, tblName))
atts += tbl.getAttributes()
***************
*** 51,55 ****
return atts
! def getAllAssociations(tables, tbl):
"""
Takes a list of all the table objects, and a tbl object which you would like
--- 51,55 ----
return atts
! def getAllAssociations(tables, tbl, TRANSLATOR_NAME):
"""
Takes a list of all the table objects, and a tbl object which you would like
***************
*** 60,65 ****
"""
assoc = []
! if len(tbl.getBaseClassNames()) > 0:
! for tblName in tbl.getBaseClassNames():
assoc += getAllAssociations(tables, getClassByName(tables, tblName))
assoc += tbl.getAssociations()
--- 60,65 ----
"""
assoc = []
! if len(tbl.getBaseClassNames(TRANSLATOR_NAME)) > 0:
! for tblName in tbl.getBaseClassNames(TRANSLATOR_NAME):
assoc += getAllAssociations(tables, getClassByName(tables, tblName))
assoc += tbl.getAssociations()
|
|
From: <de...@us...> - 2002-12-09 22:14:31
|
Update of /cvsroot/pymerase/pymerase/examples/xmiSchool
In directory sc8-pr-cvs1:/tmp/cvs-serv25844
Modified Files:
school.zargo
Added Files:
TestSchool.py createdb.sql data.sql
Log Message:
commit latest test code for xmi based school example.
--- NEW FILE: TestSchool.py ---
#!/usr/bin/env python
from __future__ import nested_scopes
import copy
import sys
import os
import string
import unittest
# CHANGE TO HOST RUNNING POSTGRESQL
host='localhost'
database='school_d0'
# import components needed to build the sql & api
# FIXME: need to set path to pymerase code
#sys.path.append(os.path.abspath(".."))
import pymerase
from util import NameMangling
# import code to use api
from mx import DateTime
def getHouses(session):
"""Returns dictionary of houses indexed by house name
"""
houses_list = session.getAllObjects(session.Houses)
houses = {}
for h in houses_list:
houses[string.lower(h.getName())] = h
return houses
def getFaculty(session):
"""Returns dictionary of houses indexed by professor
"""
prof_list = session.getAllObjects(session.Faculty)
faculty = {}
for p in prof_list:
faculty[string.lower(p.getGivenName())] = p
return faculty
def getEmployee(session, givenName):
givenNameQuery = "%s = '%s'" % (givenNameFieldName, givenName)
employees = session.getObjectsWhere(session.Employees, givenNameQuery)
return employees
class CreatePyGenexTestCases(unittest.TestCase):
def setUp(self):
"""Perform setup
"""
pass
def tearDown(self):
"""Clean up after ourselves.
"""
pass
def testCreate_underscore_API(self):
"""Test generating python api with the sql part using underscore_word.
"""
# Figure out path information
schema = os.path.abspath("./schema")
api_output = os.path.abspath("./school")
sql_output = os.path.abspath("./school.sql")
# construct pymerase object
translator = pymerase.Pymerase()
translator.setDefaultPackage("school")
# set mangler convetion
#mangler = NameMangling.underscore_word()
#translator.setNameMangler(mangler, 'CreateSQL')
# do the translation
parsed_input = translator.read(schema, 'parseGenexSchemaXML')
translator.write(parsed_input, api_output, 'CreateDBAPI')
translator.write(parsed_input, sql_output, 'CreateSQL')
# one of the later tests needs to know what the actual field name is
global givenNameFieldName
givenNameFieldName="given_name"
global dataSourceName
dataSourceName = "data.sql"
def testCreateCapsAPI(self):
"""Test generating python api with the sql part using CapWord.
"""
# Figure out path information
schema = os.path.abspath("./schema")
api_output = os.path.abspath("./school")
sql_output = os.path.abspath("./school.sql")
# construct pymerase object
translator = pymerase.Pymerase()
translator.setDefaultPackage("school")
# set mangler convetion
mangler = NameMangling.CapWord()
translator.setNameMangler(mangler, 'CreateSQL')
# do the translation
parsed_input = translator.read(schema, 'parseGenexSchemaXML')
translator.write(parsed_input, api_output, 'CreateDBAPI')
translator.write(parsed_input, sql_output, 'CreateSQL')
# one of the later tests needs to know what the actual field name is
global givenNameFieldName
givenNameFieldName='"GivenName"'
global dataSourceName
dataSourceName = "dataCapWord.sql"
def testCreateDB(self):
"""Construct the set of commands needed to tell postgresql to load data
"""
createDBName = "createdb.sql"
createdb = open(createDBName, "w")
createDBText = []
createDBText.append("drop database school_d0;")
createDBText.append("create database school_d0;")
createDBText.append("\c school_d0")
createDBText.append("\i school.sql")
createDBText.append("\i %s" % (dataSourceName))
createdb.write(string.join(createDBText, os.linesep))
createdb.close()
os.system("psql -h %s -f createdb.sql template1" % (host))
#os.remove(createDBName)
def testReadObject(self):
import school
s = school.DBSession(host, database)
# grab by primary key and make sure it's our first example student
ann = s.Students(4)
self.failUnless(ann.getGivenName() == 'Ann')
self.failUnless(ann.getFamilyName() == 'Arbor')
self.failUnless(ann.getHousesFk() == 1)
#self.failUnless(ann.getAdvisorFk() == 2)
self.failUnless(ann.getPeopleFk() == 2)
# try to read inherited object via class factory
zaphod = s.Faculty(3)
self.failUnless(zaphod.getGivenName() == 'Zaphod')
self.failUnless(zaphod.getFamilyName() == 'Zim')
self.failUnless(zaphod.getStatus() == 'Full')
# The initial load of data installs 4 example students
students = s.getAllObjects(school.Students.Students)
self.failUnless(len(students) == 4)
def testReadOneToOneLink(self):
import school
s = school.DBSession(host, database)
daria = s.Students(7)
# FIXME: this should read advisor
advisors = daria.getAdvisor()
house = daria.getHouse()
self.failUnless(len(advisors) == 1)
#self.failUnless(advisors[0].getUid() == 2)
self.failUnless(advisors[0].getPeoplePk() == 2)
self.failUnless(advisors[0].getGivenName() == 'Yolanda')
self.failUnless(advisors[0].getFamilyName() == 'Yetti')
self.failUnless(len(house) == 1)
print house[0].getName()
self.failUnless(house[0].getName() == 'Lloyd')
def testReadManyToOneLink(self):
import school
s = school.DBSession(host, database)
houses = getHouses(s)
darbs = houses['dabney'].getStudents()
self.failUnless(len(darbs) == 1)
self.failUnless(darbs[0].getGivenName() == "Ben")
self.failUnless(darbs[0].getFamilyName() == "Blartfast")
def testReadManyToManyLink(self):
pass
def testOneToOneInsert(self):
import school
s = school.DBSession(host, database)
houses = getHouses(s)
faculty = getFaculty(s)
#erin = Students(db_session=s)
erin = s.Students()
erin.setGivenName("Erin")
erin.setFamilyName("Ericsson")
erin.setHouse(houses['page'])
# FIXME: we should be able to commit this and then add more information
# FIXME: but that doesn't work
# erin.commit()
faculty['yolanda'].appendStudents(erin)
faculty['yolanda'].commit()
#erin_list = s.getObjectsWhere(s.Students, "\"GivenName\" = 'Erin'")
givenNameQuery = "%s = 'Erin'" % ( givenNameFieldName )
erin_list = s.getObjectsWhere(s.Students, givenNameQuery)
self.failUnless(len(erin_list) == 1)
erin_loaded = erin_list[0]
print "erin: %s, %s" % (erin.id(), erin_loaded.id())
self.failUnless(erin.id() == erin_loaded.id())
self.failUnless(erin.getGivenName() == erin_loaded.getGivenName())
self.failUnless(erin.getFamilyName() == erin_loaded.getFamilyName())
self.failUnless(erin.getHousesFk() == erin_loaded.getHousesFk())
#self.failUnless(erin.getAdvisorFk() == erin_loaded.getAdvisorFk())
self.failUnless(erin.getPeopleFk() == erin_loaded.getPeopleFk())
frederick = s.Students()
frederick.setGivenName("Frederick")
frederick.setFamilyName("Fergison")
frederick.setHouse(houses['ricketts'])
faculty['zaphod'].appendStudents(frederick)
faculty['zaphod'].commit()
#frederick_list = s.getObjectsWhere(s.Students,
# "\"GivenName\" = 'Frederick'")
givenNameQuery = "%s = 'Frederick'" % (givenNameFieldName)
frederick_list = s.getObjectsWhere(s.Students, givenNameQuery)
self.failUnless(len(frederick_list) == 1)
frederick_loaded = frederick_list[0]
self.failUnless(frederick.id() == frederick_loaded.id(),
"frederick primary key failure %s != %s" % (frederick.id(),
frederick_loaded.id()))
self.failUnless(frederick.getGivenName() == frederick_loaded.getGivenName())
self.failUnless(frederick.getFamilyName()==frederick_loaded.getFamilyName())
self.failUnless(frederick.getHousesFk() == frederick_loaded.getHousesFk())
#self.failUnless(frederick.getAdvisorFk() == frederick_loaded.getAdvisorFk())
self.failUnless(frederick.getPeopleFk() == frederick_loaded.getPeopleFk())
def testManyToOneInsert(self):
import school
s = school.DBSession(host, database)
charles = s.Students(6)
daria = s.Students(7)
bi188 = s.Courses(2)
classes = s.Classes()
classes.setCourses(bi188)
classes.setStudents(charles)
classes.setTerm(DateTime.DateTime(2002,04,01))
classes.commit()
classes = s.Classes()
classes.setCourses(bi188)
classes.setStudents(daria)
classes.setTerm(DateTime.DateTime(2002,04,01))
classes.commit()
def testTreeInsert(self):
import school
def checkEmployee(session, givenName):
e = getEmployee(session, givenName)
self.failUnless(len(e) == 1)
return e[0]
s = school.DBSession(host, database)
diane = checkEmployee(s, "diane")
kevin = checkEmployee(s, "kevin")
jason = checkEmployee(s, "jason")
amanda = checkEmployee(s, "amanda")
yolanda = checkEmployee(s, "Yolanda")
#yolanda.appendManaged(amanda)
diane.setManager(yolanda)
kevin.setManager(diane)
amanda.setManager(yolanda)
diane.commit()
kevin.commit()
jason.setManager(yolanda)
jason.commit()
amanda.commit()
yolanda.commit()
def testTreeRetrieval(self):
import school
s = school.DBSession(host, database)
yolanda = getEmployee(s, "Yolanda")[0]
managedList = yolanda.getManaged()
self.failUnless(len(managedList) == 3)
diane = filter(lambda x: x.getGivenName() == 'diane', managedList)[0]
managedByDiane = diane.getManaged()
self.failUnless(len(managedByDiane) == 1)
kevin = managedByDiane[0]
self.failUnless(kevin.getGivenName() == 'kevin')
kevinManager = kevin.getManager()[0]
self.failUnless(kevinManager.getGivenName() == diane.getGivenName())
amanda = filter(lambda x: x.getGivenName() == 'amanda', managedList)[0]
amandaDirect = getEmployee(s, "amanda")[0]
self.failUnless(amanda.getGivenName() == amandaDirect.getGivenName())
self.failUnless(amanda.getFamilyName() == amandaDirect.getFamilyName())
def suite():
suite = unittest.TestSuite()
#if 1:
# # Test with underscores for sql variables
# suite.addTest(CreatePyGenexTestCases("testCreate_underscore_API"))
#else:
# # Test with CapsWord for sql variables
# suite.addTest(CreatePyGenexTestCases("testCreateCapsAPI"))
#
global givenNameFieldName
givenNameFieldName="given_name"
global dataSourceName
dataSourceName = "data.sql"
suite.addTest(CreatePyGenexTestCases("testCreateDB"))
suite.addTest(CreatePyGenexTestCases("testReadObject"))
suite.addTest(CreatePyGenexTestCases("testReadOneToOneLink"))
suite.addTest(CreatePyGenexTestCases("testReadManyToOneLink"))
suite.addTest(CreatePyGenexTestCases("testReadManyToManyLink"))
suite.addTest(CreatePyGenexTestCases("testOneToOneInsert"))
suite.addTest(CreatePyGenexTestCases("testManyToOneInsert"))
# ##suite.addTest(CreatePyGenexTestCases("testTreeInsert"))
# ##suite.addTest(CreatePyGenexTestCases("testTreeRetrieval"))
return suite
if __name__ == "__main__":
unittest.main(defaultTest="suite")
--- NEW FILE: createdb.sql ---
drop database school_d0;
create database school_d0;
\c school_d0
\i school.sql
\i data.sql
--- NEW FILE: data.sql ---
-- define some faculty
insert into faculty (given_name, family_name, status)
values ('Xavier', 'Xal', 'Associate');
insert into faculty (given_name, family_name, status)
values ('Yolanda', 'Yetti', 'Visiting');
insert into faculty (given_name, family_name, status)
values ('Zaphod', 'Zim', 'Full');
-- Define houses
insert into houses (name) values ('Blacker');
insert into houses (name) values ('Dabney');
insert into houses (name) values ('Flemming');
insert into houses (name) values ('Lloyd');
insert into houses (name) values ('Page');
insert into houses (name) values ('Ricketts');
insert into houses (name) values ('Ruddock');
-- Define some students
insert into students (given_name, family_name, houses_fk, people_fk)
values ('Ann', 'Arbor', 1, 2);
insert into students (given_name, family_name, houses_fk, people_fk)
values ('Ben', 'Blartfast', 2, 1);
insert into students (given_name, family_name, houses_fk, people_fk)
values ('Charles', 'Cooper', 3, 3);
insert into students (given_name, family_name, houses_fk, people_fk)
values ('Daria', 'Darwin', 4, 2);
-- Define some courses
insert into Courses (catalogid, description)
values ('Bi/CS 164', 'Lecture,');
-- discussion, and projects in bioinformatics. Students will create, extend, and integrate bioinformatic software tools. Topics include genome-scale mRNA expression analysis, signal transduction pathway modeling, genome database analysis tools, and modeling morphogenesis from gene expression patterns. Each project will link into a larger Web application framework.');
insert into Courses (catalogid, description)
values ('Bi 188', 'Introduction');
-- to the genetics of humans. Subjects covered include human genome structure, genetic diseases and predispositions, the human genome project, forensic use of human genetic markers, human variability, and human evolution.');
-- put some students into some classes
insert into classes (people_fk, courses_fk, term, grade)
values (1, 1, '2002-04-01', 3.3);
insert into classes (people_fk, courses_fk, term, grade)
values (2, 1, '2002-04-01', 3.0);
-- Insert an employee
insert into staff (given_name, family_name, description)
values ('diane', 'trout', 'code monkey');
insert into staff (given_name, family_name, description)
values ('kevin', 'kooper', 'lab tech');
insert into staff (given_name, family_name, description)
values ('jason', 'jackson', 'research assistant');
insert into staff (given_name, family_name, description)
values ('amanda', 'jones', 'post doc');
Index: school.zargo
===================================================================
RCS file: /cvsroot/pymerase/pymerase/examples/xmiSchool/school.zargo,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
Binary files /tmp/cvsHwut5S and /tmp/cvsQqIP1B differ
|
|
From: <ki...@us...> - 2002-12-09 19:28:40
|
Update of /cvsroot/pymerase/pymerase In directory sc8-pr-cvs1:/tmp/cvs-serv29769 Modified Files: README Log Message: Added note about GUI not working under Jython currently. Index: README =================================================================== RCS file: /cvsroot/pymerase/pymerase/README,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** README 15 Sep 2002 06:42:59 -0000 1.4 --- README 9 Dec 2002 19:28:37 -0000 1.5 *************** *** 15,19 **** 1) Command line --> run 'pymerase.py --help' for options ! 2) GUI --> run 'tkPymerase.py' 3) Driver Program --> --- 15,19 ---- 1) Command line --> run 'pymerase.py --help' for options ! 2) GUI --> run 'tkPymerase.py' (currently does not work in Jython) 3) Driver Program --> |