新增tag新增tag

Navigation:  Python > TagMgr类管理 > tagmgr模块 >

新增tag新增tag

Previous pageReturn to chapter overviewNext page

 

方法定义

 

add_tag(self, **attributes)

 

 

方法参数说明

参数名称

参数说明

参数类型

默认值

**attributes

属性字典,例如'tagname = 'python',tagtype = 'int8', descriptor = 'pythontest'等,其余属性参见hyperdb.TagProp,其中tagname和tagtype是必填项,其他可使用系统缺省值        

字典类型

 

 

异常

 

如果调用失败,抛出hyperdb.HDError异常

 

如果参数错误,抛出ArgumentError异常

 

返回值

 

hyperdb.hd_sucess

 

方法调用

 

def AddTag(self):

   attr = {'tagname': 'testtag', 'tagtype': 'int8'}

   try:

       self.myTagMgr.add_tag(**attr)

   except Exception as e:

       print("add_tag error: ", e.errcode)

   else:

       print("adding tag succeeds")