Esempio n. 1
0
    def request_query(self):
        query = db.Query(model.Request)
        self.parse_owner(query)
        self.parse_state(query)

        # limited to a push
        push_field = self.request.get('push')
        if push_field:
            if push_field == 'current':
                push = query.current_push()
                if push:
                    query.filter('push =', push)
            else:
                push_key = db.Key(push_field)
                query.filter('push =', push_key)

        return query
Esempio n. 2
0
 def parse_state(self, query):
     state_field = self.request.get('state')
     if state_field:
         query.filter('state =', state_field)
     return query
Esempio n. 3
0
 def parse_owner(self, query):
     owner_field = self.request.get('owner')
     if owner_field:
         owner = users.User(owner_field)
         query.filter('owner =', owner)
     return query