Hi Mauricio,

2009/4/6 Mauricio Daniel Hoffart <[email protected]>:

> I am new to pyton
> I am trying to use Pylons + Dojo and I am having trouble calling a control
> with multiple parameters. What is an example of that?
>
> Thanks a lot
>
> Ex:
> --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
> --IN THE CONTROLLER
> --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
> class TesteController(BaseController):
>
>     @jsonify
>     def login(self, sUsrNme, sUstPwd ):
>
>         result = "ok"
>
>         return result
>
> --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
> --IN THE PAGE
> --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
> var xhrArgs = {
>                 url: "/teste/login/",
>                 postData: "{Master,Senha}",
>                 handleAs: "json",
>                 load: function(sUsrNme, sUsrPwd ){
>                   dojo.byId("basicFormTab").innerHTML = "Message posted.";
>                 },
>                 error: function(error){
>                   dojo.byId("basicFormTab").innerHTML = "We'll 404 in the
> demo, but that's okay.  We don't have a 'postIt' service on the docs
> server." ;
>                 }
>               }
>
> The error returned is:
> TypeError: login() takes exactly 3 arguments (1 given)
If you set parameters to the function, they are expected to be given
in the url (through a routes parameter, so you would have to configure
a route for that one) - and example for that would be
/teste/login/Master, then the first argument to the action would be
"Master"

If you post to the action, like you do, you have to take a look at the
"request" dictionary, which wil contain the parameters you posted to
the function, or were in get parameters.

I hope that helps!

Cheers,
Jens

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to