[Catalyst] Unexpected subrequest side effects

Nigel Metheringham nigel.metheringham at dev.intechnology.co.uk
Thu Jan 12 18:58:14 CET 2006


I am finding that subrequests have some unexpected (to me) side effects
- basically the context in the main request appears to be getting
trashed.

I have (what I think) a reasonable standard TT view - originally
generated by the TTsite helper.

This uses a couple of layers of wrappers round the main content - this
being dependant on the TT meta variable "type" to select which wrappers
are used.

A couple of templates use a subrequest - 
          <label>
            <span class="field">Group</span>
            <div id="select_group0">
        [% Catalyst.subreq('/ajax/select_groups', {}, {
                bs_sp    => item.bs_sp.id,
                bs_group => item.bs_group.id,
                default  => 1}); %]
            </div>
          </label>

The subrequest appears to be firing fine:-
        [Thu Jan 12 17:43:48 2006] [catalyst] [debug] Subrequest to
        ajax/select_groups , action is ajax/select_groups

However nothing is being rendered in the template just here.... or at
least its not rendering most of the time (its a heisenbug).

When called from the javascript trigger this does render correctly.

Now the strange thing is that in one of the templates that would wrap
this (the footer template for those that have played with ttsite), there
is this stanza:-
        <div id="debug"><a href="[% uri = Catalyst.request.uri;
            uri.query_param_append('dump_info', 1);
            uri.as_string %]">dump</a></div>

This outputs a link which allows the page to be re-requested and the
catalyst state dumped.  However in the main page this URL is the one for
the ajax request and *not* as expected the one for the original request.

It appears the 2 parts of the request are getting intermingled and
confused.

[Sorry for the brain dump on this - I'm actually away for a couple of
days now, and wanted to dump what I am seeing before I forgot it again.
I'll try and pick up responses when I can]

Cheers
	Nigel.

-- 
[ Nigel Metheringham           Nigel.Metheringham at InTechnology.co.uk ]
[ - Comments in this message are my own and not ITO opinion/policy - ]





More information about the Catalyst mailing list