# HG changeset patch # User Sverre Rabbelier # Date 1236385908 0 # Node ID 6d6813e83756fd5a544b38056d68c4a31a7f28a0 # Parent 6c69b7cff908fc06538210618b99bffd23e4b1d9 Factor out the 'json' part from pick Patch by: Sverre Rabbelier diff -r 6c69b7cff908 -r 6d6813e83756 app/soc/views/models/base.py --- a/app/soc/views/models/base.py Sat Mar 07 00:31:16 2009 +0000 +++ b/app/soc/views/models/base.py Sat Mar 07 00:31:48 2009 +0000 @@ -632,6 +632,12 @@ entities = self._logic.getForFields(filter=filter, limit=1000) data = [i.toDict() for i in entities] + return self.json(request, data) + + def json(self, request, data): + """Returns data as a json object. + """ + to_json = { 'data': data, } @@ -642,13 +648,15 @@ template = 'soc/json.html' response = responses.respond(request, template, context) + # if the browser supports HTTP/1.1 # post-check and pre-check and no-store for IE7 response['Cache-Control'] = 'no-store, no-cache, must-revalidate, ' \ 'post-check=0, pre-check=0' + # if the browser supports HTTP/1.0 response['Pragma'] = 'no-cache' - + return response def _editPost(self, request, entity, fields):