0

我有模特

class info(db.Model):
    user = db.UserProperty()
    last_update_date = db.DateTimeProperty()

我需要last_update_date为特定用户检索。它工作得很好,我可以检索这个值,我什至可以将它传递给另一个变量

if results:
    for result in results:            
        data = result.last_update_date  

当我尝试将其分配给

feed_uri = contacts.GetFeedUri()
feed_query = gdata.contacts.service.ContactsQuery(feed_uri) 
feed_query.updated_min = data

这是在任何循环之外完成的,所以我不明白为什么它说 datetime 不可迭代。我收到的错误消息是

回溯(最近一次通话最后):文件“C:\Program Files (x86)\Google\google_appengine\google\appengine\ext\webapp__init__.py”,第 507 行,通话中 handler.get(*groups) 文件“C:\Users\mklich\workspace\google_contacts_webapp\src\contacts-list.py”,第 266 行,在 get listc = checkUserPrivateContacts(user) 文件“C:\Users\mklich\workspace \google_contacts_webapp\src\contacts-list.py",第 189 行,在 checkUserPrivateContacts feed = contacts.GetContactsFeed(feed_query.ToUri()) 文件“C:\Users\mklich\workspace\google_contacts_webapp\src\gdata\service.py”中,第 1718 行,在 ToUri 返回 atom.service.BuildUri(q_feed, self) File "C:\Users\mklich\workspace\google_contacts_webapp\src\atom\service.py",第 584 行,在 BuildUri parameter_list = DictionaryToParamList(url_params, escape_params) 文件“C:\Users\mklich\workspace\google_contacts_webapp\src\atom\service.py”,第 551 行,在 DictionaryToParamList 中用于参数,(url_parameters 或 {}).items()] 文件“C:\Python25\lib\urllib.py”中的值,第 1210 行,在 quote_plus 中 if '' in s: TypeError: 'datetime.datetime' 类型的参数不是可迭代的

我做错了什么还是一个错误?感谢您的回复。

4

1 回答 1

1

联系人 API 文档中的一个示例:

updated_min = raw_input('Enter updated min (example: 2007-03-16T00:00:00): ')
query = gdata.contacts.service.ContactsQuery()
query.updated_min = updated_min

我认为该updated_min属性需要一个字符串,而不是一个datetime对象。

于 2009-10-31T01:37:54.590 回答