From 56419f2f43ad31ee075910d182d285ccc25fa054 Mon Sep 17 00:00:00 2001 From: endorphant Date: Wed, 7 Sep 2016 22:05:38 -0400 Subject: [PATCH] there was a major bug that caused users who opted not to publish to crash during version checking. the version checker was trying to update files associated with published blogs, and crashing due to trying to read null paths. this fix checks to see if the user has opted to publish *before* running those updates. --- bin/core.py | 4 +++- bin/ttbp.py | 31 ++++++++++++++++--------------- devnotes.txt | 12 ++++++++++++ 3 files changed, 31 insertions(+), 16 deletions(-) diff --git a/bin/core.py b/bin/core.py index 92365cf..0e871fb 100644 --- a/bin/core.py +++ b/bin/core.py @@ -382,7 +382,9 @@ def www_neighbors(): userRC = json.load(open(os.path.join("/home", user, ".ttbp", "config", "ttbprc"))) - url = LIVE+user+"/"+userRC["publish dir"] + url = "" + if userRC["publish dir"]: + url = LIVE+user+"/"+userRC["publish dir"] lastfile = "" files = os.listdir(os.path.join("/home", user, ".ttbp", "entries")) diff --git a/bin/ttbp.py b/bin/ttbp.py index 17e1dfd..51422b8 100644 --- a/bin/ttbp.py +++ b/bin/ttbp.py @@ -893,26 +893,27 @@ def update_version(): # from 0.8.5 to 0.8.6: # change style.css location - if os.path.isfile(os.path.join(WWW, "style.css")): - subprocess.call(["mv", os.path.join(WWW, "style.css"), CONFIG]) + if core.publishing(): + if os.path.isfile(os.path.join(WWW, "style.css")): + subprocess.call(["mv", os.path.join(WWW, "style.css"), CONFIG]) - # change www symlink - if os.path.exists(WWW): - subprocess.call(["rm", WWW]) - - subprocess.call(["mkdir", WWW]) + # change www symlink + if os.path.exists(WWW): + subprocess.call(["rm", WWW]) + + subprocess.call(["mkdir", WWW]) - subprocess.call(["ln", "-s", os.path.join(CONFIG, "style.css"), os.path.join(WWW, "style.css")]) + subprocess.call(["ln", "-s", os.path.join(CONFIG, "style.css"), os.path.join(WWW, "style.css")]) - publishDir = os.path.join(PUBLIC, SETTINGS.get("publish dir")) - if os.path.exists(publishDir): - subprocess.call(["rm", "-rf", publishDir]) + publishDir = os.path.join(PUBLIC, SETTINGS.get("publish dir")) + if os.path.exists(publishDir): + subprocess.call(["rm", "-rf", publishDir]) - subprocess.call(["ln", "-s", WWW, os.path.join(PUBLIC, SETTINGS.get("publish dir"))]) + subprocess.call(["ln", "-s", WWW, os.path.join(PUBLIC, SETTINGS.get("publish dir"))]) - # repopulate html files - core.load_files() - core.write("index.html") + # repopulate html files + core.load_files() + core.write("index.html") # add publishing setting print("\nnew feature!\n") diff --git a/devnotes.txt b/devnotes.txt index 015bd5c..565ed3f 100644 --- a/devnotes.txt +++ b/devnotes.txt @@ -3,3 +3,15 @@ NOTES FOR ~ENDO handling global feels out of order: -check to see if entry filename date and mtime date matches -if not, process as if it was last modified on the date indicated by filename + +stuff to sort out: + + -figure out how to deal with entries scrolling too far (either learn more + curses handling, or find someone who knows how to do curses stuff) + + -there's like some seriously weird out of order updating for publishing that + breaks things too much + +user-friendliness: + -reset button, instead of having to manually delete things + -wall lock clearing