Author: nunofsantos
Date: 2007-11-21 16:20:12 -0500 (Wed, 21 Nov 2007)
New Revision: 1354
Modified:
mgmt/mint/schemaparser.py
Log:
make a few variable names more meaningful
Modified: mgmt/mint/schemaparser.py
===================================================================
--- mgmt/mint/schemaparser.py 2007-11-21 21:08:58 UTC (rev 1353)
+++ mgmt/mint/schemaparser.py 2007-11-21 21:20:12 UTC (rev 1354)
@@ -10,10 +10,10 @@
self.style = MixedCaseUnderscoreStyle()
self.pythonOutput = "from sqlobject import *\n"
self.pythonOutput += "from datetime import datetime\n"
- self.additional = ""
+ self.additionalPythonOutput = ""
self.currentClass = ""
- self.final = "\nclassToSchemaNameMap = dict()\n"
- self.final += "schemaNameToClassMap = dict()\n"
+ self.finalPythonOutput = "\nclassToSchemaNameMap = dict()\n"
+ self.finalPythonOutput += "schemaNameToClassMap = dict()\n"
self.pythonOutput += "conn = connectionForURI(\"%s\")\n" %
(self.options["dsn"])
self.pythonOutput += "sqlhub.processConnection = conn\n\n"
# mapping between xml schema types and database column types
@@ -52,7 +52,7 @@
def generateMultipleJoin(self, tableFrom, tableTo):
attrib = tableTo.lower() + "s"
- self.additional += "\n%s.sqlmeta.addJoin(MultipleJoin('%s',
joinMethodName='%s'))\n" % (tableFrom, tableTo, attrib)
+ self.additionalPythonOutput += "\n%s.sqlmeta.addJoin(MultipleJoin('%s',
joinMethodName='%s'))\n" % (tableFrom, tableTo, attrib)
def generateClassAttribs(self, schemaName, elements):
for elem in elements:
@@ -91,8 +91,8 @@
self.generateAttrib("managedBroker", "StringCol",
"length=1000")
self.generateForeignKeyAttrib("stats", statsPythonName)
self.generateForeignKeyAttrib("statsPrev", statsPythonName)
- self.final += "classToSchemaNameMap['%s'] = '%s'\n" %
(pythonName, schemaName)
- self.final += "schemaNameToClassMap['%s'] = %s\n" % (schemaName,
pythonName)
+ self.finalPythonOutput += "classToSchemaNameMap['%s'] =
'%s'\n" % (pythonName, schemaName)
+ self.finalPythonOutput += "schemaNameToClassMap['%s'] = %s\n" %
(schemaName, pythonName)
def generateMethod(self, elem):
if (elem["@desc"] != None):
@@ -117,9 +117,9 @@
self.pythonOutput += "args=actualArgs, packageName=\"qpid\")\n"
def endClass(self):
- if (self.additional != ""):
- self.pythonOutput += self.additional + "\n"
- self.additional = ""
+ if (self.additionalPythonOutput != ""):
+ self.pythonOutput += self.additionalPythonOutput + "\n"
+ self.additionalPythonOutput = ""
if (self.pythonOutput.endswith("(SQLObject):\n")):
self.pythonOutput += " pass\n"
self.currentClass = ""
@@ -143,7 +143,7 @@
self.startClass(cls["@name"], stats=True)
self.generateClassAttribs(cls["@name"],
cls.query["instElement"])
self.endClass()
- outputFile.write(self.pythonOutput + self.final)
+ outputFile.write(self.pythonOutput + self.finalPythonOutput)
outputFile.close()
Show replies by date