summaryrefslogtreecommitdiffstats
path: root/funcweb
diff options
context:
space:
mode:
authormakkalot <makkalot@gmail.com>2008-06-20 14:10:35 +0300
committermakkalot <makkalot@gmail.com>2008-06-20 14:10:35 +0300
commit5d33994f135e1d92c5a5fceb50b7698bb9e9e6e4 (patch)
treea7e9d1df853442dae2e9f2be606d3a344194ba4f /funcweb
parentc49abde5eaa2bf37015589a2589e40d4b1d5f2e9 (diff)
downloadthird_party-func-5d33994f135e1d92c5a5fceb50b7698bb9e9e6e4.tar.gz
third_party-func-5d33994f135e1d92c5a5fceb50b7698bb9e9e6e4.tar.xz
third_party-func-5d33994f135e1d92c5a5fceb50b7698bb9e9e6e4.zip
add integer validation factory part
Diffstat (limited to 'funcweb')
-rw-r--r--funcweb/funcweb/widget_validation.py32
1 files changed, 21 insertions, 11 deletions
diff --git a/funcweb/funcweb/widget_validation.py b/funcweb/funcweb/widget_validation.py
index 10fd177..624dcbb 100644
--- a/funcweb/funcweb/widget_validation.py
+++ b/funcweb/funcweb/widget_validation.py
@@ -34,7 +34,26 @@ class WidgetSchemaFactory(object):
Gets the options of the int type and adds a
new validator to validator_list
"""
- pass
+ #the initializer for the int_validator
+ int_data_set = {}
+
+ if self.method_argument_dict[argument_name].has_key('range'):
+ #because the range is [min,max] list the 0 is min 1 is the max
+ int_data_set['min_int']=self.method_argument_dict[argument_name]['range'][0]
+ int_data_set['max_int']=self.method_argument_dict[argument_name]['range'][1]
+ if self.method_argument_dict[argument_name].has_key('min'):
+ int_data_set['min_int']=self.method_argument_dict[argument_name]['min']
+ if self.method_argument_dict[argument_name].has_key('max'):
+ int_data_set['max_int']=self.method_argument_dict[argument_name]['max']
+
+ #add the validator to the list
+ if int_data_set:
+ self.validator_list[argument_name]=MinionIntValidator(**int_data_set)
+ else:
+ self.validator_list[argument_name]=MinionIntValidator()
+
+
+
def _add_string_validator(self,argument_name):
"""
@@ -112,16 +131,7 @@ class WidgetSchemaFactory(object):
class MinionIntValidator(validators.FancyValidator):
"""
- Confirms that the input/output is of the proper type.
-
- Uses the parameters:
-
- subclass:
- The class or a tuple of classes; the item must be an instance
- of the class or a subclass.
- type:
- A type or tuple of types (or classes); the item must be of
- the exact class or type. Subclasses are not allowed.
+ Confirms that the input/output is of the proper type of int.
"""
#automatically will be assigned