Skip to content

Commit

Permalink
Fix _select_sources again
Browse files Browse the repository at this point in the history
  • Loading branch information
liZe committed Sep 6, 2017
1 parent ae0a198 commit 4990ad9
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions weasyprint/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -354,14 +354,11 @@ def _select_source(guess=None, filename=None, url=None, file_obj=None,
elif string is not None:
yield 'string', string, base_url, None
else:
sources = locals()
raise TypeError('Expected exactly one source, got ' + (
', '.join(
name for name in (
'guess', 'filename', 'url', 'file_obj', 'string')
if locals()[name] is not None)
) or 'nothing'
)
sources = dict(locals())
sources_names = ', '.join(
name for name in ('guess', 'filename', 'url', 'file_obj', 'string')
if sources[name] is not None) or 'nothing'
raise TypeError('Expected exactly one source, got ' + sources_names)

# Work around circular imports.
from .css import preprocess_stylesheet # noqa
Expand Down

0 comments on commit 4990ad9

Please sign in to comment.