This is driving me nuts..
I have a route mapped as an extra collection on a resource:
maps.resource('post', 'posts', collection={'json':'GET'})
The controller action:
@jsonify
def json(self):
q = sa.query(Post)
count = q.count()
posts = q.all()
items = []
for post in posts:
_post =
{'id':post.id,'caption':post.title,'description':post.content}
items.append(_post)
postsJson = {'posts': count,'items':items}
return postsJson
Returns null... the code in a shell returns the structure fine (the
data set isn't empty).
What makes this even stranger is that if I were to map this as a
member, and pass it an Id - I get a response as expected (even though
i didn't change the code, other then adding the id parameter).
Anybody know what's going on?
When trying app.get(url('json_posts')) in the shell I get "<Response
200 OK ''>" (null).
I also get that same response if I put an invalid url in there
(instead of a 404)...
The url('json_posts') resolves correctly and paster routes reports it
appropriately as well.
--
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.