feedwarrior

Slim, portable tooling for creating and distributing decentralized append logs
git clone git://git.defalsify.org/logwarrior.git
Info | Log | Files | Refs | README | LICENSE

commit 26bb9f90d8526dfed0754c203d1f0c01e47aabd5
parent 78a8dea14f95eba6e947f01fc5c8f29dd5947750
Author: lash <dev@holbrook.no>
Date:   Sat, 19 Oct 2024 16:12:58 +0100

Prevent uuid from changing during attach

Diffstat:
Mfeedwarrior/adapters/fileadapter.py | 2+-
Mfeedwarrior/cmd/attach.py | 2+-
Mfeedwarrior/config.py | 8+++++---
Mfeedwarrior/entry.py | 8+++++---
Mfeedwarrior/runnable/main.py | 2+-
Msetup.cfg | 2+-
6 files changed, 14 insertions(+), 10 deletions(-)

diff --git a/feedwarrior/adapters/fileadapter.py b/feedwarrior/adapters/fileadapter.py @@ -51,7 +51,7 @@ class fileadapter: typ = 'plain' if entry_path[-3:] == '.gz': entry_path = entry_path[:-3] - logg.debug('etnry {}'.format(entry_path)) + logg.debug('entry {}'.format(entry_path)) try: f = self.get_raw_fp(entry_path) except FileNotFoundError: diff --git a/feedwarrior/cmd/attach.py b/feedwarrior/cmd/attach.py @@ -67,6 +67,6 @@ def execute(config, feed, args): fp = os.path.realpath(args.file) attachment = from_file(m, fp) - entry = from_multipart(attachment) + entry = from_multipart(attachment, entry_uuid=args.entry) compress = fm == 'gzip' fa.put(args.entry, entry, replace=True, compress=compress) diff --git a/feedwarrior/config.py b/feedwarrior/config.py @@ -25,14 +25,16 @@ class config: config_paths += BaseDirectory.load_config_paths('feedwarrior') if filename != None: - for p in config_paths: - config_path = os.path.join(p, filename) + #for p in config_paths: + for config_path in config_paths: + #config_path = os.path.join(p, filename) r = cp.read(config_path) if len(r) == 0: logg.warning("config file in path {} not found".format(config_path)) continue - logg.info('successfully read config {}'.format(p)) + #logg.info('successfully read config {}'.format(p)) + logg.info('successfully read config {}'.format(config_path)) config_loaded = True if cp.has_option('FEEDWARRIOR', 'datadir'): diff --git a/feedwarrior/entry.py b/feedwarrior/entry.py @@ -109,7 +109,7 @@ def from_multipart_file(filename, hashers=defaulthashers): return from_multipart(m, hashers) -def from_multipart(m, hashers=defaulthashers): +def from_multipart(m, hashers=defaulthashers, entry_uuid=None): if not m.is_multipart(): raise NotMultipartError('not a MIME multipart message') @@ -143,10 +143,13 @@ def from_multipart(m, hashers=defaulthashers): i += 1 + uu = entry_uuid + # TODO: the uuid handling here makes no sense for h in htops: hasher = hparts[h.name] msum = hasher.digest() - uu = uuid.UUID(bytes=msum[:16]) + if uu == None: + uu = uuid.UUID(bytes=msum[:16]) #m.add_header('X-FEEDWARRIOR-HASH', htop.name) header_key = 'X-FEEDWARRIOR-{}'.format(h.name.upper()) m.add_header(header_key, base64.encodebytes(msum).decode('ascii')) @@ -156,4 +159,3 @@ def from_multipart(m, hashers=defaulthashers): logg.info('subject not specified, using uuid {}'.format(subject)) return entry(uu, m) - diff --git a/feedwarrior/runnable/main.py b/feedwarrior/runnable/main.py @@ -89,7 +89,7 @@ def main(): cmd_mod = None if args.command == None or matches_part('show', args.command): if feed_current == None: - sys.stderr.write('plesae speficy a feed for showing\n') + sys.stderr.write('please specify a feed for showing\n') sys.exit(1) feed_current = feedwarrior.load_feed(config.data_dir, feed_current.uuid) cmd_mod = cmd_show diff --git a/setup.cfg b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = feedwarrior -version = 0.5.7 +version = 0.5.8 description = Feeds, warrior style author = Louis Holbrook author_email = dev@holbrook.no