diff --git a/tildetown/app.py b/tildetown/app.py deleted file mode 100644 index 081d55d..0000000 --- a/tildetown/app.py +++ /dev/null @@ -1,49 +0,0 @@ -from functools import lru_cache -import json -import os -import random -import time -from sys import argv -from tempfile import mkdtemp, mkstemp -import logging - -from pyhocon import ConfigFactory -import requests -from flask import Flask, render_template, request, redirect - -from tildetown.stats import get_data - -## disgusting hack for python 3.4.0 -import pkgutil -orig_get_loader = pkgutil.get_loader -def get_loader(name): - try: - return orig_get_loader(name) - except AttributeError: - pass -pkgutil.get_loader = get_loader -########## - -SITE_NAME = 'tilde.town' - -app = Flask('~cgi') - -app.config['DEBUG'] = True -# tension between this and cfg function... - -conf = ConfigFactory.parse_file('cfg.conf') - -logging.basicConfig(filename='/tmp/cgi.log', level=logging.DEBUG) - -@lru_cache(maxsize=32) -def site_context(): - return get_data() - -@app.route('/random', methods=['GET']) -def get_random(): - user = random.choice(site_context()['live_users']) - return redirect('http://tilde.town/~{}'.format(user['username'])) - - -if __name__ == '__main__': - app.run() diff --git a/tildetown/mustache.py b/tildetown/mustache.py index b909122..e95a720 100644 --- a/tildetown/mustache.py +++ b/tildetown/mustache.py @@ -3,7 +3,17 @@ from sys import argv,stdin from pystache import render -from tildetown.util import slurp +def slurp(file_path): + contents = None + try: + with open(file_path, 'r', encoding="utf-8") as f: + contents = f.read() + except FileNotFoundError: + pass + except UnicodeDecodeError: + pass + return contents + if __name__ == '__main__': template = slurp(argv[1]) diff --git a/tildetown/templates/guestbook.html b/tildetown/templates/guestbook.html deleted file mode 100644 index 732a23c..0000000 --- a/tildetown/templates/guestbook.html +++ /dev/null @@ -1,39 +0,0 @@ - - -
-- {{post.name}} says: {{post.message}} -
- {% endfor %} - - diff --git a/tildetown/templates/helpdesk.html b/tildetown/templates/helpdesk.html deleted file mode 100644 index 91e5850..0000000 --- a/tildetown/templates/helpdesk.html +++ /dev/null @@ -1,68 +0,0 @@ - - - -- hi! this form exists to make it a little easier for {{ site_name }} admins - to help people out with system issues like logging in, installing - packages, and general questions about how to do stuff. -
- -- in using this system, recall that there are only a handful of admins and - you'll get a response (by email) as they are able to help out. -
- -- thanks! -
- - {% if status == 'fail' %} -- oops, sorry! that didn't work. either something is wrong on the server or - there was a problem with the form..try again? -
- {% endif %} - - {% if status == 'success' %} -- hooray, your request has been sent. -
- {% endif %} - - - - diff --git a/tildetown/util.py b/tildetown/util.py deleted file mode 100644 index a1b2447..0000000 --- a/tildetown/util.py +++ /dev/null @@ -1,20 +0,0 @@ -def slurp(file_path): - contents = None - try: - with open(file_path, 'r', encoding="utf-8") as f: - contents = f.read() - except FileNotFoundError: - pass - except UnicodeDecodeError: - pass - return contents - -def thread(initial, *fns): - value = initial - for fn in fns: - value = fn(value) - return value - -def p(x): - print(x) - return x