本文整理汇总了Python中xen.xend.XendAPIStore.register方法的典型用法代码示例。如果您正苦于以下问题:Python XendAPIStore.register方法的具体用法?Python XendAPIStore.register怎么用?Python XendAPIStore.register使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类xen.xend.XendAPIStore
的用法示例。
在下文中一共展示了XendAPIStore.register方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from xen.xend import XendAPIStore [as 别名]
# 或者: from xen.xend.XendAPIStore import register [as 别名]
def __init__(self, uuid, record):
self.__uuid = uuid
# First check this class implements all the correct methods:
for attr_ro in self.getAttrRO() + self.getAttrRW():
if not hasattr(self, "get_%s" % attr_ro):
raise ImplementationError(self.getClass(),
"get_%s" % attr_ro)
for attr_rw in self.getAttrRW():
if not hasattr(self, "set_%s" % attr_rw):
raise ImplementationError(self.getClass(),
"set_%s" % attr_rw)
for method in self.getMethods():
if not hasattr(self, method):
raise ImplementationError(self.getClass(),
method)
for func in self.getFuncs():
if not hasattr(self.__class__, func):
raise ImplementationError(self.getClass(),
func)
# Next check that the class is being created with the correct
# parameters
if not isinstance(record, dict):
raise CreateUnspecifiedAttributeError(
"record" , self.getClass())
for attr_inst in self.getAttrInst():
if attr_inst not in record:
raise CreateUnspecifiedAttributeError(
attr_inst, self.getClass())
setattr(self, attr_inst, record[attr_inst])
# Finally register it
XendAPIStore.register(uuid, self.getClass(), self)