From 0d1f1fdcc025e4c0d642adde0d85d318c0bc0a49 Mon Sep 17 00:00:00 2001 From: pictuga Date: Sat, 12 Oct 2013 23:36:00 +0200 Subject: [PATCH] Support for (gu)id --- feeds.py | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/feeds.py b/feeds.py index ce21195..d0d2b2d 100644 --- a/feeds.py +++ b/feeds.py @@ -418,6 +418,16 @@ class FeedItem(FeedBase): self.content = "" + def getId(self): + return "" + + def setId(self, value): + pass + + def delId(self): + self.id = "" + + def getTime(self): return None @@ -441,6 +451,7 @@ class FeedItem(FeedBase): link = FeedDescriptor('link') description = desc = FeedDescriptor('desc') content = FeedDescriptor('content') + id = FeedDescriptor('id') time = FeedTime('time') updated = FeedTime('updated') @@ -507,6 +518,19 @@ class FeedItemRSS(FeedItem): element.text = value + def getId(self): + return self.xval('rssfake:guid|guid') + + def setId(self, value): + if not value: + return self.xdel('rssfake:guid|guid') + + table = { 'rdf:rdf': 'rssfake:guid', + 'channel': 'guid'} + element = self.xgetCreate(table) + element.text = value + + def getTime(self): return self.xval('rssfake:pubDate|pubDate') @@ -587,6 +611,20 @@ class FeedItemAtom(FeedItem): element.attrib['type'] = 'html' element.text = value + + def getId(self): + return self.xval('atom:id|atom03:id') + + def setId(self, value): + if not value: + return self.xdel('atom:id|atom03:id') + + table = { 'atom:feed': 'atom:id', + 'atom03:feed': 'atom03:id'} + element = self.xgetCreate(table) + element.text = value + + def getTime(self): return self.xval('atom:published|atom03:published')