fixed conflict when using str as argument of ListBase.parse
This commit is contained in:
parent
a7fa1dde16
commit
b1fad86369
@ -82,11 +82,11 @@ class ListBase(ResourceContainer):
|
||||
"""
|
||||
self.parse(uri=uri)
|
||||
|
||||
def parse(self,uri=None,fh=None,str=None):
|
||||
def parse(self,uri=None,fh=None,str_data=None):
|
||||
"""Parse a single XML document for this list
|
||||
|
||||
Accepts either a uri (uri or default if parameter not specified),
|
||||
or a filehandle (fh) or a string (str).
|
||||
or a filehandle (fh) or a string (str_data).
|
||||
|
||||
Does not handle the case of sitemapindex+sitemaps
|
||||
"""
|
||||
@ -95,8 +95,8 @@ class ListBase(ResourceContainer):
|
||||
fh = URLopener().open(uri)
|
||||
except IOError as e:
|
||||
raise Exception("Failed to load sitemap/sitemapindex from %s (%s)" % (uri,str(e)))
|
||||
elif (str is not None):
|
||||
fh=io.StringIO(str)
|
||||
elif (str_data is not None):
|
||||
fh=StringIO.StringIO(str_data)
|
||||
if (fh is None):
|
||||
raise Exception("Nothing to parse")
|
||||
s = self.new_sitemap()
|
||||
|
||||
Loading…
Reference in New Issue
Block a user