diff --git a/ttbp/config/__init__.py b/ttbp/config/__init__.py index 6d8639d..e363efe 100644 --- a/ttbp/config/__init__.py +++ b/ttbp/config/__init__.py @@ -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 = '''
-'''.ltrim() +'''.lstrip() DEFAULT_FOOTER = '''
-'''.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() diff --git a/ttbp/ttbp.py b/ttbp/ttbp.py index cfd0f01..271b355 100644 --- a/ttbp/ttbp.py +++ b/ttbp/ttbp.py @@ -285,9 +285,9 @@ press to begin, or 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()) #####