On Feb 22, 2:09 pm, "Arnar Birgisson" <[EMAIL PROTECTED]> wrote:
>
> You need to make turbojson.jsonify.jsonify availabe to your templates
> via the variable_providers:http://docs.turbogears.org/1.0/stdvars
>
> Then, in the template, you can serialize the dict to js like this:
> edituser(${jsonify(user_info)}, ${rowid})

Hi Arnar

This is exactly what I want to do. I tried doing the way given in
stdvars page :

I made a stdvars.py
------------------------------
import turbogears
import turbojson

def add_custom_stdvars(vars):
    return vars.update({"jsonify": turbojson.jsonify.jsonify})

In the project-start.py
-------------------------------
import project.stdvars
import turbogears

turbogears.view.variable_providers.append(project.stdvars.add_custom_stdvars)

In Kid page used it
----------------------------
onclick="edituser(${jsonify(conf_info)}, ${rowid})"

But this gives an error  => NameError: name 'jsonify' is not defined

Can you please tell me where I am going wrong?

Thanks and Regards
Roopesh


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears" 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/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to