Ahhh I had wondered how you had defined it, but was thinking that maybe the indexes hadn't been built yet or something like that.
Cheers T On Mar 22, 3:06 am, Versluys Sander <[email protected]> wrote: > Tim, couple minutes after I invited you as developer and while trying > some queries, I suddenly realised what the problem was. > > I suddenly remembered from the docs that TextProperty does not get > indexed so searching on that 'field' is not possible. > > I've changed the model accordingly and now i get the desired results. > > class Page(db.Model): > title = db.StringProperty(required=True) > uri = db.StringProperty(required=True) > created = db.DateTimeProperty(auto_now_add=True) > modified = db.DateTimeProperty(auto_now=True) > content = db.TextProperty() > > Thanks again for hanging with me, it helped a lot! > > On 21 mrt, 15:36, Tim Hoffman <[email protected]> wrote: > > > Hi > > > On Mar 21, 9:38 pm, Versluys Sander <[email protected]> wrote: > > > > Tim, that's great advice. I'm still getting used to having a > > > interactive console for this debug sort of thing. > > > No probs > > > Now I am really stumped ;-) Can you do a filter on any other > > attribute of that entity and see if you can fetch it that way ? > > > Not sure what to look for now. > > > Can you find any other page specifying the uri ? > > > T > > > > With following code the console print my '/work' uri so, this way i > > > get a match. > > > > from pages import models > > > > for i in models.Page.all(): > > > if i.uri == '/work': > > > print i.uri > > > > But when using the following, the filter method return None: > > > > from pages import models > > > > p = models.Page.all().filter('uri = ', '/work').get() > > > print p.content > > > > Btw thanks for helping me like that! ;-) > > > > On 21 mrt, 12:49, Tim Hoffman <[email protected]> wrote: > > > > > In fact you should do a manual loop comparison > > > > > for i in Page.all(): > > > > > if i.uri == uri: > > > > do something > > > > > This will provide that uri you have and the value in the model match. > > > > > T > > > > > On Mar 21, 8:41 pm, Tim Hoffman <[email protected]> wrote: > > > > > > Just to test what is actually in I would do the following > > > > > > Page.all(): > > > > > > and iteraterate through the items and do a repr on the url to just > > > > > check what is actually stored. > > > > > > And alternatley try us the above approach rather than gql as in > > > > > > Page.all().filter('uri = ',uri) > > > > > > Rgds > > > > > > T > > > > > and iterate through all the pages and check uri > > > > > with a > > > > > On Mar 2 8:37 pm, Tim Hoffman <[email protected]> wrote: > > > > > > > Do you mean "\work' or '/work' > > > > > > > '\' is an escaping character > > > > > > > T > > > > > > > On Mar 21, 8:19 pm, Versluys Sander <[email protected]> > > > > > > wrote: > > > > > > > > Yes that idd correct, i provided a wrong sample. > > > > > > > > But even when using correct named or positional parameters, it > > > > > > > does > > > > > > > nog match. > > > > > > > > Is it possible it has todo with escaping. The uri contains > > > > > > > '\work'. > > > > > > > I've used Django Forms the generate a form for the Page entity. > > > > > > > Does > > > > > > > it auto escape? > > > > > > > > Thanks! > > > > > > > > On 21 mrt, 10:54, Tim Hoffman <[email protected]> wrote: > > > > > > > > > One thing to check > > > > > > > > Your query as pasted is > > > > > > > > > page = db.GqlQuery('SELECT * FROM Page WHERE uri=:uri', > > > > > > > > request.path).get() > > > > > > > > > I think it should read > > > > > > > > > page = db.GqlQuery('SELECT * FROM Page WHERE uri=:uri', > > > > > > > > uri=request.path).get() > > > > > > > > or > > > > > > > > page = db.GqlQuery('SELECT * FROM Page WHERE uri=:1', > > > > > > > > request.path).get > > > > > > > > () > > > > > > > > > In otherwords you need to provide named keywords args if you > > > > > > > > name the > > > > > > > > param in the query > > > > > > > > or if you use positional args then number the args. > > > > > > > > > You should actually be getting an error like > > > > > > > > > File "/home/timh/google_appengine/google/appengine/ext/gql/ > > > > > > > > __init__.py", line 539, in __GetParam > > > > > > > > reference) > > > > > > > > BadArgumentError: Missing named arguments for bind, requires > > > > > > > > argument > > > > > > > > id > > > > > > > > > See ya > > > > > > > > > T > > > > > > > > > T > > > > > > > > > On Mar 21, 6:14 pm, Versluys Sander <[email protected]> > > > > > > > > wrote: > > > > > > > > > > I have a model: > > > > > > > > > > class Page(db.Model): > > > > > > > > > title = db.StringProperty(required=True) > > > > > > > > > uri = db.TextProperty(required=True) > > > > > > > > > created = db.DateTimeProperty(auto_now_add=True) > > > > > > > > > modified = db.DateTimeProperty(auto_now=True) > > > > > > > > > content = db.TextProperty() > > > > > > > > > > And I've added an entity with '/work' as uri to the datastore. > > > > > > > > > > In my view: > > > > > > > > > > def show(request): > > > > > > > > > page = db.GqlQuery('SELECT * FROM Page WHERE uri=:uri', > > > > > > > > > request.path).get() > > > > > > > > > if page is None: > > > > > > > > > return http.HttpResponseNotFound() > > > > > > > > > else: > > > > > > > > > return respond(request, 'pages_show', {'content': > > > > > > > > > request.path}) > > > > > > > > > > Even when request.path is exactly '/work', the query does not > > > > > > > > > return a > > > > > > > > > match. > > > > > > > > > > Thanks for any advice you can give me! > > > > > > > > > > And yes, i'm a python noob, App Engine is perfect to finally > > > > > > > > > learn the > > > > > > > > > language. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
