本文整理汇总了Python中mapper.Mapper.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python Mapper.__init__方法的具体用法?Python Mapper.__init__怎么用?Python Mapper.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mapper.Mapper
的用法示例。
在下文中一共展示了Mapper.__init__方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from mapper import Mapper [as 别名]
# 或者: from mapper.Mapper import __init__ [as 别名]
def __init__(self, dbName, dictClasses=None):
Mapper.__init__(self, dictClasses)
self.__initObjDict()
self.__initUpdateDict()
try:
self.db = SqliteObjectsDb(dbName)
except Exception, ex:
raise Exception("Error creating SqliteMapper, dbName: %s\n error: %s" % (dbName, ex))
示例2: __init__
# 需要导入模块: from mapper import Mapper [as 别名]
# 或者: from mapper.Mapper import __init__ [as 别名]
def __init__(self, dbName, dictClasses=None, tablePrefix=''):
Mapper.__init__(self, dictClasses)
self._objTemplate = None
try:
self.db = SqliteFlatDb(dbName, tablePrefix)
self.doCreateTables = self.db.missingTables()
if not self.doCreateTables:
self.__loadObjDict()
except Exception, ex:
raise Exception('Error creating SqliteFlatMapper, dbName: %s, tablePrefix: %s\n error: %s' % (dbName, tablePrefix, ex))
示例3: __init__
# 需要导入模块: from mapper import Mapper [as 别名]
# 或者: from mapper.Mapper import __init__ [as 别名]
def __init__(self, filename, dictClasses=None, rootName='ALL', **args):
self.filename = filename
if exists(filename):
self._read()
else:
self._create(rootName, **args)
Mapper.__init__(self, dictClasses)
# Objects map (id should be defined)
self.objDict = {}
# Store some objects during parsing
# that have some Pointer attributes and need to be fixed later
self.pendingPtrDict = {}
# This dictionary serve to define how to write classes
# for example if the pair 'Integer': 'attribute' is present
# all Integer will be store as attributes in the xml
# possible values are:
# 'attribute', 'class_only', 'class_name', 'name_class', 'name_only'
self.classTags = {}
# Counter to provide default objects id's
self.objCount = 0