commit 72fd43c87c5bc56b8173c56f95d91408119f3d40
parent 2409e608f3d7d53196dcf12d1b9fd1b520b9fe28
Author: nolash <dev@holbrook.no>
Date: Fri, 3 Jul 2020 23:46:11 +0200
Add reasonable couchdb adapter and first unit test file
Diffstat:
3 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/feedwarrior/adapters/fileadapter.py b/feedwarrior/adapters/fileadapter.py
@@ -45,7 +45,11 @@ class fileadapter:
return c
- def put(self, uu, contents_bytes, **kwargs):
+ def put(self, uu, entry, **kwargs):
+
+ entry_serialized = entry.serialize()
+ entry_json = json.dumps(entry_serialized)
+
entry_path = os.path.join(self.src, 'entries', str(uu))
if os.path.exists(entry_path) or os.path.exists(entry_path + '.gz'):
raise FileExistsError('record {} already exists'.format(str(uu)))
diff --git a/feedwarrior/cmd/entry.py b/feedwarrior/cmd/entry.py
@@ -33,13 +33,10 @@ def execute(config, feed, args):
uu = feedwarrior.common.parse_uuid(t)
entry.add_extension(feedwarrior.extension.TASKWARRIOR, uu)
- entry_serialized = entry.serialize()
uu = str(entry.uuid)
logg.debug('adding entry {}'.format(uu))
fa = fileadapter(config.data_dir, feed.uuid)
-
- entry_json = json.dumps(entry_serialized)
- fa.put(entry.uuid, entry_json.encode('utf-8'), args.z)
+ fa.put(entry.uuid, entry, args.z)
feed.add(entry)
diff --git a/feedwarrior/entry.py b/feedwarrior/entry.py
@@ -63,7 +63,6 @@ class entry:
def from_multipart_file(filename, hashers=defaulthashers):
-#def process_as_multipart_file(config, feed, filename):
f = None
try:
f = open(filename, 'r')