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 os
|
||||||
import re
|
import re
|
||||||
import logging
|
import logging
|
||||||
|
import datetime
|
||||||
from clize import clize, run
|
from clize import clize, run
|
||||||
|
|
||||||
# add necessary directories to PATH
|
# add necessary directories to PATH
|
||||||
|
@ -34,7 +35,6 @@ logger.addHandler(ch)
|
||||||
# regex
|
# regex
|
||||||
regex = re.compile(r"(\w+):\s*(.*)")
|
regex = re.compile(r"(\w+):\s*(.*)")
|
||||||
|
|
||||||
|
|
||||||
def convert_comment(db, site, filename):
|
def convert_comment(db, site, filename):
|
||||||
logger.info('convert %s' % filename)
|
logger.info('convert %s' % filename)
|
||||||
d = {}
|
d = {}
|
||||||
|
@ -69,8 +69,9 @@ def convert_comment(db, site, filename):
|
||||||
# else:
|
# else:
|
||||||
# comment.url = d['article']
|
# comment.url = d['article']
|
||||||
if 'date' in d:
|
if 'date' in d:
|
||||||
comment.created = d['date']
|
pub = datetime.datetime.strptime(d['date'], '%Y-%m-%d %H:%M:%S')
|
||||||
comment.published = d['date']
|
comment.created = pub
|
||||||
|
comment.published = pub
|
||||||
comment.save()
|
comment.save()
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue