Exemple #1
0
 def get(self, keg_id, **kwargs):
     self.response.write(
         json.json.dumps({
             'meta':
             funcs.meta_ok(),
             'keg':
             funcs.convert_model(self.get_keg_or_bust(keg_id))
         }))
Exemple #2
0
    def get(self, user_id):
        a_user = User.get_by_key_name(user_id)
        if not a_user:
           raise webob.exc.HTTPNotFound()

        self.response.write(
            json.json.dumps(
                {'meta': funcs.meta_ok(),
                 'user': funcs.convert_model(a_user)
                }
            ))
Exemple #3
0
    def post(self, user_id):
        name = self.request.GET.get('name')
        new_user = User(key_name=user_id, user_name=name)
        new_user.put()
	props = new_user.properties()
        
        self.response.write(
            json.json.dumps(
                {'meta': funcs.meta_ok(),
                 'user': funcs.convert_model(new_user)
                }
            ))
Exemple #4
0
 def get(self, user_id):
     a_user = User.get_by_key_name(user_id)
     if not a_user:
        raise webob.exc.HTTPNotFound()
     personas = Persona.all().ancestor(a_user).run()
     if not personas:
        raise webob.exc.HTTPNotFound()
     personas = [funcs.convert_model(persona) for persona in personas]
     self.response.write(
         json.json.dumps(
            {'meta': funcs.meta_ok(),
             'personas' : personas
            }
         ))
Exemple #5
0
 def get(self):
    full = self.request.GET.get('full', False)
    limit = self.request.params.get('limit', 20)
    offset = self.request.params.get('offset', 0)
    all_beers = Beer.all(keys_only=not full)
    total = all_beers.count(read_policy=db.EVENTUAL_CONSISTENCY, deadline=5)
    payload = [a_beer for a_beer in all_beers.run(offset=offset, limit=min(limit, total))]
    if not payload:
       raise webob.exc.HTTPNotFound()
    data = {}
    if not full:
       data['beers'] = [webapp2.uri_for('beer', beer_id=beer.name()) for beer in all_beers]
    else:
       data['beers'] = [funcs.convert_model(beer) for beer in all_beers]
    data['meta'] = funcs.meta_ok()
    self.response.write(json.json.dumps(data))
Exemple #6
0
 def get(self, beer_id, **kwargs):
     self.response.write(json.json.dumps(
         {'meta' : funcs.meta_ok(),
          'beer' : funcs.convert_model(self.get_beer_or_bust(beer_id))
         }
      ))
Exemple #7
0
 def get(self, tap_id, **kwargs):
     self.response.write(json.json.dumps(
         {'meta' : funcs.meta_ok(),
          'tap' : funcs.convert_model(self.get_tap_or_bust(tap_id))
         }
      ))