Hi
I'm a total newbie of web2py and I need some help with the GrooverWiki
app
It don't work.
I install it via "upload application" and it's all ok.
I see the "GrooverWiki" app in the list but when I call it it has an
error:
Someone can help me?
Thanks
--------------------------------------------
Error ticket for "GrooverWiki"
Ticket 127.0.0.1.2009-05-11.14-17-56.44f11973-4cbe-4689-b040-
aa909d88c5c4
Error traceback
Traceback (most recent call last):
File "f:\microbel\web2py\gluon\restricted.py", line 98, in
restricted
exec ccode in environment
File "F:/microbel/web2py/applications/GrooverWiki/controllers/
default.py", line 150, in <module>
File "f:\microbel\web2py\gluon\globals.py", line 75, in <lambda>
self._caller = lambda f: f()
File "F:/microbel/web2py/applications/GrooverWiki/controllers/
default.py", line 11, in show_page
curr_page=db().select(db.WikiPage.ALL)[0]
File "f:\microbel\web2py\gluon\sql.py", line 2132, in __getitem__
row[tablename][fieldname] = base64.b64decode(str(value))
File "D:\temp\PROGRA~1\microbel\Python\PORTAB~1.1\App\lib
\base64.py", line 76, in b64decode
raise TypeError(msg)
TypeError: Incorrect padding
In file: F:\microbel\web2py\applications\GrooverWiki/controllers/
default.py
from gluon.contrib.markdown import WIKI
def index():
redirect(URL(r=request, f="show_page"))
def show_page():
try:
page_id=int(request.args[0])
curr_page=db(db.WikiPage.id==page_id).select(db.WikiPage.ALL)
[0]
except Exception, e:
curr_page=db().select(db.WikiPage.ALL)[0]
categories=db().select(db.category.ALL)
# obtain the last editor of this page
try:
last_editor=db(db.Editor.WikiPage==curr_page.id).select
(db.Editor.ALL, orderby=~db.Editor.modified)[0]
except Exception, e:
last_editor=None
# grab all of the comments for this page
try:
comments=db(db.comment.WikiPage==curr_page.id).select
(db.comment.ALL, orderby=db.comment.created)
except Exception, e:
comments=None
# Grab all of the Wiki pages and create a dictionary of lists
pages={}
for category in categories:
pages[category.id]=db(db.WikiPage.category==category.id).select
(db.WikiPage.title,db.WikiPage.id)
return dict(page=curr_page,pages=pages, categories=categories,
editor=last_editor, comments=comments)
def create_page():
try:
category_id=request.args[0]
category=db(db.category.id==category_id).select
(db.category.ALL)[0]
except:
category=db().select(db.category.ALL)[0]
db.WikiPage.category.default=category.name
form=SQLFORM(db.WikiPage, fields=['title', 'category', 'author',
'text'])
if form.accepts(request.vars):
redirect(URL(r=request,f='show_page'))
if form.errors:
response.flash='Please address the following errors in the
form'
categories=db().select(db.category.ALL)
# Grab all of the Wiki pages and create a dictionary of lists
pages={}
for category in categories:
pages[category.id]=db(db.WikiPage.category==category.id).select
(db.WikiPage.title,db.WikiPage.id)
return dict(pages=pages, categories=categories, form=form)
def delete_page():
try:
page_id=request.args[0]
except:
session.flash="No page was specified to be deleted"
redirect(URL(r=request, f="show_age"))
if page_id=="1":
session.flash="The Welcome page cannot be deleted"
redirect(URL(r=request, f="show_page"))
try:
# delete all comments and editors for this page
try: db(db.comment.WikiPage==page_id).delete()
except: pass
try: db(db.Editor.WikiPage==page_id).delete()
except: pass
# delete the page
db(db.WikiPage.id==page_id).delete()
except:
session.flash="The specified page was not found"
redirect(URL(r=request, f="show_page"))
def edit_page():
try:
page_id=request.args[0]
except:
response.flash="No page was specified to be edited"
redirect(URL(r=request, f="show_page"))
try:
curr_page=db(db.WikiPage.id==page_id).select(db.WikiPage.ALL)
[0]
except:
response.flash="The specified page could not be found"
redirect(URL(r=request, f="show_page"))
form=FORM(TABLE(TR(TD(LABEL("Editor: ", _for="name")), TD(INPUT
(_type='text', _name='name', _id='name', requires=IS_NOT_EMPTY()))),
TR(TD(LABEL("Text: ", _for="text")), TD(TEXTAREA
(_name='text', _id='text', value=curr_page.text), requires=IS_NOT_EMPTY
())),
TR(TD(), TD(INPUT(_type='submit',_value='Submit
changes')))))
if form.accepts(request.vars):
curr_page.update_record(text=request.vars.text)
db.Editor.insert(name=request.vars.name,
WikiPage=curr_page.id)
redirect(URL(r=request, f='show_page', args=[curr_page.id]))
if form.errors:
response.flash='Please address the following errors in the
form'
categories=db().select(db.category.ALL)
# Grab all of the Wiki pages and create a dictionary of lists
pages={}
for category in categories:
pages[category.id]=db(db.WikiPage.category==category.id).select
(db.WikiPage.title,db.WikiPage.id)
return dict(pages=pages, categories=categories, form=form,
vars=form.vars)
def create_category():
form=SQLFORM(db.category)
if form.accepts(request.vars):
redirect(URL(r=request, f='show_page'))
if form.errors:
response.flash='Please address the following errors in the
form'
categories=db().select(db.category.ALL)
# Grab all of the Wiki pages and create a dictionary of lists
pages={}
for category in categories:
pages[category.id]=db(db.WikiPage.category==category.id).select
(db.WikiPage.title,db.WikiPage.id)
return dict(pages=pages, categories=categories, form=form)
def delete_category():
try:
category_id=request.args[0]
except:
session.flash="No category was specified"
redirect(URL(r=request, f="show_page"))
try:
curr_category=db(db.category.id==category_id).select
(db.category.ALL)[0]
except:
session.flash="The specified category could not be found"
redirect(URL(r=request, f="show_page"))
db(db.category.id==category_id).delete()
redirect(URL(r=request, f="show_page"))
def add_comment():
try:
page_id=request.args[0]
except:
session.flash="No page was specified"
redirect(URL(r=request, f="show_page"))
try:
curr_page=db(db.WikiPage.id==page_id).select(db.WikiPage.ALL)
[0]
except:
session.flash="The specified page could not be found"
redirect(URL(r=request, f="show_page"))
form=SQLFORM(db.comment, fields=["user", "text"])
if form.accepts(request.vars):
db.comment.insert(user=request.vars.user,
text=request.vars.text, WikiPage=curr_page.id)
redirect(URL(r=request, f='show_page'))
if form.errors:
response.flash='Please address the following errors in the
form'
categories=db().select(db.category.ALL)
# Grab all of the Wiki pages and create a dictionary of lists
pages={}
for category in categories:
pages[category.id]=db(db.WikiPage.category==category.id).select
(db.WikiPage.title,db.WikiPage.id)
return dict(pages=pages, categories=categories, form=form)
response._vars=response._caller(show_page)
--------------------------------------------
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"web2py Web Framework" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---