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:
parent
e8d1cb5b12
commit
5f4a4217a3
1 changed files with 9 additions and 2 deletions
|
@ -1,4 +1,4 @@
|
||||||
#!/usr/bin/env python2.6
|
#!/usr/bin/env python2.5
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
@ -540,11 +540,15 @@ def base():
|
||||||
return bobo.redirect(BASE_DICT["base_url"])
|
return bobo.redirect(BASE_DICT["base_url"])
|
||||||
|
|
||||||
@bobo.query('/')
|
@bobo.query('/')
|
||||||
|
@bobo.query('/public')
|
||||||
|
@bobo.query('/public/')
|
||||||
|
@bobo.query('/public/page/:page')
|
||||||
def show_frontpage(page=None):
|
def show_frontpage(page=None):
|
||||||
return show_poll_list("frontpage.html", 20, page)
|
return show_poll_list("frontpage.html", 20, page)
|
||||||
|
|
||||||
@bobo.query('/admin')
|
@bobo.query('/admin')
|
||||||
@bobo.query('/admin/')
|
@bobo.query('/admin/')
|
||||||
|
@bobo.query('/admin/page/:page')
|
||||||
def show_admin_page(page=None, page_size=20):
|
def show_admin_page(page=None, page_size=20):
|
||||||
try:
|
try:
|
||||||
page_size = int(page_size)
|
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)
|
page = int(page)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
page = 1
|
page = 1
|
||||||
|
# "page" should at least be 1 - zero shows an empty list
|
||||||
|
page = max(1, page)
|
||||||
start = (page - 1) * page_size
|
start = (page - 1) * page_size
|
||||||
if start >= len(polls):
|
if start >= len(polls):
|
||||||
start = 0
|
start = 0
|
||||||
|
@ -664,5 +670,6 @@ for table in (Poll, ContentSubmission, PollSetting, PollRelation):
|
||||||
|
|
||||||
# this line allows to use wortschlucker with mod_wsgi
|
# this line allows to use wortschlucker with mod_wsgi
|
||||||
# see: http://groups.google.com/group/bobo-web/msg/2ba55fc381658cd1
|
# 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__)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue