Skip to content

Commit

Permalink
PaicemanaFeed() - atom:link and Image
Browse files Browse the repository at this point in the history
  • Loading branch information
alexandre-mbm committed Jul 14, 2015
1 parent 7af5e51 commit d7d7564
Showing 1 changed file with 23 additions and 2 deletions.
25 changes: 23 additions & 2 deletions paicemana/osmbrasilgenerator.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,20 +58,32 @@ def __md_label_for__(self, number):
return '[weeklyosm-%s]' % number


# https://pythonhosted.org/DeeFuzzer/deefuzzer.deefuzzer.tools.PyRSS2Gen-module.html

class PaicemanaFeed(PyRSS2Gen.RSS2):

rss_attrs = {
"version": "2.0",
"xmlns:atom": "http://www.w3.org/2005/Atom"
}

def __init__(self, selflink=None, *args, **kwargs):
self.selflink = selflink
super(PaicemanaFeed, self).__init__(*args, **kwargs)

def publish_extensions(self, handler):
PyRSS2Gen._element(handler, 'atom:link', None,

if self.selflink:
PyRSS2Gen._element(handler, 'atom:link', None,
{'rel': 'self',
'type': 'application/rss+xml',
'href': 'http://www.openstreetmap.com.br/weeklyosm.xml',
'href': self.selflink,
})

#def characters(self, key, description):
# self._out.write('%s<![CDATA[\n %s \n]]>%s' % ("<%s>"%key, description, "</%s>"%key))
#characters(handler, "description", self.d1)


# https://validator.w3.org/feed/

Expand Down Expand Up @@ -110,6 +122,15 @@ def __write__(self):
link = "http://www.openstreetmap.com.br/weeklyosm.xml",
description = "Um resumo semanal de todas as coisas que acontecem no mundo do OpenStreetMap",
lastBuildDate = datetime.datetime.now(),
docs = None,
image = PyRSS2Gen.Image(
url = self.feed.feed.image.href,
title = self.feed.feed.image.title,
link = self.feed.feed.image.link,
width=self.feed.feed.image.width,
height=self.feed.feed.image.height
),
selflink = "http://www.openstreetmap.com.br/weeklyosm.xml",
items = self.__items_for_write__()
)
rss.write_xml(open("weeklyosm.xml", "w"), encoding = "utf-8")
Expand Down

0 comments on commit d7d7564

Please sign in to comment.