diff --git a/cccli/tagdisplay.py b/cccli/tagdisplay.py index 3716268b711892469352ee3391556beb153c52ad..b1f6da4adfdb28aad8b58e4d26f48bb98f63222f 100644 --- a/cccli/tagdisplay.py +++ b/cccli/tagdisplay.py @@ -58,14 +58,23 @@ class TagDisplay(object): '''Transform a tagvalue respecting custom display settings''' tagname = unicode(tagname) tagvalue = unicode(tagvalue) + # check general options if bool(self.option.get("quotespace", False)): if re.search("\s", tagvalue) is not None: tagvalue = "'%s'"%re.sub("'", "\'", tagvalue) + # build list of matching pattern with tagname l = [ x for x in self.tagtype if fnmatch.fnmatch(tagname, x) ] - if len(l) > 0 and self.tagtype[l[0]] in self.types: - return getattr(self, "type_%s"%self.tagtype[l[0]])(tagvalue) + if len(l) > 0: + # select longest match + tm = max(l) + if self.tagtype[tm] in self.types: + return getattr(self, "type_%s"%self.tagtype[tm])(tagvalue) return tagvalue + def type_string(self, value): + '''DO Nothing''' + return value() + def type_lower(self, value): '''Lower case type''' return value.lower()