> Most solid doc on this topic is:
> 
> http://docs.turbogears.org/1.0/GettingStarted/JSON
> 
> You can explicitly control how objects are converted to json using the
> jsonify decorator. There's an example in the json.py file created by
> quickstart. I have not fully explored jsonify (it was added during one
> of my periodic breaks from TG), so I haven't written a reference
> jsonify doc.

What about docs or books ( non-gears too I mean ) on what the best way
to do this kind of thing is, as far as the architecture and object
implementation?

I finally got the stuff working ok with an implementation of the cart as
a session object that sub classes list. This *seems* to make it's json
behaviour the closest to how I am using it in python code and js code,
but I'm sure it's not the most elegant approach.

Each item type is an entry in the list that maps to a product in my
producst table, and each entry in the list holds a dictionary with

[ {"name":product_name, "quant":quant, "subtotal":subtotal} ]

Then the cart class additionally has three extra fields for total number
of objects, total cost, and cart message, and adding, clearing, removing
map from js functions to python cleanly. ( js function add hits
controller json method add, which pulls the cart out of a session hat
and calls cart.add )

Anyone know if this kind of stuff is covered in the book? ( Not that the
local stores have copies yet of course! Gotta love the book biz. )

Unfortunately, I need to get this working soon, so I'm going to run with
what I have now, but I think the project might make for a nice tutorial
down the road if anyone is interested in looking over the code later and
telling me how to do it better. Writing it all up would be a nice way
for me to contribute back after all my pestering, and it makes for a
pretty snazzy cart that should degrade well too.

Iain



--~--~---------~--~----~------------~-------~--~----~
 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