Thanks Jon, Unfortunately I need to access methods and attributes defined in the enclosing component, not the top level component. Is there any easy way to do this?
On Thu, Jul 23, 2009 at 6:30 AM, Jonathan Swartz <swa...@pobox.com> wrote: > This was a change in Mason 1.1: > > - ** The base_comp is now changed for each component call, unless that > component call uses a component object for its first argument, or the > call starts with SELF: or PARENT:. > > It was controversial at the time, for this reason... > > If what you want in submit_notice is always the top level component, you > can use > > $m->request_comp->attr('submit_notice_message') > > Jon > > > On Jul 22, 2009, at 4:57 PM, Donald French wrote: > > My apology... I accidentally hit send. Here is my full message. >> >> I have been tasked with upgrading our Mason install from 1.02 to the >> latest version (1.4.2) and all went smoothly until I tried to access certain >> components that appear to be missing their inheritance chain. Keep in mind >> this all worked in the old 1.02 version. >> >> I have a component (/_styles/_top_level) that contains... >> >> <% $m->call_next() %> >> >> <& /_methods/_submit_notice &> >> >> <%attr> >> submit_notice_message => "Your request is being processed..." >> </%attr> >> >> In the child component (/_method/_submit_notice) I have... >> >> <div id="submit_notice"> >> <% $m->base_comp->attr('submit_notice_message') %> >> </div> >> >> The child component simply accesses the attribute defined in the calling >> component however when I run this I get this Mason error: >> >> "no attribute 'submit_notice_message' for component >> /_methods/_submit_notice [html]" >> >> If I Dumper the $m->base_comp component I can see that the >> /_method/_submit_notice component is the object that is having ->attr() >> called on it and I can additionally see that in the code_cache the >> /top_level component is referenced and it contains an attr hash with the >> correct string in it. >> >> The really strange part however if that if I loop through the >> $m->callers() array and print out the component stack and their attr hashes >> I get: >> >> PATH: /_methods/_submit_notice >> ATTRS: $VAR1 = {}; >> >> PATH: /_styles/_top_level:top_matter >> ATTRS: $VAR1 = {}; >> >> PATH: /autohandler >> ATTRS: $VAR1 = { >> 'hide_environment_bar' => '0', >> 'escape_from_iframe' => 1 >> }; >> >> The attr hash is empty for /_styles/_top_level this case. I am not sure >> this is relevant but I am mentioning it in case someone else has also >> encountered this issue. >> >> Thanks for any help! >> >> >> >> >> ------------------------------------------------------------------------------ >> _______________________________________________ >> Mason-users mailing list >> Mason-users@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/mason-users >> > >
------------------------------------------------------------------------------
_______________________________________________ Mason-users mailing list Mason-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mason-users