From fc08cfbfdeac621ad783c4c8026c4b7d272d0d27 Mon Sep 17 00:00:00 2001 From: Vincent Zeng Date: Thu, 15 Mar 2018 23:35:40 -0400 Subject: [PATCH] fixing some publishing checks --- ttbp/core.py | 12 ++++++++++-- ttbp/ttbp.py | 2 +- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/ttbp/core.py b/ttbp/core.py index 1b46957..912497b 100644 --- a/ttbp/core.py +++ b/ttbp/core.py @@ -42,6 +42,7 @@ import json from . import chatter from . import config from . import gopher +from . import util FEED = os.path.join("/home", "endorphant", "public_html", "ttbp", "index.html") SETTINGS = {} @@ -84,6 +85,7 @@ def get_files(feelsdir=config.MAIN_FEELS): for filename in os.listdir(feelsdir): if nopub(filename): unpublish_feel(filename) + continue ''' link = os.path.join(config.WWW, os.path.splitext( @@ -108,12 +110,17 @@ def load_files(feelsdir=config.MAIN_FEELS): * reads user's nopub file * calls get_files() to load all files for given directory + * re-renders main html file ''' global FILES load_nopubs() FILES = get_files(feelsdir) + if publishing(): + write_html("index.html") + if SETTINGS.get('gopher'): + gopher.publish_gopher('feels', FILES) def load_nopubs(): """Load a list of the user's nopub entries. @@ -458,8 +465,8 @@ def toggle_nopub(filename): nopub_file.close() load_files() - write_html("index.html") - gopher.publish_gopher('feels', FILES) + #write_html("index.html") + #gopher.publish_gopher('feels', FILES) return action @@ -483,6 +490,7 @@ def unpublish_feel(filename): os.path.splitext(os.path.basename(filename))[0]+".html") #live_html = os.path.join(config.WWW, filename.split(".")[0]+".html") if os.path.exists(live_html): + print(live_html) subprocess.call(["rm", live_html]) live_gopher = os.path.join(config.GOPHER_PATH, filename) if os.path.exists(live_gopher): diff --git a/ttbp/ttbp.py b/ttbp/ttbp.py index d4533a3..8f1dabe 100644 --- a/ttbp/ttbp.py +++ b/ttbp/ttbp.py @@ -544,7 +544,7 @@ def main_menu(): redraw(intro) review_menu(intro) core.load_files() - core.write_html("index.html") + #core.write_html("index.html") elif choice == '2': users = core.find_ttbps() prompt = "the following {usercount} {are} recording feels on ttbp:".format(