Fix #3402: Allow to suppress "download file not readable" warnings using `suppress_warnings`

This commit is contained in:
Takeshi KOMIYA committed 2017-02-09 12:55:07 +09:00
1 parent 6fa0262802
commit 2968ef3c26
3 files changed
+7 -3

No files matched your search

+2
View File
@@ -46,6 +46,8 @@ Features added
* #3303: Add ``:pyversion:`` option to the doctest directive.
* #3378: (latex) support for ``:widths:`` option of table directives
(refs: #3379, #3381)
* #3402: Allow to suppress "download file not readable" warnings using
:confval:`suppress_warnings`.
Bugs fixed
----------
+2
View File
@@ -226,8 +226,10 @@ General configuration
* app.add_role
* app.add_generic_role
* app.add_source_parser
* download.not_readable
* image.data_uri
* image.nonlocal_uri
* image.not_readable
* ref.term
* ref.ref
* ref.numref
+3 -3
View File
@@ -96,7 +96,7 @@ class ImageCollector(EnvironmentCollector):
app.env.dependencies[docname].add(imgpath)
if not os.access(path.join(app.srcdir, imgpath), os.R_OK):
logger.warning('image file not readable: %s' % imgpath,
location=node)
location=node, type='image', subtype='not_readable')
continue
app.env.images.add_file(docname, imgpath)
@@ -112,7 +112,7 @@ class ImageCollector(EnvironmentCollector):
globbed.setdefault(mimetype, []).append(new_imgpath)
except (OSError, IOError) as err:
logger.warning('image file %s not readable: %s' % (filename, err),
location=node)
location=node, type='image', subtype='not_readable')
for key, files in iteritems(globbed):
candidates[key] = sorted(files, key=len)[0] # select by similarity
@@ -137,7 +137,7 @@ class DownloadFileCollector(EnvironmentCollector):
app.env.dependencies[app.env.docname].add(rel_filename)
if not os.access(filename, os.R_OK):
logger.warning('download file not readable: %s' % filename,
location=node)
location=node, type='download', subtype='not_readable')
continue
node['filename'] = app.env.dlfiles.add_file(app.env.docname, filename)