def checkGroup(self, group): # check if group header is valid if group == self.defaultGroup: try: self.name = self.content[group]["Name"] except KeyError: self.errors.append("Key 'Name' in Group '%s' is missing" % group) try: self.name = self.content[group]["Comment"] except KeyError: self.errors.append("Key 'Comment' in Group '%s' is missing" % group) elif group in self.getDirectories(): try: self.type = self.content[group]["Type"] except KeyError: self.type = "Threshold" try: self.name = self.content[group]["Size"] except KeyError: self.errors.append("Key 'Size' in Group '%s' is missing" % group) elif not (re.match("^\[X-", group) and is_ascii(group)): self.errors.append("Invalid Group name: %s" % group)
def checkGroup(self, group): # check if group header is valid if not (group == self.defaultGroup \ or re.match("^Desktop Action [a-zA-Z0-9\-]+$", group) \ or (re.match("^X-", group) and is_ascii(group))): self.errors.append("Invalid Group name: %s" % group) else: #OnlyShowIn and NotShowIn if ("OnlyShowIn" in self.content[group]) and ("NotShowIn" in self.content[group]): self.errors.append("Group may either have OnlyShowIn or NotShowIn, but not both")
def checkGroup(self, group): # check if group header is valid if not (group == self.defaultGroup \ or (re.match("^\[X-", group) and is_ascii(group))): self.errors.append("Invalid Group name: %s" % group.encode("ascii", "replace"))