switched to python2.5 (due to problems on a mixed lenny/squeeze system)

added an optional /public/page/2 for accessing /?page=2 (better for search engines)
enabled wsgi
This commit is contained in:
lars 2010-05-20 11:16:22 +00:00
parent e8d1cb5b12
commit 5f4a4217a3

View file

@ -1,4 +1,4 @@
#!/usr/bin/env python2.6
#!/usr/bin/env python2.5
# -*- coding: utf-8 -*-
import os
@ -540,11 +540,15 @@ def base():
return bobo.redirect(BASE_DICT["base_url"])
@bobo.query('/')
@bobo.query('/public')
@bobo.query('/public/')
@bobo.query('/public/page/:page')
def show_frontpage(page=None):
return show_poll_list("frontpage.html", 20, page)
@bobo.query('/admin')
@bobo.query('/admin/')
@bobo.query('/admin/page/:page')
def show_admin_page(page=None, page_size=20):
try:
page_size = int(page_size)
@ -568,6 +572,8 @@ def show_poll_list(render_file, page_size, page=None, filter_private=True):
page = int(page)
except ValueError:
page = 1
# "page" should at least be 1 - zero shows an empty list
page = max(1, page)
start = (page - 1) * page_size
if start >= len(polls):
start = 0
@ -664,5 +670,6 @@ for table in (Poll, ContentSubmission, PollSetting, PollRelation):
# this line allows to use wortschlucker with mod_wsgi
# see: http://groups.google.com/group/bobo-web/msg/2ba55fc381658cd1
#application = bobo.Application(bobo_resources=__name__)
# see: http://blog.dscpl.com.au/2009/08/using-bobo-on-top-of-modwsgi.html
application = bobo.Application(bobo_resources=__name__)