def validate(self): if not "link" in self.children: self.log(MissingItemLink({"parent":self.name, "element":"link"})) if not "title" in self.children: self.log(MissingItemTitle({"parent":self.name, "element":"title"})) if (not "title" in self.children) and (not "description" in self.children): self.log(ItemMustContainTitleOrDescription({})) if not "guid" in self.children: if self.getFeedType() == TYPE_RSS2: if self.parent.parent.version.startswith("2."): self.log(MissingGuid({"parent":self.name, "element":"guid"})) if self.itunes: itunes_item.validate(self)
def validate(self): if (not "title" in self.children) and (not "description" in self.children): self.log(ItemMustContainTitleOrDescription({})) if not "guid" in self.children: if self.getFeedType() == TYPE_RSS2: rss = self.parent.parent while rss and rss.name!='rss': rss=rss.parent if rss.version.startswith("2."): self.log(MissingGuid({"parent":self.name, "element":"guid"})) if "slash_comments" in self.children: if "lastBuildDate" not in self.parent.children and self.getFeedType()==TYPE_RSS2: self.log(SlashDate({})) if self.itunes: itunes_item.validate(self)
def validate(self): if not "title" in self.children: self.log(MissingElement({"parent": self.name, "element": "title"})) if not self.has_author(): self.log(MissingElement({"parent": self.name, "element": "author"})) if not "id" in self.children: self.log(MissingElement({"parent": self.name, "element": "id"})) if not "updated" in self.children: self.log(MissingElement({"parent": self.name, "element": "updated"})) if self.content: if not "summary" in self.children: if self.content.attrs.has_key((None, "src")): self.log(MissingSummary({"parent": self.parent.name, "element": self.name})) ctype = self.content.type if ctype.find("/") > -1 and not ( ctype.endswith("+xml") or ctype.endswith("/xml") or ctype.startswith("text/") ): self.log(MissingSummary({"parent": self.parent.name, "element": self.name})) else: if not "summary" in self.children: self.log(MissingTextualContent({"parent": self.parent.name, "element": self.name})) for link in self.links: if link.rel == "alternate": break else: self.log(MissingContentOrAlternate({"parent": self.parent.name, "element": self.name})) # can only have one alternate per type types = {} for link in self.links: if not link.rel == "alternate": continue if not link.type in types: types[link.type] = [] if link.hreflang in types[link.type]: self.log( DuplicateAtomLink( {"parent": self.name, "element": "link", "type": link.type, "hreflang": link.hreflang} ) ) else: types[link.type] += [link.hreflang] if self.itunes: itunes_item.validate(self)
def validate(self): if not 'title' in self.children: self.log(MissingElement({"parent":self.name, "element":"title"})) if not 'author' in self.children and not 'author' in self.parent.children: self.log(MissingElement({"parent":self.name, "element":"author"})) if not 'id' in self.children: self.log(MissingElement({"parent":self.name, "element":"id"})) if not 'updated' in self.children: self.log(MissingElement({"parent":self.name, "element":"updated"})) if self.content: if not 'summary' in self.children: if self.content.attrs.has_key((None,"src")): self.log(MissingSummary({"parent":self.parent.name, "element":self.name})) ctype = self.content.type if ctype.find('/') > -1 and not ( ctype.endswith('+xml') or ctype.endswith('/xml') or ctype.startswith('text/')): self.log(MissingSummary({"parent":self.parent.name, "element":self.name})) else: if not 'summary' in self.children: self.log(MissingTextualContent({"parent":self.parent.name, "element":self.name})) for link in self.links: if link.rel == 'alternate': break else: self.log(MissingContentOrAlternate({"parent":self.parent.name, "element":self.name})) # can only have one alternate per type types={} for link in self.links: if not link.rel=='alternate': continue if not link.type in types: types[link.type]=[] if link.hreflang in types[link.type]: self.log(DuplicateAtomLink({"parent":self.name, "element":"link", "type":link.type, "hreflang":link.hreflang})) else: types[link.type] += [link.hreflang] if self.itunes: itunes_item.validate(self)