我对Python和appengine还不太熟悉,但我要做的是存储一个包含DateProperty的模型,并且该DateProperty由用户在web表单中输入的日期填充。在
我有一个模型:class Memory(db.Model):
author = db.UserProperty()
content = db.StringProperty(multiline=True)
date = db.DateProperty()
然后创建一个实例:
^{pr2}$
但是一旦我试图对日期值做任何事情,我就会破坏它。我假设并输入日期值,格式如下:2009-07-21
我试过:memory.date = time.strptime(self.request.get('date'), '%Y-%m-%d')
memory.date = db.DateProperty(self.request.get('date'))
memory.date = self.request.get('date') (wishful thinking I guess)
还有一些其他的选择我现在都不记得了。我所尝试的一切都会导致一个ImportError,其结尾是一个巨大的堆栈跟踪:: No
module named _multiprocessing
args = ('No module named _multiprocessing',)
message = 'No module named _multiprocessing'
我不知道该怎么解释。在
我来自一个PHP世界,strtotime()是我的神奇函数,它为我提供了转换所需的一切,而date()函数可以处理其余的格式化。现在我看到了内联lambda(??)功能和其他功能。在
我在看似简单的事情上遗漏了什么。在