change modified timestamp after update

pull/16/head
posativ 12 years ago
parent 633b0bee33
commit 36add653a7

@ -63,6 +63,5 @@ class Comment(object):
return self.mode == 2
def comment(app, environ, request, path, id=None):
return Response('', 200)

@ -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):

@ -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):

Loading…
Cancel
Save