|
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 \
|