Commits

Anonymous committed fb42c78

404 pages reinstated...

Comments (0)

Files changed (2)

 
 [deployment]
 # choices: built-in, wsgi
-type = built-in
+type = wsgi
 
 [database]
 # according to Storm API
 # can be 'asc' or 'desc' or 'alpha'
 order = desc
 
+[filters]
+filter1 = [code]|<pre><span>Code:</span>
+filter2 = [/code]|</pre>
+
 [comments]
 # stop impersonators
 reserved_names = alec,alec henriksen,alecwho
 				
 				page_html = page_html + comments_html + comment_form
 				
-			
-		# 404, if no success
-		if page_html.strip() is "": page_html = data_handler.Markdown2HTML(open(config.general.base_path+"static/pages/404").read())
 		
 		# prepare content
 		web.webapi.header("Content-Type","text/html; charset=utf-8")
 		
+		# 404, if no article
+		if page_html.strip() == "":
+			page_html = data_handler.Markdown2HTML(open(config.general.base_path+"static/pages/404").read())
+			return templater(config.general.base_path+"templates/site.html", {"page_html":page_html, "base_url":config.general.base_url, "page_type":page_type, "session":session, "page_name":"404 not found"})
+		
 		return templater(config.general.base_path+"templates/site.html", {"page_html":page_html, "base_url":config.general.base_url, "page_type":page_type, "session":session, "page_name":article.title})
 		
 	def POST(self, url_id, format):
 		if format == '.html':
 			# when was this modified?
 			# os.stat() returns an iterable of file metadata items, -2 is last-motified
-			last_modified_date = data_handler.human_timestamp(os.stat(config.general.base_path+"static/pages/%s" % (name,))[-2])
-			
+			try:
+				last_modified_date = data_handler.human_timestamp(os.stat(config.general.base_path+"static/pages/%s" % (name,))[-2])
+			except OSError:
+				# 404, no page
+				last_modified_date = data_handler.human_timestamp(os.stat(config.general.base_path+"static/pages/404")[-2])
 			# get contents, parse markdown
 			Markdown = markdown.Markdown()
 			page_html = Markdown.convert(page.read())