Don't allow spaces in tag names
authorIustin Pop <iustin@google.com>
Mon, 2 Mar 2009 12:19:23 +0000 (12:19 +0000)
committerIustin Pop <iustin@google.com>
Mon, 2 Mar 2009 12:19:23 +0000 (12:19 +0000)
This patch restricts the use of spaces in tags, as this does not allow
nice exporting of tags to environment in hooks. One can use underscores
or dashes instead of spaces.

Reviewed-by: schreiberal

lib/objects.py

index 2fbdc58..aebe959 100644 (file)
@@ -179,7 +179,7 @@ class TaggableObject(ConfigObject):
                             constants.MAX_TAG_LEN)
     if not tag:
       raise errors.TagError("Tags cannot be empty")
-    if not re.match("^[ \w.+*/:-]+$", tag):
+    if not re.match("^[\w.+*/:-]+$", tag):
       raise errors.TagError("Tag contains invalid characters")
 
   def GetTags(self):