While I am not, by and large, a proponent of AJAX for all situations,
I have recently encountered a scenario that I believe merits it's
usage. In order to make this work smoothly, and degrade gracefully, I
have built a set of form.Form's and page.Pages to capture and display
the data I want to interact with.
From a "dashboard" style page, I am able to, using pylon's rails
reimplementations, use link_to_remote and form_remote_tag to pull down
directed to the relevant URL for direct editing of the data on a
So far, so good. But here comes the strange part. The redirected
non-ajax pages work fine. I can modify and manipulate the data as I
intend. But the ajax versions, doing the exact same things, with the
same post actions and the same reworked contexts, don't do what I
expect. It's not a context issue, as I can pull up the remote
information for viewing just fine. Let me give an example...
I have a few TextLine widgets, and two List widgets in the form, along
with a simple Bool. I had programmatically added a few elements to
one of the PersistentList's earlier for a doctest, and left them there
for testing the UI. Now, if I click "update" or "add item" or "remove
item", I get a very strange behavior... a new TextLine (the
value_type for my List) appends itself to the display for both Lists.
Similarly, the status from view/status says "there were errors", but
the error_view in my page template (from view/error_views) throws a
component lookup error on  when the page template loads. If I
comment out the view/error_views, the page template will load, but
with the above "append an extra textline widget" problem, and without
actually modifying my data.
The exact error I'm seeing from the fail-to-render tales is:
ComponentLookupError: ((, <zope.publisher.browser.BrowserRequest
I attempted to wrap try/excepts around the places in formlib where it
uses component.getMultiAdapter, but raising exceptions with the
explicit error, request, etc didn't really tell me any more than the
So now I'm stuck a bit. the view/edit form works fine when followed
explicitly in the browser, but the AJAX version doesn't. I'm not
really asking for help in debugging AJAX problems, but since it's
throwing a component lookup error one place and not another, based
purely on how the view is being accessed, I'm a little confused as to
how to proceed...
Thanks in advance for any help. I'll gladly send along any code
examples if anyone would like to look into it any further.
Zope3-users mailing list