Ah... missed that point!

On Sep 14, 4:53 pm, Robert Kluin <[email protected]> wrote:
> You are trying to filter based on a TextProperty.  Change Alias to a
> StringProperty and it will work just fine.
>
> See:http://code.google.com/appengine/docs/python/datastore/typesandproper...
>
> Robert
>
> On Mon, Sep 14, 2009 at 3:30 PM, PatHaugen <[email protected]> wrote:
>
> > I included the entire sample app where I recreated the problem, but
> > the root of it all is that in the example provided, 'query.filter' as
> > well as GQL 'SELECT * FROM ___ WHERE' is also having the same issue.
>
> > The sample app I provided just populates data and shows without
> > filters, it works, and with filters it fails to pull anything.
>
> > The reason the filters fail in this sample is where I'm asking for any
> > insight?
>
> > On Sep 14, 11:49 am, PatHaugen <[email protected]> wrote:
> > > I was coding an app and found that 'query.filter' was failing to work
> > > using query and GQL equivalent 'where' was not working either.
>
> > > I created a simple app to check if this was true... code posted below
> > > and I ask... how can this be broken?
>
> > > --
>
> > > import cgi
> > > import os
> > > import re
> > > from google.appengine.ext.webapp import template
> > > from google.appengine.api import users
> > > from google.appengine.ext import webapp
> > > from google.appengine.ext.webapp.util import run_wsgi_app
> > > from google.appengine.ext import db
> > > class TestData(db.Model):
> > >   Alias = db.TextProperty()
> > >   Content = db.TextProperty()
> > > class CreateData(webapp.RequestHandler):
> > >   def get(self):
> > >     newTestData = TestData(
> > >       Alias  =  'test1',
> > >       Content  =  '<h1>Test 1 loaded</h1><div style="border: 1px solid
> > > red;">Test 1 loaded</div>',
> > >     )
> > >     newTestData.put()
> > >     newTestData = TestData(
> > >       Alias  =  'test2',
> > >       Content  =  '<h1>bluetemplate loaded</h1><div style="border: 1px
> > > solid blue;">{{ content }}</div>'
> > >     )
> > >     newTestData.put()
> > >     self.redirect('/')
> > > class MainPage(webapp.RequestHandler):
> > >   def get(self):
> > >     query = db.Query(TestData)
> > >     query = TestData.all()
> > >     #query.filter('Alias = ', 'test1') # Uncomment this filter, and no
> > > results match for 'test1' or 'test2'
> > >     results = query.fetch(limit=1)
> > >     #results = db.GqlQuery("SELECT * FROM TestData WHERE Alias = :1",
> > > 'test1') # Uncomment this to see GQL also fails...
> > >     for result in results:
> > >       output = result.Content
> > >       self.response.out.write(output)
> > > application = webapp.WSGIApplication(
> > >   [
> > >     ('/createdata', CreateData),
> > >     ('/.*', MainPage),
> > >   ],
> > >   debug=True
> > >   )
> > > def main():
> > >   run_wsgi_app(application)
> > > if __name__ == "__main__":
> > >   main()
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to