diff options
author | toonn <toonn@toonn.io> | 2019-09-26 11:47:39 +0200 |
---|---|---|
committer | toonn <toonn@toonn.io> | 2019-09-27 14:42:45 +0200 |
commit | f6fa67646d72b3e1872a9b64633018dde93a698a (patch) | |
tree | d3a483bf1a87cb4a72b26474150c29a8ae80914a /tests | |
parent | 2c33cedaaac2a21d538f20fcb6fc36e23467a79d (diff) | |
download | ranger-f6fa67646d72b3e1872a9b64633018dde93a698a.tar.gz |
Add MacroDict
Macros are resolved for set commands. A contributor wanted to add a setting for a date format string to be used in ranger's status bar. The string they tried happened to include `%d` which is a valid ranger macro for the name of `thisdir`. This attribute is not yet defined when ranger is reading `rc.conf` and this uncaught exception would crash ranger. To work around this we need to catch `AttributeError`s for values that might not exist yet. To avoid the repetition that'd come with all these try-catch statements that behavior has been encapsulated in a new MacroDict. This is almost as easy to use as the regular python dictionary used previously. The only difference being that we need to wrap values that might cause problems in a python `lambda`, though it doesn't do any harm to wrap values that can't raise exceptions.
Diffstat (limited to 'tests')
0 files changed, 0 insertions, 0 deletions