diff --git a/isso/comments.py b/isso/comments.py index d2db16a..acd4291 100644 --- a/isso/comments.py +++ b/isso/comments.py @@ -63,6 +63,5 @@ class Comment(object): return self.mode == 2 - def comment(app, environ, request, path, id=None): return Response('', 200) diff --git a/isso/db.py b/isso/db.py index 42b1337..f57fa58 100644 --- a/isso/db.py +++ b/isso/db.py @@ -1,5 +1,6 @@ import abc +import time import sqlite3 from os.path import join @@ -94,6 +95,10 @@ class SQLite(Abstract): for field, value in comment.iteritems(): con.execute('UPDATE comments SET %s=? WHERE path=? AND id=?;' % field, (value, id, path)) + + with sqlite3.connect(self.dbpath) as con: + con.execute('UPDATE comments SET modified=? WHERE path=? AND id=?', + (time.time(), path, id)) return path, id def get(self, path, id): diff --git a/specs/test_db.py b/specs/test_db.py index 852315a..a0fdb02 100644 --- a/specs/test_db.py +++ b/specs/test_db.py @@ -1,6 +1,7 @@ import os import json +import time import tempfile import unittest @@ -48,11 +49,13 @@ class TestSQLite(unittest.TestCase): def test_update(self): path, id = self.db.add('/', comment(text='Foo')) + time.sleep(0.1) path, id = self.db.update(path, id, comment(text='Bla')) c = self.db.get(path, id) assert c.id == 1 assert c.text == 'Foo' + assert c.created < c.modified def test_delete(self):