Commits

Konstantine Rybnikov committed d08ba66

ok, works nice on mongoengine

  • Participants
  • Parent commits 4f0327a

Comments (0)

Files changed (2)

File openju/controllers/message.py

     
     # render part
     ret_val = u''
-    if messages.count():
+    if len(messages):
         for message in reversed(list(messages)):
             ret_val += (
                 u"\n@%(user)s:\n"
                 u"%(body)s\n"
                 u"#%(m_id)s posted %(dt)s\n") % dict(
-                user = message['user']['nick'],
-                body = message['body'],
-                m_id = message['_id'],
-                dt = pretty_date(message['dt']))
+                user = message.user.nick,
+                body = message.body,
+                m_id = message.id,
+                dt = pretty_date(message.dt))
     else:
         ret_val = u'There are no messages yet. Go on, post one!'
     return ret_val

File openju/model.py

 class Message(Document):
     user = ReferenceField(User, required=True)
     body = StringField(required=True)
-    dt = DateTimeField(default=datetime.datetime.now, required=True)
+    dt = DateTimeField(default=datetime.datetime.utcnow, required=True)
     tags = ListField(StringField(max_length=50))
     reply_to = ReferenceField('self')