|
From: <de...@us...> - 2003-09-10 02:08:13
|
Update of /cvsroot/pymerase/pymerase/pymerase/input
In directory sc8-pr-cvs1:/tmp/cvs-serv10492
Modified Files:
parseGenexSchemaXML.py
Log Message:
Make model attributes private.
Add support for knowing which association end has the foreign key.
Index: parseGenexSchemaXML.py
===================================================================
RCS file: /cvsroot/pymerase/pymerase/pymerase/input/parseGenexSchemaXML.py,v
retrieving revision 1.30
retrieving revision 1.31
diff -C2 -d -r1.30 -r1.31
*** parseGenexSchemaXML.py 21 Jun 2003 01:34:27 -0000 1.30
--- parseGenexSchemaXML.py 10 Sep 2003 02:08:09 -0000 1.31
***************
*** 40,53 ****
self.config = pymeraseConfig
! self.attributes = {}
for k, v in attributes.items():
! self.attributes[k] = v
def getName(self, translatorName):
! return self.attributes[u"name"]
def getColumnName(self, translatorName):
mangler = self.config.getNameMangler(translatorName)
! return mangler.mangle(self.attributes[u"column_id"])
--- 40,53 ----
self.config = pymeraseConfig
! self.__attributes = {}
for k, v in attributes.items():
! self.__attributes[k] = v
def getName(self, translatorName):
! return self.__attributes[u"name"]
def getColumnName(self, translatorName):
mangler = self.config.getNameMangler(translatorName)
! return mangler.mangle(self.__attributes[u"column_id"])
***************
*** 56,68 ****
"""
def __init__(self, attributes):
! self.attributes = {}
for k, v in attributes.items():
! self.attributes[k] = v
def getUser(self):
! return self.attributes[u"user"]
def getPrivilege(self):
! return self.attributes[u"privileges"]
#class ERAssociation(Association):
--- 56,68 ----
"""
def __init__(self, attributes):
! self.__attributes = {}
for k, v in attributes.items():
! self.__attributes[k] = v
def getUser(self):
! return self.__attributes[u"user"]
def getPrivilege(self):
! return self.__attributes[u"privileges"]
#class ERAssociation(Association):
***************
*** 72,83 ****
# def __init__(self, pymeraseConfig, name=None):
# Association.__init__(self, pymeraseConfig, name)
! # self.targetAttributeName = None
#
# def setTargetAttributeName(self, value):
! # self.targetAttributeName = value
#
# def getTargetAttributeName(self, translatorName):
# mangler = self.config.getNameMangler(translatorName)
! # return mangler.mangle(self.targetAttributeName)
#
class ERClassAttribute(ClassAttribute):
--- 72,83 ----
# def __init__(self, pymeraseConfig, name=None):
# Association.__init__(self, pymeraseConfig, name)
! # self.__targetAttributeName = None
#
# def setTargetAttributeName(self, value):
! # self.__targetAttributeName = value
#
# def getTargetAttributeName(self, translatorName):
# mangler = self.config.getNameMangler(translatorName)
! # return mangler.mangle(self.__targetAttributeName)
#
class ERClassAttribute(ClassAttribute):
***************
*** 86,110 ****
def __init__(self, pymeraseConfig, name=None):
ClassAttribute.__init__(self, pymeraseConfig, name)
! self.indexed = 0
# FIXME: Do we need to know that a field is indexed
# FIXME: if we also keep a list of ERIndex classes?
def setIndexed(self, value):
! self.indexed = parseBoolValue(value)
def isIndexed(self):
! return self.indexed
class ERClassMetaInfo(ClassMetaInfo):
def __init__(self, pymeraseConfig, name=None):
ClassMetaInfo.__init__(self, pymeraseConfig, name)
! self.autoSequence = 0
! self.indicies = []
! self.security = []
def setAutoSequence(self, value):
"""set flag to indicate if the dbAPI should auto-create primary key values
"""
! self.autoSequence = parseBoolValue(value)
def isAutoSequence(self):
--- 86,110 ----
def __init__(self, pymeraseConfig, name=None):
ClassAttribute.__init__(self, pymeraseConfig, name)
! self.__indexed = 0
# FIXME: Do we need to know that a field is indexed
# FIXME: if we also keep a list of ERIndex classes?
def setIndexed(self, value):
! self.__indexed = parseBoolValue(value)
def isIndexed(self):
! return self.__indexed
class ERClassMetaInfo(ClassMetaInfo):
def __init__(self, pymeraseConfig, name=None):
ClassMetaInfo.__init__(self, pymeraseConfig, name)
! self.__autoSequence = 0
! self.__indicies = []
! self.__security = []
def setAutoSequence(self, value):
"""set flag to indicate if the dbAPI should auto-create primary key values
"""
! self.__autoSequence = parseBoolValue(value)
def isAutoSequence(self):
***************
*** 112,116 ****
values
"""
! return self.autoSequence
def appendIndices(self, pymeraseConfig, attributes):
--- 112,116 ----
values
"""
! return self.__autoSequence
def appendIndices(self, pymeraseConfig, attributes):
***************
*** 120,124 ****
# check to see if the field is going to automatically get an index
column_name = index.getColumnName(None)
! column_field = self.attributes.get(column_name, None)
if column_field is not None :
if column_field.isUnique():
--- 120,124 ----
# check to see if the field is going to automatically get an index
column_name = index.getColumnName(None)
! column_field = self.__attributes.get(column_name, None)
if column_field is not None :
if column_field.isUnique():
***************
*** 131,135 ****
DebugWarning)
# tag field as being indexed, and append it to the list of indexes.
! self.indices.append(index)
--- 131,135 ----
DebugWarning)
# tag field as being indexed, and append it to the list of indexes.
! self.__indices.append(index)
***************
*** 138,142 ****
"""
# Override default that throws an unimplemented error
! self.security.append(ERSecurity(attributes))
def parseGenexFKeyType(fkey_type, tableName):
--- 138,142 ----
"""
# Override default that throws an unimplemented error
! self.__security.append(ERSecurity(attributes))
def parseGenexFKeyType(fkey_type, tableName):
***************
*** 367,371 ****
thisEnd.setAttributeName(attributes.get('column_id', None))
thisEnd.setNavigable(1)
!
# construct other end
otherAssociationEnds = otherEndType.getAssociationEnds()
--- 367,372 ----
thisEnd.setAttributeName(attributes.get('column_id', None))
thisEnd.setNavigable(1)
! thisEnd.setHasForeignKey(1)
!
# construct other end
otherAssociationEnds = otherEndType.getAssociationEnds()
|