本文整理匯總了Python中ZenModelRM.ZenModelRM.checkValidId方法的典型用法代碼示例。如果您正苦於以下問題:Python ZenModelRM.checkValidId方法的具體用法?Python ZenModelRM.checkValidId怎麽用?Python ZenModelRM.checkValidId使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類ZenModelRM.ZenModelRM
的用法示例。
在下文中一共展示了ZenModelRM.checkValidId方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: checkValidId
# 需要導入模塊: from ZenModelRM import ZenModelRM [as 別名]
# 或者: from ZenModelRM.ZenModelRM import checkValidId [as 別名]
def checkValidId(self, id, prep_id = False):
"""Checks a valid id
"""
if len(id) > 128:
return 'Command definition names can not be longer than 128 characters.'
allowed = set(string.ascii_letters + string.digits + '_')
attempted = set(id)
if not attempted.issubset(allowed):
return 'Only letters, digits and underscores are allowed' + \
' in command definition names.'
return ZenModelRM.checkValidId(self, id, prep_id)
示例2: checkValidId
# 需要導入模塊: from ZenModelRM import ZenModelRM [as 別名]
# 或者: from ZenModelRM.ZenModelRM import checkValidId [as 別名]
def checkValidId(self, id, prep_id = False):
"""Checks a valid id
"""
# RRD docs say that limit on vnames is 255 characters and that
# A-Za-z0-9_ are the valid characters. Zenoss reserves - for it's own
# use. Limiting to 200 instead just to leave room for whatever.
# http://oss.oetiker.ch/rrdtool/doc/rrdgraph_data.en.html
if len(id) > 200:
return 'GraphPoint names can not be longer than 200 characters.'
allowed = set(string.ascii_letters + string.digits + '_')
attempted = set(id)
if not attempted.issubset(allowed):
return 'Only letters, digits and underscores are allowed' + \
' in GraphPoint names.'
return ZenModelRM.checkValidId(self, id, prep_id)