|
From: <ki...@us...> - 2003-05-30 01:15:06
|
Update of /cvsroot/pymerase/pymerase/pymerase/output
In directory sc8-pr-cvs1:/tmp/cvs-serv19458
Modified Files:
CreatePyTkWidgets.py
Log Message:
changed print statements to warning system
added code to make sure a list has at least one element in it before accessing it.
Index: CreatePyTkWidgets.py
===================================================================
RCS file: /cvsroot/pymerase/pymerase/pymerase/output/CreatePyTkWidgets.py,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -d -r1.15 -r1.16
*** CreatePyTkWidgets.py 8 Apr 2003 22:42:26 -0000 1.15
--- CreatePyTkWidgets.py 30 May 2003 00:53:45 -0000 1.16
***************
*** 46,49 ****
--- 46,54 ----
from pymerase.ClassMembers import getAllAssociationEnds
+ from pymerase.util.Warnings import DebugWarning
+ from pymerase.util.Warnings import InfoWarning
+ import warnings
+ from warnings import warn
+
############################
# Globals
***************
*** 83,87 ****
os.mkdir(destination)
elif os.path.isdir(destination) == 0:
! print "%s exists but is not a directory." % (destination)
sys.exit(2)
--- 88,93 ----
os.mkdir(destination)
elif os.path.isdir(destination) == 0:
! warn("%s exists but is not a directory." % (destination),
! RuntimeWarning)
sys.exit(2)
***************
*** 102,107 ****
filesToCopy = glob.glob(search)
! print ""
! print "--Copying Lib Files--"
for file in filesToCopy:
filePath, fileName = os.path.split(file)
--- 108,113 ----
filesToCopy = glob.glob(search)
! warn("--Copying Lib Files--", InfoWarning)
!
for file in filesToCopy:
filePath, fileName = os.path.split(file)
***************
*** 110,118 ****
#If not a template file, copy
if file not in template_files:
! print '%s' % (fileName)
shutil.copyfile(file, fileDest)
#Else, add information, then copy
else:
! print '%s' % (fileName)
f = open(file, 'r')
newFile = re.sub('%DBAPI%', templateDict['%DBAPI%'], f.read())
--- 116,124 ----
#If not a template file, copy
if file not in template_files:
! warn('%s' % (fileName), DebugWarning)
shutil.copyfile(file, fileDest)
#Else, add information, then copy
else:
! warn('%s' % (fileName), DebugWarning)
f = open(file, 'r')
newFile = re.sub('%DBAPI%', templateDict['%DBAPI%'], f.read())
***************
*** 123,128 ****
df.close()
! print "--Done--"
! print ""
--- 129,134 ----
df.close()
! warn("--Done--", InfoWarning)
!
***************
*** 158,162 ****
#FIXME: Needs to be updated when full packages support is
# added to pymerase.
! apiName = classList[0].getPackage()
templateDict['%DBAPI%'] = apiName
--- 164,171 ----
#FIXME: Needs to be updated when full packages support is
# added to pymerase.
! if len(classList) >= 1:
! apiName = classList[0].getPackage()
! else:
! raise ValueError, 'ERROR, len(classList) < 1'
templateDict['%DBAPI%'] = apiName
***************
*** 197,206 ****
type = "FK"
! print "Processing(%s:%s)" % (myClass.getName(TRANSLATOR_NAME), type)
! print " CapsWord: %s; English: %s" % (myClass.getName(DBAPI_TRANSLATOR),
! myClass.getName(TRANSLATOR_NAME))
#Process Primary keys
if attrib.isPrimaryKey() or type == "serial":
! print 'Ignoring Primary Key'
#Process Foreign Keys
--- 206,217 ----
type = "FK"
! warn("Processing(%s:%s)" % (myClass.getName(TRANSLATOR_NAME), type),
! DebugWarning)
! warn(" CapsWord: %s; English: %s" % (myClass.getName(DBAPI_TRANSLATOR),
! myClass.getName(TRANSLATOR_NAME)),
! DebugWarning)
#Process Primary keys
if attrib.isPrimaryKey() or type == "serial":
! warn('Ignoring Primary Key', InfoWarning)
#Process Foreign Keys
***************
*** 259,263 ****
code)
elif type == "name":
! print "FIXME: Ignoring name type"
#Process Text
elif type == "text":
--- 270,274 ----
code)
elif type == "name":
! warn("FIXME: Ignoring 'name' type", InfoWarning)
#Process Text
elif type == "text":
***************
*** 322,335 ****
#Process Time Stamps
elif type == "timestamp with time zone":
! print "FIXME: Ignoring timestamp"
#Write out what is not being handled.
else:
! print ""
! print "Table(%s), Type(%s), Attribute(%s) not processed." % \
(myClass.getName(TRANSLATOR_NAME),
type,
! attrib.getName(TRANSLATOR_NAME))
! print "Please e-mail the above line to pym...@li..."
! print ""
--- 333,345 ----
#Process Time Stamps
elif type == "timestamp with time zone":
! warn("FIXME: Ignoring timestamp", InfoWarning)
#Write out what is not being handled.
else:
! warn("Table(%s), Type(%s), Attribute(%s) not processed.\n" \
! "Please e-mail the above line to pym...@li..." % \
(myClass.getName(TRANSLATOR_NAME),
type,
! attrib.getName(TRANSLATOR_NAME)),
! InfoWarning)
***************
*** 337,345 ****
assocList = myClass.getAssociationEnds().values()
! print "ASSOCIATION ENDS:"
for assocEnd in assocList:
! print " ", assocEnd.getAttributeName(DBAPI_TRANSLATOR)
! print " ", assocEnd.getName(DBAPI_TRANSLATOR)
! print "END ASSOCIATIONS"
#Remove '%*%'
--- 347,355 ----
assocList = myClass.getAssociationEnds().values()
! warn("ASSOCIATION ENDS:", DebugWarning)
for assocEnd in assocList:
! warn(" %s" % (assocEnd.getAttributeName(DBAPI_TRANSLATOR)), DebugWarning)
! warn(" %s" % (assocEnd.getName(DBAPI_TRANSLATOR)), DebugWarning)
! warn("END ASSOCIATIONS", DebugWarning)
#Remove '%*%'
***************
*** 356,360 ****
f.close()
! print os.linesep \
! + "Python Tkinter Widget Generation Complete... Good Bye." \
! + os.linesep
--- 366,368 ----
f.close()
! warn("Python Tkinter Widget Generation Complete... Good Bye.", InfoWarning)
|