Are you sure accept is failing and not insert? 'text' fields in MySQL
have a size limit. Do you use MySQL?

On Aug 23, 1:33 pm, Joe  Barnhart <joe.barnh...@gmail.com> wrote:
> I have a strange behavior going on.  I have a form that adds a wiki
> page, which works all the time -- except for this one page.  It seems
> to fail the form.accepts point when I add a certain content page to
> the wiki.  I don't know why the content would matter unless I'm
> tripping over a size limitation.  Here is the controller:
>
> def add():
>     pageName=request.args[0]
>     source=session.source
>     rendered=render_html(source)
>     response.view='default/edit.html'
>     form=FORM(
>         TEXTAREA(_name="source", _id='src', _rows="18",_cols="80",
> value=source), BR(),
>         INPUT(_name='show',_type='submit',_value='Show formatting'),
>         INPUT(_name='save',_type='submit',_value='Save page'))
>     if form.accepts(request.vars,session,keepvalues=True):
>         if request.vars.show:
>             session.source=request.vars.source
>             rendered=render_html(request.vars.source)
>         elif request.vars.save:
>             pgid=db.page.insert(name=pageName,ns=None,status=0)
>             page=db.page[pgid]
>             srcid=db.source.insert(page_uuid=page.uuid,
> content=request.vars.source)
>             page.update_record(source_uuid=db.source[srcid].uuid)
>             db.rendered.insert(page_uuid=page.uuid, content=render_html
> (request.vars.source))
>             response.flash='Wiki page accepted'
>             redirect(URL(r=request,f='page',args=request.args))
>         else:
>             response.flash='Form not accepted'
>     return dict
> (wikiName=pageName,source=source,rendered=rendered,form=form)
>
> Coming in to this controller, the edited text has already been set in
> the session variable session.source.  The page name is passed in
> request.args[0].  This form has two buttons, one causes the text to be
> processed by the reStructuredText module and displayed on the page,
> the otherr commits the change to the database and redirects back to
> the normal page view.
>
> When the content is this certain page (the reStructuredText cheatsheet
> athttp://docutils.sourceforge.net/docs/user/rst/cheatsheet.txt)
> hitting the "save" button has no effect.  The database never gets the
> transaction.  If I modify the text and hit the "show" button my
> changes are immediately reverted (keepvalues=True).
>
> I can see from "print" statements that the controller is being
> executed when I press either button, but never reaches inside the
> "form.accepts" clause.  (But I never get the response.flash message in
> the else clause either.)  It almost acts like I have a global
> "try:except:" block somewhere but i don't see it.
>
> Any ideas?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to