我有以下问题。
项目的 django-piston api 的 handlers.py:
....
# "need" to set this for datetime.strftime()
locale.setlocale(locale.LC_TIME,'de_AT.UTF-8')
class ItemOverviewHandler(BaseHandler):
...
@classmethod
def date(self, item):
# because of the setlocale() call the datestring is in german
# that's good
return item.somedatefield.date.strftime("%d. %B %Y")
...
现在看来这会影响项目的提要(使用 django.contrib.syndication 创建):
def item_pubdate(self, item):
return item.pub_date #datetime field
# the rss look's like this
# that's not good
<pubDate>Die, 17 Aug 2010 14:00:00 +0200</pubDate>
(这是一个 rfc 符合日期,但在德国 Die == Dienstag == 星期二),因此它是无效的。
所以我需要活塞 api 响应是德语(完成)。但是提要的 pubDate 必须是英文的(不知道如何做到这一点)。
有什么建议么?