[tor-commits] [bridgedb/develop] Raise an error rather than printing in b.p.v.Versions.
isis at torproject.org
isis at torproject.org
Wed Apr 23 05:23:11 UTC 2014
commit ce4a13b50cd05f28c54a90a087809f87d835993b
Author: Isis Lovecruft <isis at torproject.org>
Date: Tue Apr 22 21:06:49 2014 +0000
Raise an error rather than printing in b.p.v.Versions.
---
lib/bridgedb/parse/versions.py | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/lib/bridgedb/parse/versions.py b/lib/bridgedb/parse/versions.py
index b327cb8..0aefe43 100644
--- a/lib/bridgedb/parse/versions.py
+++ b/lib/bridgedb/parse/versions.py
@@ -25,6 +25,10 @@ bridgedb.parse.versions
from twisted.python import util as txutil
+class InvalidVersionStringFormat(ValueError):
+ """Raised when a version string is not in a parseable format."""
+
+
class Version(txutil.Version):
"""Holds, parses, and does comparison operations for version numbers.
@@ -66,9 +70,8 @@ class Version(txutil.Version):
version number for.
"""
if version.find('.') == -1:
- print("Version.__init__(): %r doesn't look like a version string!"
- % version.__repr__())
-
+ raise InvalidVersionStringFormat(
+ "Invalid delimiters in version string: %r" % version)
major, minor, micro, prerelease = ['' for x in xrange(4)]
components = version.split('.')
More information about the tor-commits
mailing list