refactor *Source classes in tahoe_cp.py to have a basename() method rather than passing around (name, source) pairs #2047

Open
opened 2013-08-07 00:48:48 +00:00 by daira · 2 comments
daira commented 2013-08-07 00:48:48 +00:00
Owner

Much of the code in source:src/allmydata/scripts/tahoe_cp.py passes around (name, source) pairs, where the name is the basename (i.e. last path component) of the source object. The source object should instead have a basename() method. (It is called that in Twisted's FilePath API.)

Much of the code in source:src/allmydata/scripts/tahoe_cp.py passes around `(name, source)` pairs, where the name is the basename (i.e. last path component) of the source object. The source object should instead have a `basename()` method. (It is called that in Twisted's `FilePath` API.)
tahoe-lafs added the
code-frontend-cli
normal
defect
1.10.0
labels 2013-08-07 00:48:48 +00:00
tahoe-lafs added this to the undecided milestone 2013-08-07 00:48:48 +00:00
tahoe-lafs changed title from refactor *Source classes in tahoe-cp.py to have a basename() method rather than passing around (name, source) pairs to refactor *Source classes in tahoe_cp.py to have a basename() method rather than passing around (name, source) pairs 2013-08-07 00:49:17 +00:00

The source object might be a pure filecap or dircap, and thus have no name. I think I wrote it this way (with tuples) as a reminder of that feature/property. I wouldn't object to moving this value into an property or method of the TahoeFileSource and LocalFileSource objects, but I'm not sure that basename() is the best name for it, if that's likely to imply that it always exists.

I think this assumption is the root cause for the #2329 regression.

The source object might be a pure filecap or dircap, and thus have no name. I think I wrote it this way (with tuples) as a reminder of that feature/property. I wouldn't object to moving this value into an property or method of the `TahoeFileSource` and `LocalFileSource` objects, but I'm not sure that `basename()` is the best name for it, if that's likely to imply that it always exists. I think this assumption is the root cause for the #2329 regression.
daira commented 2015-01-20 21:27:49 +00:00
Author
Owner

Well, the bad assumption was made for the existing tuple approach, in any case. I'm not insistent on calling it basename(); it could be called something like basename_if_present() or basename_or_None() if that helps.

Well, the bad assumption was made for the existing tuple approach, in any case. I'm not insistent on calling it `basename()`; it could be called something like `basename_if_present()` or `basename_or_None()` if that helps.
Sign in to join this conversation.
No Milestone
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Reference: tahoe-lafs/trac-2024-07-25#2047
No description provided.