Bypassing Local mason components

I would like to create a mason Local component (/opt/rt3/local/html/MyComp)
that will decide to either handle the request or pass it off to
the original component (/opt/rt3/share/html/MyComp) to handle.

What’s the easiest way to do this? I want to call the actual original
component and not duplicate it’s functionality.

Can I just call the original component with an absolute path
and my args? I guess I need some way to re-call the component
but bypass the local system.

Ideas?

Thanks.

-Todd

At Wednesday 5/18/2005 12:00 PM, Todd Chapman wrote:

I would like to create a mason Local component (/opt/rt3/local/html/MyComp)
that will decide to either handle the request or pass it off to
the original component (/opt/rt3/share/html/MyComp) to handle.

What’s the easiest way to do this? I want to call the actual original
component and not duplicate it’s functionality.

Can I just call the original component with an absolute path
and my args? I guess I need some way to re-call the component
but bypass the local system.

Ideas?

I wonder if you could do something funky with a sym link? Create
local/html/MyCompLink that points to share/html/MyComp and have your local
MyComp call local MyCompLink when it needs to call the original component.

I suspect this won’t work . If you find a solution I’d be interested to
hear about it.

Thanks,
Steve

At Wednesday 5/18/2005 12:00 PM, Todd Chapman wrote:

I would like to create a mason Local component (/opt/rt3/local/html/MyComp)
that will decide to either handle the request or pass it off to
the original component (/opt/rt3/share/html/MyComp) to handle.

What’s the easiest way to do this? I want to call the actual original
component and not duplicate it’s functionality.

Can I just call the original component with an absolute path
and my args? I guess I need some way to re-call the component
but bypass the local system.

Ideas?

I wonder if you could do something funky with a sym link? Create
local/html/MyCompLink that points to share/html/MyComp and have your local
MyComp call local MyCompLink when it needs to call the original component.

I suspect this won’t work . If you find a solution I’d be interested to
hear about it.

Thanks,
Steve

Figured it out!

  1. read: http://www.masonhq.com/?FAQ:Components#h-when_using_multiple_component_roots__is_there_a_way_to_explicitly_call_a_component_in_a_specific_root_

  2. perl -MCPAN -e ‘install MasonX::Request::ExtendedCompRoot’

  3. In RT_SiteConfig.pm:
    @MasonParameters = (request_class => ‘MasonX::Request::ExtendedCompRoot’, resolver_class => ‘MasonX::Resolver::ExtendedCompRoot’) unless (@MasonParameters);

  4. mkdir /opt/rt3/local/html/Ticket

  5. vi /opt/rt3/local/html/Ticket/Create.html with content:
    % if ($ARGS{Queue} == 1) {
    <& standard=>/Ticket/Create.html, %ARGS &>
    % $m->abort;
    % }
    bite me!

  6. mkdir /opt/rt3/local/html/Elements

  7. vi /opt/rt3/local/html/Elements/SelectOwner with content:
    Pick me! Pick me!

Try to create a ticket in queue with id 1.
Notice how SelectOwner is from local but Create.html is from share?
Try to create a ticket in queue with id > 1. Not happening!

See the MasonX::Request::ExtendedCompRoot for more fun.

-Todd

Todd, please post it on the wiki. Nice solution.

Regards, Ruslan.

Todd Chapman wrote:>On Wed, May 18, 2005 at 04:04:43PM -0400, Stephen Turner wrote:

At Wednesday 5/18/2005 12:00 PM, Todd Chapman wrote:

I would like to create a mason Local component (/opt/rt3/local/html/MyComp)
that will decide to either handle the request or pass it off to
the original component (/opt/rt3/share/html/MyComp) to handle.

What’s the easiest way to do this? I want to call the actual original
component and not duplicate it’s functionality.

Can I just call the original component with an absolute path
and my args? I guess I need some way to re-call the component
but bypass the local system.

Ideas?

I wonder if you could do something funky with a sym link? Create
local/html/MyCompLink that points to share/html/MyComp and have your local
MyComp call local MyCompLink when it needs to call the original component.

I suspect this won’t work . If you find a solution I’d be interested to
hear about it.

Thanks,
Steve

Figured it out!

  1. read: http://www.masonhq.com/?FAQ:Components#h-when_using_multiple_component_roots__is_there_a_way_to_explicitly_call_a_component_in_a_specific_root_

  2. perl -MCPAN -e ‘install MasonX::Request::ExtendedCompRoot’

  3. In RT_SiteConfig.pm:
    @MasonParameters = (request_class => ‘MasonX::Request::ExtendedCompRoot’, resolver_class => ‘MasonX::Resolver::ExtendedCompRoot’) unless (@MasonParameters);

  4. mkdir /opt/rt3/local/html/Ticket

  5. vi /opt/rt3/local/html/Ticket/Create.html with content:
    % if ($ARGS{Queue} == 1) {
    <& standard=>/Ticket/Create.html, %ARGS &>
    % $m->abort;
    % }
    bite me!

  6. mkdir /opt/rt3/local/html/Elements

  7. vi /opt/rt3/local/html/Elements/SelectOwner with content:
    Pick me! Pick me!

Try to create a ticket in queue with id 1.
Notice how SelectOwner is from local but Create.html is from share?
Try to create a ticket in queue with id > 1. Not happening!

See the MasonX::Request::ExtendedCompRoot for more fun.

-Todd


http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users

Be sure to check out the RT Wiki at http://wiki.bestpractical.com

Todd, please post it on the wiki. Nice solution.


Regards, Ruslan.

Thanks. Done.