changeset 3515:9821253655db

UnitArgument: show list of valid units in error message
author Johannes Berg <johannes AT sipsolutions DOT net>
date Tue, 22 Apr 2008 14:31:30 +0200
parents 6adf6716f098
children a81ad9e5d220
files MoinMoin/wikiutil.py
diffstat 1 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/wikiutil.py	Sat Apr 19 16:16:57 2008 +0200
+++ b/MoinMoin/wikiutil.py	Tue Apr 22 14:31:30 2008 +0200
@@ -1755,8 +1755,9 @@
             if s.endswith(unit):
                 ret = (self._type(s[:len(s) - len(unit)]), unit)
                 return ret
+        units = ', '.join(self._units)
         ## XXX: how can we translate this?
-        raise ValueError("Invalid unit in value %s" % s)
+        raise ValueError("Invalid unit in value %s (allowed units: %s)" % (s, units))
 
     def get_default(self):
         return self._default