changeset 1509:1d4ebe2a88fc

hope this will make Range class a little bit clearer
author Andrey Lebedev <kedder@users.sourceforge.net>
date Mon, 10 Mar 2003 20:32:53 +0000
parents 5c58ccad41ee
children 06863714a9f7
files roundup/date.py
diffstat 1 files changed, 11 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/roundup/date.py	Mon Mar 10 20:24:30 2003 +0000
+++ b/roundup/date.py	Mon Mar 10 20:32:53 2003 +0000
@@ -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 @@
         <Range from None to 2003-03-09.20:00:00>
 
     """
-    def __init__(self, spec, type, **params):
-        """Initializes Range of type <type> from given <spec> string.
+    def __init__(self, spec, Type, **params):
+        """Initializes Range of type <Type> from given <spec> 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 @@
         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"
 

Roundup Issue Tracker: http://roundup-tracker.org/