comparison src/plugins/plugin_blog_import.py @ 2108:70f23bc7859b

core (xml_tools): fixed findAll - names and namespases arguments haven been inverted to be in the same order as for domish.Element.elements - fixed bad copy of elements in recursions - check if childrens are IElements - namespaces and names can now be basestrings instead of iterables
author Goffi <goffi@goffi.org>
date Tue, 03 Jan 2017 18:51:50 +0100
parents 2daf7b4c6756
children 33c8c4973743
comparison
equal deleted inserted replaced
2107:2c31ddf633e5 2108:70f23bc7859b
280 opt_host = urlparse.urlunsplit((parsed_host.scheme or 'http', parsed_host.netloc or parsed_host.path, '', '', '')) 280 opt_host = urlparse.urlunsplit((parsed_host.scheme or 'http', parsed_host.netloc or parsed_host.path, '', '', ''))
281 281
282 tmp_dir = tempfile.mkdtemp() 282 tmp_dir = tempfile.mkdtemp()
283 try: 283 try:
284 # TODO: would be nice to also update the hyperlinks to these images, e.g. when you have <a href="{url}"><img src="{url}"></a> 284 # TODO: would be nice to also update the hyperlinks to these images, e.g. when you have <a href="{url}"><img src="{url}"></a>
285 for img_elt in xml_tools.findAll(top_elt, ['img']): 285 for img_elt in xml_tools.findAll(top_elt, names=[u'img']):
286 yield self.imgFilters(client, img_elt, options, opt_host, tmp_dir) 286 yield self.imgFilters(client, img_elt, options, opt_host, tmp_dir)
287 finally: 287 finally:
288 os.rmdir(tmp_dir) # XXX: tmp_dir should be empty, or something went wrong 288 os.rmdir(tmp_dir) # XXX: tmp_dir should be empty, or something went wrong
289 289
290 # we now replace the content with filtered one 290 # we now replace the content with filtered one