MCPcopy Create free account
hub / github.com/StackStorm/st2 / validate_pack_name

Function validate_pack_name

st2common/st2common/content/validators.py:41–58  ·  view source on GitHub ↗

Validate the content pack name. Throws Exception on invalid name. :param name: Content pack name to validate. :type name: ``str`` :rtype: ``str``

(name)

Source from the content-addressed store, hash-verified

39
40
41def validate_pack_name(name):
42 """
43 Validate the content pack name.
44
45 Throws Exception on invalid name.
46
47 :param name: Content pack name to validate.
48 :type name: ``str``
49
50 :rtype: ``str``
51 """
52 if not name:
53 raise ValueError("Content pack name cannot be empty")
54
55 if name.lower() in USER_PACK_NAME_BLACKLIST:
56 raise ValueError('Name "%s" is blacklisted and can\'t be used' % (name.lower()))
57
58 return name

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected