2009-05-21 54 views
0

我遇到了跟​​隨問題。我錯過了什麼嗎?帶字符串的過濾器沒有任何返回

Association.all().count() 
1 

Association.all().fetch(1) 
[Association(**{'server_url': u'server-url', 'handle': u'handle2', 'secret': 'c2VjcmV0\n', 'issued': 1242892477L, 'lifetime': 200L, 'assoc_type': u'HMAC-SHA1'})] 

Association.all().filter('server_url =', 'server-url').count() 
0 # expect 1 

Association.all().filter('server_url =', u'server-url').count() 
0 # expect 1 

Association.all().filter('issued >', 0).count() 
1 
+0

不知道GAE,但應在 「=」 是 「==」 呢? – user49117 2009-05-21 10:37:25

回答

5

什麼樣的屬性是「server_url」?

如果它是一個TextProperty,那麼它不能在過濾器中使用。

與StringProperty不同,TextProperty 值的長度可能超過500個字節。 但是,TextProperty值不是 已編制索引,並且不能用於篩選器 或排序順序。

http://code.google.com/appengine/docs/python/datastore/typesandpropertyclasses.html#TextProperty

+0

用戶在官方論壇上發佈了相同的內容;這是解決方案。 – 2009-05-21 19:01:02