quick patch to catch oserror if someone deletes their .ttbp directory

master
endorphant 2018-02-25 00:16:37 -05:00
parent 9546c67e0c
commit 52496aaf51
3 changed files with 28 additions and 67 deletions

View File

@ -1,56 +0,0 @@
TTBP MANIFESTO
--------------
ttbp: tilde town blogging platform; also known as THE FEELS ENGINE
a history:
in april 2016, i read a short rant by ~minerobber lamenting the lack of cli
blogging software. this struck a chord with me; years ago, i kludged myself a
perl script that generated an html blog, complete with an rss feed and a
crude tagging system. i've known other people who have done the same. what's
missing, though?
years ago, i peeled away from livejournal and related web-based blogging
networks; partially as a participant in the general attrition, and partially
to escape some personal bad feelings that i coudn't quite put a finger on.
this is why i started writing on an independent, solo blog; i still had the
urge to publicly share some of my journaling. but it felt lonely.
this is what happens when i log in to a unix box: i reattach my screens, and
flip through irc to catch up on chat, and alpine to check my mail. in the
past, on non-tilde machines, i've fired up zephyr to message friends. i git
pull my repos for updates. i check the nethack leaderboard. these are all
cli-based actions, but they are also based on the idea that when i wasn't
looking, things changed. those things changed because other people performed
some actions of their own. i catch up on these updates with the implicit
acknowledgement that other humans exist and do things in my environment.
this is what i realized i missed from running my own clumsy blog scripts. i
had ways to chat, mail, and collaborate on text-based projects through the
terminal, but nothing that served as a central hub for journal-writing.
i didn't think of myself as a strong programmer or a skilled developer, but i
had a few ideas that i thought i could try out. on april 29th, 2016, i put
out a general call in irc for people to run ~endorphant/bin/ttbp; ~sl2c
confirmed that it worked. on may 2nd, 2016, i opened it up again, and others
jumped in; ~sanqui, ~karlen, ~varscite, ~vilmibm, ~insom, ~marcus, ~nossidge,
~jumblesale, ~krowbar. others trickled in; people sent me crash reports,
wrote to me about mysterious behaviors, lamented about broken settings when i
pushed code updates, shared with me how this fulfilled their nostalgia for an
experience that i personally never had, complained about lacking features
they wanted, yelled with delight about the interface, filled it with feelings
they didn't know how to express.
it's now december 4th, 2016, and there are 42 users on ttbp. some of them
have never posted, many of them i've never spoken to. there are 581 entries,
which is an average of almost 14 entries per user, and a little over two and
a half entries per day. it now takes 11 seconds to load the global feed
because i implemented it sloppily, thinking i'd handle scaling issues later.
i've loved every second of this. i'm humbled and pleased and a little
terrified at the trust and appreciation and responsibility that's been given
to me in the past seven months.
the backend:
lessons:
future work:

View File

@ -76,13 +76,13 @@ NOPUB = os.path.join(USER_CONFIG, "nopub")
## UI
BANNER = '''
__________________________________________________________
___________________________________________________________
| |
| the tilde.town |
| ____ ____ ____ _ ____ ____ _ _ ____ _ _ _ ____ |
| |___ |___ |___ | [__ |___ |\ | | __ | |\ | |___ |
| | |___ |___ |___ ___] |___ | \| |__] | | \| |___ |
| ver 0.11.0 (rainbows) |
| ver 0.11.1 (rainbows) |
|__________________________________________________________|
'''.lstrip()
@ -139,4 +139,11 @@ version 0.9.3 features:
* ~login created centralfeels, which is an opt-in collection of
html-published feels; create a blank file called '.centralfeels' in
your home directory if you'd like to be included!""",
"0.11.1": """
~[version 0.11.1 update]~
* a quick patch to correct a directory listing error, nothing too
exciting
* general PSA: feel free to use the github repo for bugs/feature requests:
https://github.com/modgethanc/ttbp/issues""",
}

View File

@ -49,7 +49,7 @@ from . import chatter
from . import gopher
from . import util
__version__ = "0.11.0"
__version__ = "0.11.1"
__author__ = "endorphant <endorphant@tilde.town)"
p = inflect.engine()
@ -216,8 +216,6 @@ def check_init():
* checks for last run version
'''
global SETTINGS
print("\n\n")
if os.path.exists(os.path.join(os.path.expanduser("~"),".ttbp")):
if config.USER == "endorphant":
@ -229,10 +227,10 @@ def check_init():
## ttbp env validation
if not user_up_to_date():
update_user_version()
elif not valid_setup():
if not valid_setup():
setup_repair()
else:
raw_input("press <enter> to explore your feels.\n\n")
core.load(SETTINGS)
@ -636,7 +634,10 @@ def view_neighbors(users, prompt):
url = config.LIVE+user+"/"+userRC.get("publish dir")
## find last entry
files = os.listdir(os.path.join("/home", user, ".ttbp", "entries"))
try:
files = os.listdir(os.path.join("/home", user, ".ttbp", "entries"))
except OSError:
files = []
files.sort()
lastfile = ""
for filename in files:
@ -917,7 +918,10 @@ def view_feed():
for townie in core.find_ttbps():
entryDir = os.path.join("/home", townie, ".ttbp", "entries")
filenames = os.listdir(entryDir)
try:
filenames = os.listdir(entryDir)
except OSError:
filenames = []
for entry in filenames:
## hardcoded display cutoff at 30 days
@ -1267,19 +1271,25 @@ you're all good to go, """+chatter.say("friend")+"""! please contact ~endorphant
something strange happened to you during this update.
""")
if z < 1 or y < 10:
if y < 10:
# version 0.10.1 patch notes
print(config.UPDATES["0.10.1"])
if y < 11:
# version 0.11.1 patch notes
# version 0.11.0 patch notes
print(config.UPDATES["0.11.0"])
if y < 11 or z < 1:
# version 0.11.1 patch notes
print(config.UPDATES["0.11.1"])
confirm = ""
while confirm not in ("x", "<x>", "X", "<X>"):
confirm = raw_input("\nplease type <x> when you've finished reading about the updates! ")
print("\n\n")
open(versionFile, "w").write(__version__)
#####