Fix SQLite date sorting
This commit is contained in:
parent
f29a53be94
commit
a571a78215
1 changed files with 4 additions and 3 deletions
|
@ -5,6 +5,7 @@ import sys
|
|||
import os
|
||||
import re
|
||||
import logging
|
||||
import datetime
|
||||
from clize import clize, run
|
||||
|
||||
# add necessary directories to PATH
|
||||
|
@ -34,7 +35,6 @@ logger.addHandler(ch)
|
|||
# regex
|
||||
regex = re.compile(r"(\w+):\s*(.*)")
|
||||
|
||||
|
||||
def convert_comment(db, site, filename):
|
||||
logger.info('convert %s' % filename)
|
||||
d = {}
|
||||
|
@ -69,8 +69,9 @@ def convert_comment(db, site, filename):
|
|||
# else:
|
||||
# comment.url = d['article']
|
||||
if 'date' in d:
|
||||
comment.created = d['date']
|
||||
comment.published = d['date']
|
||||
pub = datetime.datetime.strptime(d['date'], '%Y-%m-%d %H:%M:%S')
|
||||
comment.created = pub
|
||||
comment.published = pub
|
||||
comment.save()
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue