flurry of bugfixes

master
nathaniel smith 2017-11-20 22:39:38 -08:00
parent 2e01008838
commit 4a03f6cf36
2 changed files with 13 additions and 10 deletions

View File

@ -1,13 +1,14 @@
from __future__ import absolute_import
import os
import sys
from . import util
from .. import util
## System config
# We refer to some package files (ie .css stuff), so we save a reference to the
# path.
INSTALL_PATH = dirname(sys.modules['ttbp'].__file__)
INSTALL_PATH = os.path.dirname(sys.modules['ttbp'].__file__)
# We use this to store any persisted, global state.
VAR = '/var/global/ttbp'
@ -29,6 +30,9 @@ GRAFF_DIR = os.path.join(VAR, "graffiti")
WALL = os.path.join(GRAFF_DIR, "wall.txt")
WALL_LOCK = os.path.join(GRAFF_DIR, ".lock")
if not os.path.isdir(GRAFF_DIR):
os.mkdir(GRAFF_DIR)
## Defaults
DEFAULT_HEADER = '''
@ -44,13 +48,13 @@ DEFAULT_HEADER = '''
</div>
<div id="tlogs">
'''.ltrim()
'''.lstrip()
DEFAULT_FOOTER = '''
</div>
</body>
</html>
'''.ltrim()
'''.lstrip()
with open(os.path.join(INSTALL_PATH, 'config', 'defaults', 'style.css')) as f:
DEFAULT_STYLE = f.read()
@ -79,4 +83,4 @@ __________________________________________________________
| | |___ |___ |___ ___] |___ | \| |__] | | \| |___ |
| ver 0.10.0 (almost stable) |
|__________________________________________________________|
'''.ltrim()
'''.lstrip()

View File

@ -285,9 +285,9 @@ press <enter> to begin, or <ctrl-c> to get out of here.
headerfile.close()
## copy footer and default stylesheet
with open(os.path.join(config.USER_CONFIG, 'footer.txt', 'w')) as f:
with open(os.path.join(config.USER_CONFIG, 'footer.txt'), 'w') as f:
f.write(config.DEFAULT_FOOTER)
with open(os.path.join(config.USER_CONFIG, 'style.css', 'w')) as f:
with open(os.path.join(config.USER_CONFIG, 'style.css'), 'w') as f:
f.write(config.DEFAULT_STYLE)
## run user-interactive setup and load core engine
@ -924,9 +924,8 @@ def unpublish():
'''
remove user's published directory, if it exists. this should only remove the symlink in public_html.
'''
directory = SETTINGS.get("publish dir")
if dir:
if directory:
publishDir = os.path.join(config.PUBLIC, directory)
subprocess.call(["rm", publishDir])
@ -1138,7 +1137,7 @@ ver 0.9.2 features:
* things should otherwise be the same!
* check out https://github.com/modgethanc/ttbp if you'd like to contribute.
* takes advantage of new /var/global
""".ltrim())
""".lstrip())
#####