From: kedder Date: Mon, 10 Mar 2003 20:32:53 +0000 (+0000) Subject: hope this will make Range class a little bit clearer X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=bcd9c74f29626753a6a50daa0e8bd2eac718f26a;p=roundup.git hope this will make Range class a little bit clearer git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/trunk@1585 57a73879-2fb5-44c3-a270-3262357dd7e2 --- diff --git a/roundup/date.py b/roundup/date.py index c214cd1..da341c6 100644 --- a/roundup/date.py +++ b/roundup/date.py @@ -15,7 +15,7 @@ # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. # -# $Id: date.py,v 1.47 2003-03-10 00:22:20 richard Exp $ +# $Id: date.py,v 1.48 2003-03-10 20:32:53 kedder Exp $ __doc__ = """ Date, time and time interval handling. @@ -621,14 +621,18 @@ class Range: """ - def __init__(self, spec, type, **params): - """Initializes Range of type from given string. + def __init__(self, spec, Type, **params): + """Initializes Range of type from given string. Sets two properties - from_value and to_value. None assigned to any of this properties means "infinitum" (-infinitum to from_value and - +infinitum to to_value) + +infinitum to to_value) + + The Type parameter here should be class itself (e.g. Date), not a + class instance. + """ - self.range_type = type + self.range_type = Type re_range = r'(?:^|(?:from)?(.+?))(?:to(.+?)$|$)' re_geek_range = r'(?:^|(.+?))(?:;(.+?)$|$)' # Check which syntax to use @@ -641,9 +645,9 @@ class Range: if mch_range: self.from_value, self.to_value = mch_range.groups() if self.from_value: - self.from_value = type(self.from_value.strip(), **params) + self.from_value = Type(self.from_value.strip(), **params) if self.to_value: - self.to_value = type(self.to_value.strip(), **params) + self.to_value = Type(self.to_value.strip(), **params) else: raise ValueError, "Invalid range"