breaking out nopub into its own function

master
endorphant 2016-05-31 15:03:34 -04:00
parent d1d4b2cc8f
commit 0fe5b9553a
2 changed files with 20 additions and 8 deletions

View File

@ -483,10 +483,13 @@ def view_feels(townie):
''' '''
filenames = [] filenames = []
showpub = False
if townie == USER: if townie == USER:
entryDir = DATA entryDir = DATA
owner = "your" owner = "your"
if core.publishing():
showpub = True
else: else:
owner = "~"+townie+"'s" owner = "~"+townie+"'s"
entryDir = os.path.join("/home", townie, ".ttbp", "entries") entryDir = os.path.join("/home", townie, ".ttbp", "entries")
@ -497,8 +500,9 @@ def view_feels(townie):
if len(filenames) > 0: if len(filenames) > 0:
entries = [] entries = []
pub = ""
for entry in metas: for entry in metas:
entries.append(""+entry[4]+" ("+p.no("word", entry[2])+") ") entries.append(""+entry[4]+" ("+p.no("word", entry[2])+") "+"\t"+pub)
return list_entries(metas, entries, owner+" recorded feels, listed by date: \n") return list_entries(metas, entries, owner+" recorded feels, listed by date: \n")
else: else:

View File

@ -79,15 +79,10 @@ def load_files():
global FILES global FILES
exclude = []
if os.path.isfile(NOPUB):
for line in open(NOPUB, "r"):
exclude.append(line.rstrip())
FILES = [] FILES = []
for filename in os.listdir(DATA): for filename in os.listdir(DATA):
if filename in exclude: if nopub(filename):
continue continue
filename = os.path.join(DATA, filename) filename = os.path.join(DATA, filename)
if os.path.isfile(filename) and valid(filename): if os.path.isfile(filename) and valid(filename):
@ -395,6 +390,19 @@ def www_neighbors():
write_global_feed(sortedUsers) write_global_feed(sortedUsers)
def nopub(filename):
'''
checks to see if given filename is in user's NOPUB
'''
exclude = []
if os.path.isfile(NOPUB):
for line in open(NOPUB, "r"):
exclude.append(line.rstrip())
return os.path.basename(filename) in exclude
############# #############
############# #############
############# #############