From 849bfc4b9ed176c6232fb4fd876bc441cc684a3f Mon Sep 17 00:00:00 2001 From: makkalot Date: Sat, 21 Jun 2008 20:23:40 +0300 Subject: add validator schema factory results to RemoteForm object --- funcweb/funcweb/tests/test_widget_automation.py | 7 +++++-- funcweb/funcweb/widget_automation.py | 3 ++- 2 files changed, 7 insertions(+), 3 deletions(-) (limited to 'funcweb') diff --git a/funcweb/funcweb/tests/test_widget_automation.py b/funcweb/funcweb/tests/test_widget_automation.py index c82d40e..d02de93 100644 --- a/funcweb/funcweb/tests/test_widget_automation.py +++ b/funcweb/funcweb/tests/test_widget_automation.py @@ -3,6 +3,7 @@ import turbogears from turbogears import testutil from funcweb.widget_automation import WidgetListFactory,RemoteFormAutomation,RemoteFormFactory +from funcweb.widget_validation import WidgetSchemaFactory class TestWidgetListFactory(unittest.TestCase): @@ -48,8 +49,10 @@ class TestWidgetListFactory(unittest.TestCase): def test_remote_form(self): + schema_factory = WidgetSchemaFactory(self.get_test_default_args()) + schema_validator=schema_factory.get_ready_schema() widget_list_object = self.widget_factory.get_widgetlist_object() - remote_form = RemoteFormAutomation(widget_list_object) + remote_form = RemoteFormAutomation(widget_list_object,schema_validator) #print remote_form def test_remote_form_factory(self): @@ -71,7 +74,7 @@ class TestWidgetListFactory(unittest.TestCase): argument_name in all_fields - print remote_form.render() + #print remote_form.render() def get_test_default_args(self): return { diff --git a/funcweb/funcweb/widget_automation.py b/funcweb/funcweb/widget_automation.py index df521db..e6002e2 100644 --- a/funcweb/funcweb/widget_automation.py +++ b/funcweb/funcweb/widget_automation.py @@ -185,7 +185,7 @@ class RemoteFormAutomation(CoreWD): full_class_name = "funcweb.controllers.Root" - def __init__(self,generated_fields,*args,**kwarg): + def __init__(self,generated_fields,validator_schema,*args,**kwarg): """ The constructor part same as normal one except it takes a WidgetsList object into generated_fields @@ -195,6 +195,7 @@ class RemoteFormAutomation(CoreWD): super(RemoteFormAutomation,self).__init__(*args,**kwarg) self.for_widget = RemoteForm( fields = generated_fields, + validator = validator_schema, name = "minion_form", update = "col5", before='getElement(\'loading\').innerHTML=toHTML(IMG({src:\'../static/images/loading.gif\',width:\'80\',height:\'80\'}));', -- cgit