Commits

Janto Dreijer committed e4534db

switch to disable main page

Comments (0)

Files changed (1)

 	name = "main"
 
 	def get(self):
+		if memcache.get("turn_off_website"):
+			self.write("""
+			<html><body>
+			We are experiencing some technical difficulties.
+			<br />In the meantime have a look at
+			<a href="http://pypi.python.org/pypi?:action=search&term=scikits&submit=search">PyPI's scikits listing</a>
+			</body></html>
+			""")
+			return
 		self.print_header()
 		self.print_menu()
 		self.write(render_template(self.name, locals()))
 		self.write("<h3>%s</h3>" % key)
 		self.write(memcache.get(key))
 
+		self.write("<h2>dangerous settings</h2>")
+		if self.request.get("turn_off_website"):
+			memcache.set("turn_off_website", (self.request.get("turn_off_website") == "True"))
+		self.write("<p><b>Warning</b>: setting this to true will disable access to the main page. You can only change the setting back to False from here (the admin page) or by clearing the memcache.</p>")
+		self.write("turn_off_website = %s" % memcache.get("turn_off_website"))
+		self.write("""
+			<p>
+			<form action="/admin" method="post">
+			<input type="hidden" name="turn_off_website" value="%s">
+			<input type="submit" value="Toggle" />
+			</form>
+			</p>
+			""" % (not memcache.get("turn_off_website")))
+
 		self.print_footer()
 
 	post = get
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.