【问题标题】:filter with string return nothing用字符串过滤什么都不返回
【发布时间】:2009-05-21 08:46:18
【问题描述】:

我遇到了跟​​随问题。我错过了什么吗?

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

【问题讨论】:

  • 不知道GAE,但“=”应该是“==”吗?

标签: python google-app-engine


【解决方案1】:

“server_url”是什么属性?

如果是 TextProperty,则不能在过滤器中使用。

与 StringProperty 不同,TextProperty value 的长度可以超过 500 个字节。 但是,TextProperty 值不是 索引,并且不能在过滤器中使用 或排序。

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

【讨论】:

  • 用户在官方论坛上发布了相同的内容;这就是解决方案。
猜你喜欢
  • 1970-01-01
  • 2017-03-29
  • 2021-08-23
  • 2020-07-06
  • 2018-09-17
  • 1970-01-01
  • 1970-01-01
  • 2011-11-04
相关资源
最近更新 更多