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