Skip to content
This repository has been archived by the owner on Mar 12, 2019. It is now read-only.

Commit

Permalink
Rename _stripDoctype() to replace_doctype()
Browse files Browse the repository at this point in the history
Bonus: improve the function docs and make the code more PEP-8 compliant.

git-svn-id: http://feedparser.googlecode.com/svn/trunk@729 73d2b349-402e-0410-baf4-070fd12ab5b7
  • Loading branch information
kurtmckee committed May 28, 2012
1 parent c68b3eb commit 74864b0
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions feedparser/feedparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -3762,11 +3762,11 @@ def _toUTF8(data, encoding):
# Forbidden: explode1 "&explode2;&explode2;"
RE_SAFE_ENTITY_PATTERN = re.compile(_s2bytes('\s+(\w+)\s+"(&#\w+;|[^&"]*)"'))

def _stripDoctype(data):
'''Strips DOCTYPE from XML document, returns (rss_version, stripped_data)
def replace_doctype(data):
'''Strips and replaces the DOCTYPE, returns (rss_version, stripped_data)
rss_version may be 'rss091n' or None
stripped_data is the same XML document, minus the DOCTYPE
stripped_data is the same XML document with a replaced DOCTYPE
'''

# Divide the document into two groups by finding the location
Expand Down Expand Up @@ -3958,7 +3958,7 @@ def parse(url_file_stream_or_string, etag=None, modified=None, agent=None, refer
(result['encoding'], proposed_encoding))
result['encoding'] = proposed_encoding

result['version'], data, entities = _stripDoctype(data)
result['version'], data, entities = replace_doctype(data)

# Ensure that baseuri is an absolute URI using an acceptable URI scheme.
contentloc = http_headers.get('content-location', u'')
Expand Down

0 comments on commit 74864b0

Please sign in to comment.