31 |
Edited by Juri Pakaste, Jan Alonzo |
Edited by Juri Pakaste, Jan Alonzo |
32 |
|
|
33 |
* Added support for blogchannel, freshmeat, creativecommons, and prism modules. |
* Added support for blogchannel, freshmeat, creativecommons, and prism modules. |
34 |
|
* Support for <source url="">...</source> tag |
35 |
|
|
36 |
""" |
""" |
37 |
|
|
152 |
if self.elementstack[-1][0] != element: return |
if self.elementstack[-1][0] != element: return |
153 |
element, expectingText, pieces = self.elementstack.pop() |
element, expectingText, pieces = self.elementstack.pop() |
154 |
if not expectingText: return |
if not expectingText: return |
155 |
|
|
156 |
output = "".join(pieces) |
output = "".join(pieces) |
157 |
|
|
158 |
output = decodeEntities(output) |
output = decodeEntities(output) |
159 |
if self.incontent and self.initem: |
if self.incontent and self.initem: |
160 |
if not self.items[-1].has_key(element): |
if not self.items[-1].has_key(element): |
165 |
elif self.inchannel and (not self.intextinput) and (not self.inimage): |
elif self.inchannel and (not self.intextinput) and (not self.inimage): |
166 |
self.channel[element] = output |
self.channel[element] = output |
167 |
|
|
168 |
|
|
169 |
def _addNamespaces(self, attrs): |
def _addNamespaces(self, attrs): |
170 |
for prefix, value in attrs: |
for prefix, value in attrs: |
171 |
if not prefix.startswith("xmlns:"): continue |
if not prefix.startswith("xmlns:"): continue |
184 |
prefix = self.namespacemap.get(prefix, prefix) |
prefix = self.namespacemap.get(prefix, prefix) |
185 |
name = prefix + ':' + suffix |
name = prefix + ':' + suffix |
186 |
return name |
return name |
187 |
|
|
188 |
def _getAttribute(self, attrs, name): |
def _getAttribute(self, attrs, name): |
189 |
value = [v for k, v in attrs if self._mapToStandardPrefix(k) == name] |
value = [v for k, v in attrs if self._mapToStandardPrefix(k) == name] |
190 |
if value: |
if value: |
354 |
def end_id(self): |
def end_id(self): |
355 |
self.pop('id') |
self.pop('id') |
356 |
|
|
357 |
|
# source url |
358 |
def start_source(self, attrs): |
def start_source(self, attrs): |
|
print "source_url yey!" |
|
359 |
self.push('source', 1) |
self.push('source', 1) |
360 |
value = self._getAttribute(attrs, 'url') |
value = self._getAttribute(attrs, 'url') |
361 |
if value: |
if value: |
362 |
|
value += "," |
363 |
self.elementstack[-1][2].append(value) |
self.elementstack[-1][2].append(value) |
364 |
|
|
365 |
|
def end_source(self): |
366 |
self.pop('source') |
self.pop('source') |
367 |
|
|
368 |
# Creative Commons Licenses (RSS) |
# Creative Commons Licenses (RSS) |