On Feb 4, 9:34 am, Geoff <[EMAIL PROTECTED]> wrote:
> Hi!
>
> What can I use to fill in forms when using Genshi in Pylons? htmlfill
> is mentioned a lot, but I can't find any examples of how to use it
> from Pylons. Seems Genshi also has it's own form filler but again, I
> can't find any examples of how to use this in Pylons (if it's
> possible).
OK I waited a couple of days to see if someone else would post the
right way to do this. Not much so I'll offer up how I do it (that is
a warning!)
first start with a couple of imports at the head of your controller:
from genshi import HTML
from genshi.filters import HTMLFormFiller
then as you would with any solution fill in a dict with your data
like::
data = {}
data['dc_date'] = bibItem[dc.date]
data['bib-pages'] = bibItem[bib.pages]
data['dcterms-abstract'] = bibItem[dcterms['abstract']]
data['bib-note'] = bibItem[bib.note]
at the end of the controller finish off with something like:
filler = HTMLFormFiller(data=data)
stream = HTML(render('bibEditForm")) | filler
return stream.render(method='xhtml')
Not sure it's the fastest way to go but ... well works 4 me.
--
Phil
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---