Revision b5e5632e
b/lib/objects.py | ||
---|---|---|
210 | 210 |
|
211 | 211 |
""" |
212 | 212 |
__slots__ = ConfigObject.__slots__ + ["tags"] |
213 |
VALID_TAG_RE = re.compile("^[\w.+*/:@-]+$") |
|
213 | 214 |
|
214 |
@staticmethod
|
|
215 |
def ValidateTag(tag): |
|
215 |
@classmethod
|
|
216 |
def ValidateTag(cls, tag):
|
|
216 | 217 |
"""Check if a tag is valid. |
217 | 218 |
|
218 | 219 |
If the tag is invalid, an errors.TagError will be raised. The |
... | ... | |
226 | 227 |
constants.MAX_TAG_LEN) |
227 | 228 |
if not tag: |
228 | 229 |
raise errors.TagError("Tags cannot be empty") |
229 |
if not re.match("^[\w.+*/:-]+$", tag):
|
|
230 |
if not cls.VALID_TAG_RE.match(tag):
|
|
230 | 231 |
raise errors.TagError("Tag contains invalid characters") |
231 | 232 |
|
232 | 233 |
def GetTags(self): |
Also available in: Unified diff