Hi Alagu,

I'm *very* new to Pylons, but it appears they have greatly simplified
JSON.  Just use like so:

    @jsonify
    def jsontest(self):
        person = {}
        person['name'] = "Bob"
        person['address'] = "123 Elm St"
        return person


Alagu Madhu wrote:
> Hi All,
>
>
> I'm using
>
> windows 200
> python 2.5
> pylons-0.9.4.1
> simplejson-1.5
>
>
>
> The code is here....
>
>
> from kk.lib.base import *
> from pylons.decorators import jsonify
>
>     @jsonify
>     def index(self):
>         c.name = "Bob"
>         c.house = "123 Elm St"
>         return c._local.request
>
>
>
>
> Error Traceback
>
> clear this
> clear this
> Module ?:2 in index
> Module pylons.decorators:18 in jsonify
> <<      response = pylons.Response()
>         response.headers['Content-Type'] = 'text/javascript'
>         response.content.append(json.dumps(func(*args, **kwargs)))
>         return response
>     jsonify = decorator(jsonify)>>
> response.content.append(json.dumps(func(*args, **kwargs)))
> Module kk.controllers.rio:70 in index1
> <<          c.name = "Bob"
>             c.house = "123 Elm St"
>             return c._local.request>>  return c._local.request
> <type 'exceptions.AttributeError'>: 'str' object has no attribute
> 'request'
>
>
> File '<string>', line 2 in index
> File
> 'c:\\python25\\lib\\site-packages\\pylons-0.9.4.1-py2.5.egg\\pylons\\decorators\\__init__.py',
> line 18 in jsonify
>   response.content.append(json.dumps(func(*args, **kwargs)))
> File 'G:\\pylons\\kk\\kk\\controllers\\rio.py', line 70 in index1
>   return c._local.request
> AttributeError: 'str' object has no attribute 'request'
> 
> 
> 
> 
> Thanks
> 
> 
> Madhu Alagu


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