Added more errorhandlers for:

* linklist
* entries_dir
* staticpages_dir
This commit is contained in:
Stefan Ritter 2009-05-22 10:18:04 +02:00
parent 0f9a7136ff
commit 3100801a07

View File

@ -32,7 +32,14 @@ def errorpage(string):
print ' <title>Error!</title>' print ' <title>Error!</title>'
print '</head>' print '</head>'
print '<body>' print '<body>'
print ' <b>' + string + '</b> is not set in configuration, please check your installation!' if string == "entries_dir":
print ' Directory <b>"' + entries_dir + '"</b> does not exist!'
elif string == "staticpages_dir":
print ' Directory <b>"' + staticpages_dir + '"</b> does not exist!'
elif string == "linklist":
print ' File <b>"linklist"</b> does not exist!'
else:
print ' <b>' + string + '</b> is not set in configuration, please check your installation!'
print '</body>' print '</body>'
print '</html>' print '</html>'
sys.exit() sys.exit()
@ -58,32 +65,52 @@ configuration.read('configuration')
try: blog_title = configuration.get('personal', 'blog_title') try: blog_title = configuration.get('personal', 'blog_title')
except: errorpage("blog_title") except: errorpage("blog_title")
try: blog_subtitle = configuration.get('personal', 'blog_subtitle') try: blog_subtitle = configuration.get('personal', 'blog_subtitle')
except: errorpage("blog_subtitle") except: errorpage("blog_subtitle")
try: blog_url = configuration.get('personal', 'blog_url') try: blog_url = configuration.get('personal', 'blog_url')
except: errorpage("blog_url") except: errorpage("blog_url")
try: keywords = configuration.get('personal', 'keywords') try: keywords = configuration.get('personal', 'keywords')
except: errorpage("keywords") except: errorpage("keywords")
try: entries_dir = configuration.get('personal', 'entries_dir') try: entries_dir = configuration.get('personal', 'entries_dir')
except: errorpage("entries_dir") except: errorpage("entries_dir")
if not os.path.exists(entries_dir):
errorpage("entries_dir")
try: entries_suffix = configuration.get('personal', 'entries_suffix') try: entries_suffix = configuration.get('personal', 'entries_suffix')
except: errorpage("entries_suffix") except: errorpage("entries_suffix")
try: staticpages_dir = configuration.get('personal', 'staticpages_dir') try: staticpages_dir = configuration.get('personal', 'staticpages_dir')
except: errorpage("staticpages_dir") except: errorpage("staticpages_dir")
if not os.path.exists(staticpages_dir):
errorpage("staticpages_dir")
try: style = configuration.get('look', 'style') try: style = configuration.get('look', 'style')
except: errorpage("style") except: errorpage("style")
try: entries_per_page = configuration.getint('look', 'entries_per_page') try: entries_per_page = configuration.getint('look', 'entries_per_page')
except: errorpage("entries_per_page") except: errorpage("entries_per_page")
try: monthlist = configuration.get('look', 'monthlist') try: monthlist = configuration.get('look', 'monthlist')
except: errorpage("monthlist") except: errorpage("monthlist")
try: staticpages = configuration.get('look', 'staticpages') try: staticpages = configuration.get('look', 'staticpages')
except: errorpage("staticpages") except: errorpage("staticpages")
try: linklist = configuration.get('look', 'linklist') try: linklist = configuration.get('look', 'linklist')
except: errorpage("linklist") except: errorpage("linklist")
if not os.path.exists("linklist"):
errorpage("linklist")
try: permalinks = configuration.get('look', 'permalinks') try: permalinks = configuration.get('look', 'permalinks')
except: errorpage("permalinks") except: errorpage("permalinks")
try: comments = configuration.get('look', 'comments') try: comments = configuration.get('look', 'comments')
except: errorpage("comments") except: errorpage("comments")
try: newest_first = configuration.get('look', 'newest_first') try: newest_first = configuration.get('look', 'newest_first')
except: errorpage("newest_first") except: errorpage("newest_first")