Hi,
Experimenting with forms in an Athena app. Have a web page with 2 panes
(<div>s). Want to avoid page refresh.
Started with own test code, like
class LeftPane(athena.LiveFragment):
def testPlainSubmitForm(self):
f = form('formTest',
'Plain submit form',
[T.textarea(name='textarea')['testing a plain form']],
['',],
'submit_form')
self.callRemote('push_html_to_pane', f, u'rightPane')
athena.expose(testPlainSubmitForm)
This shows the form ok, but I get in trouble retrieving its data on submit.
Trying to benefit from formless felt like a better idea, with the assumption
that I could somehow catch the submit by subclassing
nevow.rend.FreeformChildMixin, or something. My code would also do
request = inevow.IRequest(ctx) request.code = 204
request.code_message = 'No Change'
request.finish()
to avoid a refresh.
So, building on
http://divmod.org/trac/attachment/wiki/DivmodNevow/FormHandling/Example1.1.tac.py
(q.v.), _except its last 2 lines_.
My code now looks like -
class LeftPane(athena.LiveFragment):
def testFormLess(self):
self.callRemote('push_html_to_pane', NewsEditPage(store=store),
u'rightPane')
athena.expose(testFormLess)
Now I get an error in nevow.context.WebContext.locate -
exceptions.KeyError: 'Interface formless.iformless.IConfigurableFactory was
not remembered.'
..which I think comes from not using nevow.appserver.NevowSite, which would
tack on the relevant context. (Of course, NevowSite is used in my "main
class" - what I'm trying to do is "sneaking out of my code" - fetching user
input - "getting back where I was".)
Can't say I understand all that's going on, but I'm trying :)
So, questions, por favor -
Is this a good idea at all? Is it doable?
Can I "attach a proper context" to that form, and how? (Gee, I don't even
know how to phrase it correctly :( )
Thanks,
k
_______________________________________________
Twisted-web mailing list
[email protected]
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-web