Python GqlQuery no muestra contenido

I have code which suppose to put 2 Objects(classes) to database and return all values. In my design: Table "Person" which contain records in following format: ("name", num, num, "group"). Following code displays: "None". What is wrong here? How to get all records for this "Table"?

class Person(db.Model):
    name = db.StringProperty()
    x = db.IntegerProperty()
    y = db.IntegerProperty()
    group = db.StringProperty()

class MainPage(webapp.RequestHandler):
   def get(self):
        username =  self.request.get('username')
        amy = Person(key_name='Amy', x=48, y=50, key_group='tll')
            amy.put()
            bob = Person(key_name='Bob', x=88, y=30, key_group='tll')
            bob.put()
            query = db.GqlQuery('SELECT * FROM Person' )
            for e in query:
                self.response.out.write('<blockquote>%s</blockquote>' %
                              e.name)

preguntado el 08 de noviembre de 11 a las 13:11

1 Respuestas

Well the code is right .

query = db.GqlQuery('SELECT * FROM Person' )

result = query.fetchAll() 
OR 
result = query.fetch(5)

respondido 08 nov., 11:17

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.