clone item data before removing date time
This commit is contained in:
parent
825a42b497
commit
bd9cf01b91
1 changed files with 10 additions and 7 deletions
|
|
@ -1,4 +1,5 @@
|
||||||
from collections import OrderedDict
|
from collections import OrderedDict
|
||||||
|
import copy
|
||||||
from datetime import datetime, timezone
|
from datetime import datetime, timezone
|
||||||
from email.utils import formatdate
|
from email.utils import formatdate
|
||||||
import json
|
import json
|
||||||
|
|
@ -121,21 +122,23 @@ class DataStore:
|
||||||
ON CONFLICT DO UPDATE SET "type" = ?, "url" = ?, "data" = ?
|
ON CONFLICT DO UPDATE SET "type" = ?, "url" = ?, "data" = ?
|
||||||
"""
|
"""
|
||||||
|
|
||||||
if hasattr(item, 'datetime'):
|
stored = copy.deepcopy(item)
|
||||||
|
|
||||||
|
if hasattr(stored, 'datetime'):
|
||||||
try:
|
try:
|
||||||
delattr(item, 'datetime')
|
delattr(stored, 'datetime')
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
with sqlite3.connect(self.db_file) as db:
|
with sqlite3.connect(self.db_file) as db:
|
||||||
db.execute(sqlStatement.strip(), (
|
db.execute(sqlStatement.strip(), (
|
||||||
item._id,
|
stored._id,
|
||||||
type,
|
type,
|
||||||
item.url,
|
stored.url,
|
||||||
item.json(),
|
stored.json(),
|
||||||
type,
|
type,
|
||||||
item.url,
|
stored.url,
|
||||||
item.json(),
|
stored.json(),
|
||||||
))
|
))
|
||||||
|
|
||||||
def _deleteStoreItem(self, key: str) -> None:
|
def _deleteStoreItem(self, key: str) -> None:
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue