Commit beb01d80 authored by Jean Michel Rouly's avatar Jean Michel Rouly
Browse files

Refactored header inclusion to use library function.

parent eb67dd47
......@@ -7,18 +7,14 @@ import goconfig
def application(environ, start_response):
f = open(goconfig.doc_root + "/site_data/top.part", "r")
top = f.read()
f.close()
user_logged_in = library.user_logged_in( environ )
top = library.get_top( user_logged_in )
bottom = library.get_bottom( user_logged_in )
f = open(goconfig.doc_root + "/site_data/about.part", "r")
about = f.read()
f.close()
f = open(goconfig.doc_root + "/site_data/bottom.part", "r")
bottom = f.read()
f.close()
response = top + about + bottom
status = '200 OK'
......
......@@ -137,12 +137,9 @@ def application(environ, start_response):
(short_url, display_short))
f = open(goconfig.doc_root + "/site_data/top.part", "r")
top = f.read()
f.close()
f = open(goconfig.doc_root + "/site_data/bottom.part", "r")
bottom = f.read()
f.close()
user_logged_in = library.user_logged_in( environ )
top = library.get_top( user_logged_in )
bottom = library.get_bottom( user_logged_in )
body = ''.join( body )
response = top + body + bottom
......
......@@ -91,12 +91,9 @@ def application(environ, start_response):
body = ["<p>Error: Invalid username or password.</p>"]
f = open(goconfig.doc_root + "/site_data/top.part", "r")
top = f.read()
f.close()
f = open(goconfig.doc_root + "/site_data/bottom.part", "r")
bottom = f.read()
f.close()
user_logged_in = library.user_logged_in( environ )
top = library.get_top( user_logged_in )
bottom = library.get_bottom( user_logged_in )
body = ''.join( body )
response = top + body + bottom
......
......@@ -19,19 +19,13 @@ def application(environ, start_response):
target = library.get_redirect_target( short_url )
if target is None:
f = open(goconfig.doc_root + "/site_data/top.part", "r")
top = f.read()
f.close()
f = open(goconfig.doc_root + "/site_data/bottom.part", "r")
bottom = f.read()
f.close()
response = []
response.append( top )
response.append( "<p>Nothing here.</p>" )
response.append( bottom )
response = ''.join( response )
user_logged_in = library.user_logged_in( environ )
top = library.get_top( user_logged_in )
bottom = library.get_bottom( user_logged_in )
body = "<p>Nothing here.</p>"
response = top + body + bottom
status = '200 OK'
response_headers = [('Content-type', 'text/html'),
......
......@@ -68,12 +68,9 @@ def application(environ, start_response):
body.append("<p>Please complete all forms before submitting.<br/><br/></p>")
f = open(goconfig.doc_root + "/site_data/top.part", "r")
top = f.read()
f.close()
f = open(goconfig.doc_root + "/site_data/bottom.part", "r")
bottom = f.read()
f.close()
user_logged_in = library.user_logged_in( environ )
top = library.get_top( user_logged_in )
bottom = library.get_bottom( user_logged_in )
body = ''.join( body )
response = top + body + bottom
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment