view examples/turbogears/markuptest/json.py @ 208:bc146e63c159 trunk

Cleanup the application of template processing steps (flatten, eval, match) so that they are only performed when necessary. Results in a small performance boost, and also fixes #35.
author cmlenz
date Tue, 29 Aug 2006 15:44:54 +0000
parents 49364e784c47
children
line wrap: on
line source
# This module provides helper functions for the JSON part of your
# view, if you are providing a JSON-based API for your app.

# Here's what most rules would look like:
# @jsonify.when("isinstance(obj, YourClass)")
# def jsonify_yourclass(obj):
#     return [obj.val1, obj.val2]
#
# The goal is to break your objects down into simple values:
# lists, dicts, numbers and strings

from turbojson.jsonify import jsonify
Copyright (C) 2012-2017 Edgewall Software