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

Commit

Permalink
Do not use the deprecated ValueError.message
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonSapin committed Apr 26, 2012
1 parent dcb866e commit 72efcf3
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 7 deletions.
2 changes: 1 addition & 1 deletion docs/parsing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ and parse a stylesheet:
>>> stylesheet.rules
[<ImportRule 1:1 foo.css>, <RuleSet at 2:5 p.error>, <PageRule 3:5 (u'tables', None)>]
>>> stylesheet.errors
[<ParseError: Parse error at 2:29, unknown at-rule in stylesheet context: @lorem-ipsum>]
[ParseError(u'Parse error at 2:29, unknown at-rule in stylesheet context: @lorem-ipsum',)]

You’ll get a :class:`~tinycss.css21.Stylesheet` object which contains
all the parsed content as well as a list of encountered errors.
Expand Down
6 changes: 1 addition & 5 deletions tinycss/parsing.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,9 +161,5 @@ def __init__(self, subject, reason):
self.line = subject.line
self.column = subject.column
self.reason = reason
self.msg = self.message = (
super(ParseError, self).__init__(
'Parse error at {0.line}:{0.column}, {0.reason}'.format(self))
super(ParseError, self).__init__(self.message)

def __repr__(self):
return ('<{0.__class__.__name__}: {0.message}>'.format(self))
2 changes: 1 addition & 1 deletion tinycss/tests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ def assert_errors(errors, expected_errors):
"""Test not complete error messages but only substrings."""
assert len(errors) == len(expected_errors)
for error, expected in zip(errors, expected_errors):
assert expected in error.message
assert expected in str(error)

0 comments on commit 72efcf3

Please sign in to comment.