On Saturday, September 21, 2019 at 2:04:22 AM UTC-5, Edward K. Ream wrote:
#1341 ..suggests that calls to g.os_path_expandExpression should be
strictly limited to the context in which they were originally proposed,
namely to compute paths in @<file> nodes.
The culprit is the overly-clever distinction between c.os_path_finalize* and g.os_path_finalize*. The commander methods expand path expressions; the global functions do not.
Leo's contains 27 nodes that call c.os_path_finalize*:
- 7 nodes are directly involved with path computations in leoAtFile.py.
- 5 nodes are legitimately involved in path computations elsewhere. Some should partially change.
- The remaining 15, including 3 ShadowController methods, probably should call g.os_path_finalize* instead.
Two nodes in plugins call c.os_path_finalize*. Both these should call g.os_path_finalize* instead.
Proposed fix
- The c.os_path_finalize* methods will be deprecated. They will call g.os_path_finalize*, with a deprecation warning.
- All calls to c.os_path_finalize* should be changed to calls to g.os_path_finalize*, with a #1341 comment.
- 12 nodes, all in Leo's core, should explicitly call g.os_path_expandExpression in addition to g.os_path_finalize*.
Summary
Imo, this is an important change, worth the risks inherent in any significant change to Leo's code base.
This is a variation of the evils of extra kwargs that Vitalije has properly warned against.
Edward