commented routes
This commit is contained in:
+18
-4
@@ -125,12 +125,11 @@ def snip_article(article, path):
|
||||
limit = 300
|
||||
result = article[0:min(len(article),limit)]
|
||||
result = result.rsplit(' ',1)[0]
|
||||
# cut off after 5 lines, too?
|
||||
return result + " ... "
|
||||
|
||||
def sort_files(files):
|
||||
files.sort(reverse=True)
|
||||
return files#list(reversed(files))
|
||||
return files
|
||||
|
||||
def gather_files(loc):
|
||||
files = os.listdir(loc)
|
||||
@@ -140,26 +139,31 @@ def gather_files(loc):
|
||||
files.remove('extra')
|
||||
return files
|
||||
|
||||
# Static
|
||||
## Static ##
|
||||
|
||||
# Serve CSS
|
||||
@route('/static/css/<filename:path>')
|
||||
def serve_css(filename):
|
||||
return static_file(filename, root='static/css')
|
||||
|
||||
# Serve images
|
||||
@route('/static/img/<filename:path>')
|
||||
def serve_img(filename):
|
||||
return static_file(filename, root='static/img')
|
||||
|
||||
# Serve unlisted articles
|
||||
@route('/static/extra/<filename:re:.*\.cpp>')
|
||||
def serve_extra(filename):
|
||||
return static_file(filename, root='static/extra', mimetype='text/plain', download=True)
|
||||
|
||||
# Routes
|
||||
## Routes ##
|
||||
|
||||
# 404 Error Page
|
||||
@error(404)
|
||||
def error404(error):
|
||||
return "unfortunately, a 404 error"
|
||||
|
||||
# Home Page - Index Template
|
||||
@route('/')
|
||||
def index():
|
||||
"""home page"""
|
||||
@@ -167,22 +171,26 @@ def index():
|
||||
info = {'css': 'index', 'news': list_headlines(sort_files(gather_files(loc))[0:10]), 'title': 'chimchooree\'s dev space - blessfrey', 'year': datetime.datetime.now()}
|
||||
return template('index.tpl', info)
|
||||
|
||||
# Game Page - Game Template - system, character, story info
|
||||
@route('/game')
|
||||
def game():
|
||||
"""game page"""
|
||||
info = {'css': 'game', 'title': 'blessfrey - about the game', 'year': datetime.datetime.now()}
|
||||
return template('game.tpl', info)
|
||||
|
||||
# Presskit Page - Presskit Template - product, developer info
|
||||
@route('/presskit')
|
||||
def presskit():
|
||||
"""press page"""
|
||||
info = {'css': 'presskit', 'title': 'blessfrey - presskit', 'year': datetime.datetime.now()}
|
||||
return template('presskit.tpl', info)
|
||||
|
||||
# Start on first Diary page if no page given
|
||||
@route('/diary')
|
||||
def diary2():
|
||||
return diary(0)
|
||||
|
||||
# Diary Page - Diary Template - list all articles
|
||||
@route('/diary/<page:int>')
|
||||
def diary(page):
|
||||
"""diary page"""
|
||||
@@ -191,6 +199,7 @@ def diary(page):
|
||||
info = {'css': 'diary', 'title': 'blessfrey - developer diary', 'year': datetime.datetime.now(), 'snippets': list_snippets(sort_files(gather_files(loc))), 'latest': list_headlines(sort_files(gather_files(loc))[0:5]), 'total': len(gather_files(loc)), 'limit': 4, 'cluster': 3, 'page': page}
|
||||
return template('diary.tpl', info)
|
||||
|
||||
# Entry Page - Feature Template - for articles
|
||||
@route('/diary/entries/<page:int>')
|
||||
def entry(page):
|
||||
"""diary entry"""
|
||||
@@ -201,6 +210,7 @@ def entry(page):
|
||||
TEMPLATE_PATH.insert(0, abs_views_path )
|
||||
return template(os.path.join(abs_views_path,'feature.tpl'), info)
|
||||
|
||||
# Extra Page - Feature Template - for unlisted articles
|
||||
@route('/diary/entries/extra/<page>')
|
||||
def extra(page):
|
||||
"""diary extra"""
|
||||
@@ -211,18 +221,22 @@ def extra(page):
|
||||
TEMPLATE_PATH.insert(0, abs_views_path )
|
||||
return template(os.path.join(abs_views_path,'feature.tpl'), info)
|
||||
|
||||
# Personal Page - Box Template
|
||||
@route('/box')
|
||||
def box():
|
||||
"""personal page"""
|
||||
info = {'css': 'box', 'title': 'chimchooree\'s personal page', 'year': datetime.datetime.now()}
|
||||
return template('box.tpl', info)
|
||||
|
||||
# Credits Page - Credits Template
|
||||
@route('/credits')
|
||||
def credits():
|
||||
"""credits page"""
|
||||
info = {'css': 'box', 'title': 'blessfrey - credits', 'year': datetime.datetime.now()}
|
||||
return template('credits.tpl', info)
|
||||
|
||||
|
||||
# Contact Page - Contact Template
|
||||
@route('/contact')
|
||||
def contact():
|
||||
"""contact page"""
|
||||
|
||||
Reference in New Issue
Block a user