forked from endorphant/ttbp
correcting some nopub toggle behavior
parent
3c00d793c6
commit
5097da89bb
|
@ -447,16 +447,16 @@ def toggle_nopub(filename):
|
||||||
action = "unpublishing"
|
action = "unpublishing"
|
||||||
|
|
||||||
if nopub(filename):
|
if nopub(filename):
|
||||||
|
action = "publishing"
|
||||||
NOPUBS.remove(filename)
|
NOPUBS.remove(filename)
|
||||||
|
else:
|
||||||
|
NOPUBS.append(filename)
|
||||||
live_html = os.path.join(config.WWW, filename.split(".")[0]+".html")
|
live_html = os.path.join(config.WWW, filename.split(".")[0]+".html")
|
||||||
if os.path.exists(live_html):
|
if os.path.exists(live_html):
|
||||||
subprocess.call(["rm", live_html])
|
subprocess.call(["rm", live_html])
|
||||||
live_gopher = os.path.join(config.GOPHER_PATH, filename)
|
live_gopher = os.path.join(config.GOPHER_PATH, filename)
|
||||||
if os.path.exists(live_gopher):
|
if os.path.exists(live_gopher):
|
||||||
subprocess.call(["rm", live_gopher])
|
subprocess.call(["rm", live_gopher])
|
||||||
else:
|
|
||||||
action = "publishing"
|
|
||||||
NOPUBS.append(filename)
|
|
||||||
|
|
||||||
nopub_file = open(config.NOPUB, 'w')
|
nopub_file = open(config.NOPUB, 'w')
|
||||||
nopub_file.write("""\
|
nopub_file.write("""\
|
||||||
|
@ -469,7 +469,6 @@ def toggle_nopub(filename):
|
||||||
nopub_file.close()
|
nopub_file.close()
|
||||||
|
|
||||||
load_files()
|
load_files()
|
||||||
write("index.html")
|
|
||||||
|
|
||||||
return action
|
return action
|
||||||
|
|
||||||
|
|
|
@ -51,7 +51,6 @@ entries:
|
||||||
def select_gopher():
|
def select_gopher():
|
||||||
return util.input_yn(GOPHER_PROMPT)
|
return util.input_yn(GOPHER_PROMPT)
|
||||||
|
|
||||||
|
|
||||||
def publish_gopher(gopher_path, entry_filenames):
|
def publish_gopher(gopher_path, entry_filenames):
|
||||||
"""This function (re)generates a user's list of feels posts in their gopher
|
"""This function (re)generates a user's list of feels posts in their gopher
|
||||||
directory and their gophermap."""
|
directory and their gophermap."""
|
||||||
|
@ -103,8 +102,8 @@ def setup_gopher(gopher_path):
|
||||||
print("\n\tERROR: gopher path is already set up. quitting so we don't overwrite anything.")
|
print("\n\tERROR: gopher path is already set up. quitting so we don't overwrite anything.")
|
||||||
return
|
return
|
||||||
|
|
||||||
#os.makedirs(ttbp_gopher)
|
|
||||||
|
|
||||||
gopher_entries = os.path.join(os.path.expanduser("~/.ttbp"), "gopher")
|
gopher_entries = os.path.join(os.path.expanduser("~/.ttbp"), "gopher")
|
||||||
os.makedirs(gopher_entries)
|
if not os.path.isdir(gopher_entries):
|
||||||
|
os.makedirs(gopher_entries)
|
||||||
|
|
||||||
subprocess.call(["ln", "-s", gopher_entries, ttbp_gopher])
|
subprocess.call(["ln", "-s", gopher_entries, ttbp_gopher])
|
||||||
|
|
|
@ -826,6 +826,10 @@ def set_nopubs(metas, user, prompt):
|
||||||
action = core.toggle_nopub(target)
|
action = core.toggle_nopub(target)
|
||||||
redraw(prompt)
|
redraw(prompt)
|
||||||
|
|
||||||
|
core.write("index.html")
|
||||||
|
if SETTINGS["gopher"]:
|
||||||
|
gopher.publish_gopher('feels', core.get_files())
|
||||||
|
|
||||||
return set_nopubs(metas, user, prompt)
|
return set_nopubs(metas, user, prompt)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
|
@ -1140,6 +1144,9 @@ def update_gopher():
|
||||||
# there is demand for this to be configurable we can expose that.
|
# there is demand for this to be configurable we can expose that.
|
||||||
if SETTINGS.get("gopher"):
|
if SETTINGS.get("gopher"):
|
||||||
gopher.setup_gopher('feels')
|
gopher.setup_gopher('feels')
|
||||||
|
gopher.publish_gopher("feels", core.get_files())
|
||||||
|
else:
|
||||||
|
subprocess.call(["rm", config.GOPHER_PATH])
|
||||||
redraw("gopher publishing set to {gopher}".format(gopher=SETTINGS.get("gopher")))
|
redraw("gopher publishing set to {gopher}".format(gopher=SETTINGS.get("gopher")))
|
||||||
|
|
||||||
##### PATCHING UTILITIES
|
##### PATCHING UTILITIES
|
||||||
|
|
Loading…
Reference in New Issue