Beispiel #1
0
 def post(self, id):
   """
   TODO: accept multiple json objects which present purchases.
   """
   event_id = long(id)
   response = {}
   try:
     jsons = simplejson.loads(self.request.body)
     purchases = [Purchase.create_from_json(event_id, json) for json in jsons]
     for purchase in purchases:
       purchase.put()
     response = {'status': 'success',
                 'redirect': '/e/%d/list' % event_id,
                 'n_purchase':len(purchases)}
   except Exception, e:
     response = {'status': str(e), 'n_purchase':0}