当前位置: 首页>>代码示例>>Python>>正文


Python XendAPIStore.register方法代码示例

本文整理汇总了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)
开发者ID:a2k2,项目名称:xen-unstable,代码行数:40,代码来源:XendBase.py


注:本文中的xen.xend.XendAPIStore.register方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。