chrisallenlane/cheat — pull request #171 by laomaiweng (2014-07-24 02:01:41+00:00)
Title: Fix editing after copying an unwritable cheatsheet to DEFAULT_CHEAT_DIR

When editing (cheat -e) a unwritable cheatsheet, cheat offers to copy it
to DEFAULT_CHEAT_DIR and edit it there. However, due to the caching of
cheatsheets locations in sheets.cheat
(chrisallenlane/afcaaafbe59c0c24c41ec481a0b0b5cd913fa10f), sheet.edit()
uses the cached location of the sheet instead of the new location, hence
firing up the editor on the unwritable cheatsheet.

I see two ways of fixing this:
* manually fire up the editor on the new (supposedly writable) location
* update or invalidate the sheets.cheat cache and use sheet.edit()

I went the manual-invocation-of-$EDITOR way since it's the most
straightforward for me as a Python noob. Currently it doesn't harm
(apart from breaking a bit of code factorization) since the cache isn't
used after this action (and thus we don't care if it's not up-to-date).
However, it may be more future-proof to invalidate (or better, update)
the cache, as otherwise this bug may bite again some day if an action
that uses the obsolete cache is added after the editing of the new
cheatsheet.