On Tue, Aug 18, 2009 at 4:29 PM, Etienne<[email protected]> wrote:
>
> Hi,
> in my application copied from SimpleSite of Pylonsbook,
> I wish use MathML code in the contens of pages. To do
> so, I added
> response.content_type='application/xhtml+xml'
>
> to the __before__ methode of the class PageController in the
> controller
> page.py. How can I proceed to prevent the new page from being
> created
> when the contents of the textarea has a xml invalid tag?
>
the basic procedure will be
def process(self,xml)
if is_valid_xml(xml):
create obj and save
else:
flash('an error has occured')
redirect('/same page')
of course it gets a little more complicated if you want to keep the
content to display back to the user, I suggest you take a look at the
validators, as they will allow you to simular the state when an
application error in the posted data has happen.
> Thanks for your help,
> Etienne
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"pylons-discuss" 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/pylons-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---