Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions feedparser/mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ def __init__(self):
self.svgOK = 0
self.title_depth = -1
self.depth = 0
self.hasContent = 0
if self.lang:
self.feeddata['language'] = self.lang.replace('_', '-')

Expand Down
7 changes: 5 additions & 2 deletions feedparser/namespaces/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,7 @@ def _start_item(self, attrs_d):
def _end_item(self):
self.pop('item')
self.inentry = 0
self.hasContent = 0
_end_entry = _end_item

def _start_language(self, attrs_d):
Expand Down Expand Up @@ -388,7 +389,7 @@ def _end_title(self):

def _start_description(self, attrs_d):
context = self._get_context()
if 'summary' in context:
if 'summary' in context and not self.hasContent:
self._summaryKey = 'content'
self._start_content(attrs_d)
else:
Expand Down Expand Up @@ -429,7 +430,7 @@ def _end_generator(self):

def _start_summary(self, attrs_d):
context = self._get_context()
if 'summary' in context:
if 'summary' in context and not self.hasContent:
self._summaryKey = 'content'
self._start_content(attrs_d)
else:
Expand Down Expand Up @@ -466,6 +467,7 @@ def _end_source(self):
self.sourcedata.clear()

def _start_content(self, attrs_d):
self.hasContent = 1
self.push_content('content', attrs_d, 'text/plain', 1)
src = attrs_d.get('src')
if src:
Expand All @@ -477,6 +479,7 @@ def _start_body(self, attrs_d):
_start_xhtml_body = _start_body

def _start_content_encoded(self, attrs_d):
self.hasContent = 1
self.push_content('content', attrs_d, 'text/html', 1)
_start_fullitem = _start_content_encoded

Expand Down
10 changes: 10 additions & 0 deletions tests/wellformed/atom10/entry_content_and_summary.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<!--
Description: entry summary follows content with different value
Expect: not bozo and entries[0]['summary'] == 'Summary'
-->
<feed xmlns="http://www.w3.org/2005/Atom">
<entry>
<content>Example Atom</content>
<summary>Summary</summary>
</entry>
</feed>