Overwriting action_params

View: New views
11 Messages — Rating Filter:   Alert me  

Overwriting action_params

by Deco Rior :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Is there an easy way to replace a value in action_params? I want to  
simulate a url submission and do it in a single page?

Deco

--
This list is a free service of LassoSoft: http://www.LassoSoft.com/
Search the list archives: http://www.ListSearch.com/Lasso/Browse/
Manage your subscription: http://www.ListSearch.com/Lasso/


Re: Overwriting action_params

by Göran Törnquist-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

The action_params tag returns an array. Manipulate it as you wish, and
then feed into an inline. The action_params tag returns the
action_params local to the inline.

local('params' = action_params);

#params->removeAll('paramName');
#params->insert('paramName'='myValue');
inline(#params);
    //here action_params('paramName') returns 'myValue'
/inline;

/Göran

Deco Rior wrote:
> Is there an easy way to replace a value in action_params? I want to
> simulate a url submission and do it in a single page?
>
> Deco
>


--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.


--
This list is a free service of LassoSoft: http://www.LassoSoft.com/
Search the list archives: http://www.ListSearch.com/Lasso/Browse/
Manage your subscription: http://www.ListSearch.com/Lasso/


Re: Overwriting action_params

by Deco Rior :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thanks, Goran:

But I am trying t manipulate action_params itself.

II have a workaround for now.

Deco
On Jul 19, 2008, at 3:26 PM, Göran Törnquist wrote:

> The action_params tag returns an array. Manipulate it as you wish,  
> and then feed into an inline. The action_params tag returns the  
> action_params local to the inline.
>
> local('params' = action_params);
>
> #params->removeAll('paramName');
> #params->insert('paramName'='myValue');
> inline(#params);
>   //here action_params('paramName') returns 'myValue'
> /inline;
>
> /Göran
>
> Deco Rior wrote:
>> Is there an easy way to replace a value in action_params? I want to  
>> simulate a url submission and do it in a single page?
>>
>> Deco
>>
>
>
> --
> This message has been scanned for viruses and
> dangerous content by MailScanner, and is
> believed to be clean.
>
>
> --
> This list is a free service of LassoSoft: http://www.LassoSoft.com/
> Search the list archives: http://www.ListSearch.com/Lasso/Browse/
> Manage your subscription: http://www.ListSearch.com/Lasso/
>




--
This list is a free service of LassoSoft: http://www.LassoSoft.com/
Search the list archives: http://www.ListSearch.com/Lasso/Browse/
Manage your subscription: http://www.ListSearch.com/Lasso/


Re: Overwriting action_params

by Göran Törnquist-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

No matter how much you'll find a workaround, you're creating
dependencies on underlying data structures. That is really bad since the
action_params array is documented as read only, and in the future the
way it works internally may change. So, in my opinion, you're creating a
maintenance nightmare.

The way I showed you, is documented. I stand by my recommendation even
though it will be a tiny bit slower than your solution.

/Göran

Deco Rior wrote:

> Thanks, Goran:
>
> But I am trying t manipulate action_params itself.
>
> II have a workaround for now.
>
> Deco
> On Jul 19, 2008, at 3:26 PM, Göran Törnquist wrote:
>
>> The action_params tag returns an array. Manipulate it as you wish,
>> and then feed into an inline. The action_params tag returns the
>> action_params local to the inline.
>>
>> local('params' = action_params);
>>
>> #params->removeAll('paramName');
>> #params->insert('paramName'='myValue');
>> inline(#params);
>>   //here action_params('paramName') returns 'myValue'
>> /inline;
>>
>> /Göran
>>
>> Deco Rior wrote:
>>> Is there an easy way to replace a value in action_params? I want to
>>> simulate a url submission and do it in a single page?
>>>
>>> Deco
>>>

--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.


--
This list is a free service of LassoSoft: http://www.LassoSoft.com/
Search the list archives: http://www.ListSearch.com/Lasso/Browse/
Manage your subscription: http://www.ListSearch.com/Lasso/


Re: Overwriting action_params

by Deco Rior :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I agree with you.

My workaround does not change the structure. I am working on extending  
Greg L-Unit into an Integration frame work and as such need to  
simulate forms being passed into these structures.

It just means that I have to modify a large number of pages to  
accommodate the test framework. Unfortunately the method you describe  
does not work in this case.

In general, I never pass the action_params directly into any tag or  
inline.

So my workaround is this:

If I am in test mode, I do not populate variables from action_params,  
but do so directly. So I am modifying my files to accommodate  
essentially overwriting the action_params for the test framework.

I hope this makes sense?

If I used more XML I would just be inserting an XML test data set  
instead of what was passed from an external action. So I have to  
simulate this much more cryptically.

Deco


On Jul 19, 2008, at 9:32 PM, Göran Törnquist wrote:

> No matter how much you'll find a workaround, you're creating  
> dependencies on underlying data structures. That is really bad since  
> the action_params array is documented as read only, and in the  
> future the way it works internally may change. So, in my opinion,  
> you're creating a maintenance nightmare.
>
> The way I showed you, is documented. I stand by my recommendation  
> even though it will be a tiny bit slower than your solution.
>
> /Göran
>
> Deco Rior wrote:
>> Thanks, Goran:
>>
>> But I am trying t manipulate action_params itself.
>>
>> II have a workaround for now.
>>
>> Deco
>> On Jul 19, 2008, at 3:26 PM, Göran Törnquist wrote:
>>
>>> The action_params tag returns an array. Manipulate it as you wish,  
>>> and then feed into an inline. The action_params tag returns the  
>>> action_params local to the inline.
>>>
>>> local('params' = action_params);
>>>
>>> #params->removeAll('paramName');
>>> #params->insert('paramName'='myValue');
>>> inline(#params);
>>>  //here action_params('paramName') returns 'myValue'
>>> /inline;
>>>
>>> /Göran
>>>
>>> Deco Rior wrote:
>>>> Is there an easy way to replace a value in action_params? I want  
>>>> to simulate a url submission and do it in a single page?
>>>>
>>>> Deco
>>>>
>
> --
> This message has been scanned for viruses and
> dangerous content by MailScanner, and is
> believed to be clean.
>
>
> --
> This list is a free service of LassoSoft: http://www.LassoSoft.com/
> Search the list archives: http://www.ListSearch.com/Lasso/Browse/
> Manage your subscription: http://www.ListSearch.com/Lasso/
>




--
This list is a free service of LassoSoft: http://www.LassoSoft.com/
Search the list archives: http://www.ListSearch.com/Lasso/Browse/
Manage your subscription: http://www.ListSearch.com/Lasso/


Re: Overwriting action_params

by Göran Törnquist-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Ok, we're on the same page. But I don't
understand how that can't be accomplished using
my method. Would you care to elaborate?

/Göran

At 21.44 -0600 08-07-19, Deco Rior wrote:

>I agree with you.
>
>My workaround does not change the structure. I
>am working on extending Greg L-Unit into an
>Integration frame work and as such need to
>simulate forms being passed into these
>structures.
>
>It just means that I have to modify a large
>number of pages to accommodate the test
>framework. Unfortunately the method you describe
>does not work in this case.
>
>In general, I never pass the action_params directly into any tag or inline.
>
>So my workaround is this:
>
>If I am in test mode, I do not populate
>variables from action_params, but do so
>directly. So I am modifying my files to
>accommodate essentially overwriting the
>action_params for the test framework.
>
>I hope this makes sense?
>
>If I used more XML I would just be inserting an
>XML test data set instead of what was passed
>from an external action. So I have to simulate
>this much more cryptically.
>
>Deco
>
>
>On Jul 19, 2008, at 9:32 PM, Göran Törnquist wrote:
>
>>No matter how much you'll find a workaround,
>>you're creating dependencies on underlying data
>>structures. That is really bad since the
>>action_params array is documented as read only,
>>and in the future the way it works internally
>>may change. So, in my opinion, you're creating
>>a maintenance nightmare.
>>
>>The way I showed you, is documented. I stand by
>>my recommendation even though it will be a tiny
>>bit slower than your solution.
>>
>>/Göran
>>
>>Deco Rior wrote:
>>>Thanks, Goran:
>>>
>>>But I am trying t manipulate action_params itself.
>>>
>>>II have a workaround for now.
>>>
>>>Deco
>>>On Jul 19, 2008, at 3:26 PM, Göran Törnquist wrote:
>>>
>>>>The action_params tag returns an array.
>>>>Manipulate it as you wish, and then feed into
>>>>an inline. The action_params tag returns the
>>>>action_params local to the inline.
>>>>
>>>>local('params' = action_params);
>>>>
>>>>#params->removeAll('paramName');
>>>>#params->insert('paramName'='myValue');
>>>>inline(#params);
>>>>  //here action_params('paramName') returns 'myValue'
>>>>/inline;
>>>>
>>>>/Göran
>>>>
>>>>Deco Rior wrote:
>>>>>Is there an easy way to replace a value in
>>>>>action_params? I want to simulate a url
>>>>>submission and do it in a single page?
>>>>>
>>>>>Deco
>>>>>
>>
>>--
>>This message has been scanned for viruses and
>>dangerous content by MailScanner, and is
>>believed to be clean.
>>
>>
>>--
>>This list is a free service of LassoSoft: http://www.LassoSoft.com/
>>Search the list archives: http://www.ListSearch.com/Lasso/Browse/
>>Manage your subscription: http://www.ListSearch.com/Lasso/
>>
>
>
>
>
>--
>This list is a free service of LassoSoft: http://www.LassoSoft.com/
>Search the list archives: http://www.ListSearch.com/Lasso/Browse/
>Manage your subscription: http://www.ListSearch.com/Lasso/
>
>
>--
>This message has been scanned for viruses and
>dangerous content by MailScanner, and is
>believed to be clean.


--
-----------------
Göran Törnquist
Cortland AB
Sjökarbyvägen 23
184 34 Åkersberga

08-673 50 40
0733-86 04 70

--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.


--
This list is a free service of LassoSoft: http://www.LassoSoft.com/
Search the list archives: http://www.ListSearch.com/Lasso/Browse/
Manage your subscription: http://www.ListSearch.com/Lasso/


Parent Message unknown Re: Overwriting action_params

by Deco Rior :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi, Goran:

You may be thinking along these lines, but here is the detail.

So as part of the integration testing framework the idea is that response pages are "included" in the test (Literally as an include statement).

So the test framework must setup all the initial parameters prior to the include statement and then have the "tests" after the include statement, something like this:

var:'myvar' = 1;
var:'myvar' = 'smith';
var:'testmode' = boolean:true;   // turn on the test;
var:'debug' = boolean:true; // turn on the timer;
output_none; // cause we are just testing here!
include:'responseToBetested.lasso';
/output_none;
testresults; // Greg's modified L-unit
timerstats; // Jason's timer :-)

so you cannot manipulate parameters inside the include.

My workaround is simple...

In the code I have:

if:!(var:'testmode');
var:'myvar1 = (action_param:'myvar1');
var:'myvar2' = (action_param:'myvar2');
/if;

So I just skip all my variable assignments if I am in test mode and do them outside the file.

deco



-----Original Message-----
From: "Göran Törnquist" <goran@...>
Sent: Sunday, July 20, 2008 2:06pm
To: "Lasso Talk" <lasso@...>
Subject: Re: Overwriting action_params

Ok, we're on the same page. But I don't
understand how that can't be accomplished using
my method. Would you care to elaborate?

/Göran

At 21.44 -0600 08-07-19, Deco Rior wrote:

>I agree with you.
>
>My workaround does not change the structure. I
>am working on extending Greg L-Unit into an
>Integration frame work and as such need to
>simulate forms being passed into these
>structures.
>
>It just means that I have to modify a large
>number of pages to accommodate the test
>framework. Unfortunately the method you describe
>does not work in this case.
>
>In general, I never pass the action_params directly into any tag or inline.
>
>So my workaround is this:
>
>If I am in test mode, I do not populate
>variables from action_params, but do so
>directly. So I am modifying my files to
>accommodate essentially overwriting the
>action_params for the test framework.
>
>I hope this makes sense?
>
>If I used more XML I would just be inserting an
>XML test data set instead of what was passed
>from an external action. So I have to simulate
>this much more cryptically.
>
>Deco
>
>
>On Jul 19, 2008, at 9:32 PM, Göran Törnquist wrote:
>
>>No matter how much you'll find a workaround,
>>you're creating dependencies on underlying data
>>structures. That is really bad since the
>>action_params array is documented as read only,
>>and in the future the way it works internally
>>may change. So, in my opinion, you're creating
>>a maintenance nightmare.
>>
>>The way I showed you, is documented. I stand by
>>my recommendation even though it will be a tiny
>>bit slower than your solution.
>>
>>/Göran
>>
>>Deco Rior wrote:
>>>Thanks, Goran:
>>>
>>>But I am trying t manipulate action_params itself.
>>>
>>>II have a workaround for now.
>>>
>>>Deco
>>>On Jul 19, 2008, at 3:26 PM, Göran Törnquist wrote:
>>>
>>>>The action_params tag returns an array.
>>>>Manipulate it as you wish, and then feed into
>>>>an inline. The action_params tag returns the
>>>>action_params local to the inline.
>>>>
>>>>local('params' = action_params);
>>>>
>>>>#params->removeAll('paramName');
>>>>#params->insert('paramName'='myValue');
>>>>inline(#params);
>>>>  //here action_params('paramName') returns 'myValue'
>>>>/inline;
>>>>
>>>>/Göran
>>>>
>>>>Deco Rior wrote:
>>>>>Is there an easy way to replace a value in
>>>>>action_params? I want to simulate a url
>>>>>submission and do it in a single page?
>>>>>
>>>>>Deco
>>>>>
>>
>>--
>>This message has been scanned for viruses and
>>dangerous content by MailScanner, and is
>>believed to be clean.
>>
>>
>>--
>>This list is a free service of LassoSoft: http://www.LassoSoft.com/
>>Search the list archives: http://www.ListSearch.com/Lasso/Browse/
>>Manage your subscription: http://www.ListSearch.com/Lasso/
>>
>
>
>
>
>--
>This list is a free service of LassoSoft: http://www.LassoSoft.com/
>Search the list archives: http://www.ListSearch.com/Lasso/Browse/
>Manage your subscription: http://www.ListSearch.com/Lasso/
>
>
>--
>This message has been scanned for viruses and
>dangerous content by MailScanner, and is
>believed to be clean.


--
-----------------
Göran Törnquist
Cortland AB
Sjökarbyvägen 23
184 34 Åkersberga

08-673 50 40
0733-86 04 70

--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.


--
This list is a free service of LassoSoft: http://www.LassoSoft.com/
Search the list archives: http://www.ListSearch.com/Lasso/Browse/
Manage your subscription: http://www.ListSearch.com/Lasso/




--
This list is a free service of LassoSoft: http://www.LassoSoft.com/
Search the list archives: http://www.ListSearch.com/Lasso/Browse/
Manage your subscription: http://www.ListSearch.com/Lasso/


Re: Overwriting action_params

by Jason Huck :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

If a.lasso looks like this:

[
    var('a') = action_param('a');

    inline('a' = '2');
        include('b.lasso');
    /inline;

    'A: ' + $a + '<br>';
    'B: ' + $b + '<br>';
]

...and b.lasso looks like this:

[var('b') = action_param('a')]


If you call a.lasso like so:

/a.lasso?a=1

...the result will be:

A: 1
B: 2

...because the scope of action_params is controlled by the inline.


- jason






On Sun, Jul 20, 2008 at 3:23 PM,  <decorior@...> wrote:

> Hi, Goran:
>
> You may be thinking along these lines, but here is the detail.
>
> So as part of the integration testing framework the idea is that response pages are "included" in the test (Literally as an include statement).
>
> So the test framework must setup all the initial parameters prior to the include statement and then have the "tests" after the include statement, something like this:
>
> var:'myvar' = 1;
> var:'myvar' = 'smith';
> var:'testmode' = boolean:true;   // turn on the test;
> var:'debug' = boolean:true; // turn on the timer;
> output_none; // cause we are just testing here!
> include:'responseToBetested.lasso';
> /output_none;
> testresults; // Greg's modified L-unit
> timerstats; // Jason's timer :-)
>
> so you cannot manipulate parameters inside the include.
>
> My workaround is simple...
>
> In the code I have:
>
> if:!(var:'testmode');
> var:'myvar1 = (action_param:'myvar1');
> var:'myvar2' = (action_param:'myvar2');
> /if;
>
> So I just skip all my variable assignments if I am in test mode and do them outside the file.
>
> deco
>
>
>
> -----Original Message-----
> From: "Göran Törnquist" <goran@...>
> Sent: Sunday, July 20, 2008 2:06pm
> To: "Lasso Talk" <lasso@...>
> Subject: Re: Overwriting action_params
>
> Ok, we're on the same page. But I don't
> understand how that can't be accomplished using
> my method. Would you care to elaborate?
>
> /Göran
>
> At 21.44 -0600 08-07-19, Deco Rior wrote:
>>I agree with you.
>>
>>My workaround does not change the structure. I
>>am working on extending Greg L-Unit into an
>>Integration frame work and as such need to
>>simulate forms being passed into these
>>structures.
>>
>>It just means that I have to modify a large
>>number of pages to accommodate the test
>>framework. Unfortunately the method you describe
>>does not work in this case.
>>
>>In general, I never pass the action_params directly into any tag or inline.
>>
>>So my workaround is this:
>>
>>If I am in test mode, I do not populate
>>variables from action_params, but do so
>>directly. So I am modifying my files to
>>accommodate essentially overwriting the
>>action_params for the test framework.
>>
>>I hope this makes sense?
>>
>>If I used more XML I would just be inserting an
>>XML test data set instead of what was passed
>>from an external action. So I have to simulate
>>this much more cryptically.
>>
>>Deco
>>
>>
>>On Jul 19, 2008, at 9:32 PM, Göran Törnquist wrote:
>>
>>>No matter how much you'll find a workaround,
>>>you're creating dependencies on underlying data
>>>structures. That is really bad since the
>>>action_params array is documented as read only,
>>>and in the future the way it works internally
>>>may change. So, in my opinion, you're creating
>>>a maintenance nightmare.
>>>
>>>The way I showed you, is documented. I stand by
>>>my recommendation even though it will be a tiny
>>>bit slower than your solution.
>>>
>>>/Göran
>>>
>>>Deco Rior wrote:
>>>>Thanks, Goran:
>>>>
>>>>But I am trying t manipulate action_params itself.
>>>>
>>>>II have a workaround for now.
>>>>
>>>>Deco
>>>>On Jul 19, 2008, at 3:26 PM, Göran Törnquist wrote:
>>>>
>>>>>The action_params tag returns an array.
>>>>>Manipulate it as you wish, and then feed into
>>>>>an inline. The action_params tag returns the
>>>>>action_params local to the inline.
>>>>>
>>>>>local('params' = action_params);
>>>>>
>>>>>#params->removeAll('paramName');
>>>>>#params->insert('paramName'='myValue');
>>>>>inline(#params);
>>>>>  //here action_params('paramName') returns 'myValue'
>>>>>/inline;
>>>>>
>>>>>/Göran
>>>>>
>>>>>Deco Rior wrote:
>>>>>>Is there an easy way to replace a value in
>>>>>>action_params? I want to simulate a url
>>>>>>submission and do it in a single page?
>>>>>>
>>>>>>Deco
>>>>>>
>>>
>>>--
>>>This message has been scanned for viruses and
>>>dangerous content by MailScanner, and is
>>>believed to be clean.
>>>
>>>
>>>--
>>>This list is a free service of LassoSoft: http://www.LassoSoft.com/
>>>Search the list archives: http://www.ListSearch.com/Lasso/Browse/
>>>Manage your subscription: http://www.ListSearch.com/Lasso/
>>>
>>
>>
>>
>>
>>--
>>This list is a free service of LassoSoft: http://www.LassoSoft.com/
>>Search the list archives: http://www.ListSearch.com/Lasso/Browse/
>>Manage your subscription: http://www.ListSearch.com/Lasso/
>>
>>
>>--
>>This message has been scanned for viruses and
>>dangerous content by MailScanner, and is
>>believed to be clean.
>
>
> --
> -----------------
> Göran Törnquist
> Cortland AB
> Sjökarbyvägen 23
> 184 34 Åkersberga
>
> 08-673 50 40
> 0733-86 04 70
>
> --
> This message has been scanned for viruses and
> dangerous content by MailScanner, and is
> believed to be clean.
>
>
> --
> This list is a free service of LassoSoft: http://www.LassoSoft.com/
> Search the list archives: http://www.ListSearch.com/Lasso/Browse/
> Manage your subscription: http://www.ListSearch.com/Lasso/
>
>
>
>
> --
> This list is a free service of LassoSoft: http://www.LassoSoft.com/
> Search the list archives: http://www.ListSearch.com/Lasso/Browse/
> Manage your subscription: http://www.ListSearch.com/Lasso/
>
>



--
tagSwap.net :: Open Source Lasso Code
<http://tagSwap.net/>

--
This list is a free service of LassoSoft: http://www.LassoSoft.com/
Search the list archives: http://www.ListSearch.com/Lasso/Browse/
Manage your subscription: http://www.ListSearch.com/Lasso/


Re: Overwriting action_params

by Göran Törnquist-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I saw that Jason took a shot on this one, but I'm
set to follow through on it anyway.

Here's the deal.

If you wrap an include in an inline, it will
essentially be working as a simulated environment
that provides with action_params for the include.

So, the following will work out as you want it to be.

var:'myvar' = 1;
var:'myvar' = 'smith';
var:'testmode' = boolean:true;   // turn on the test;
var:'debug' = boolean:true; // turn on the timer;

inline('myvar1'=2, 'myvar2'=3);
     output_none; // cause we are just testing here!
         include:'responseToBetested.lasso';
     /output_none;
/inline;
testresults; // Greg's modified L-unit
timerstats; // Jason's timer :-)

The cool thing about this is that the code that
is supposed to be tested (in
responseToBeTested.lasso) will not need to know
anything about the testing conditions.

Makes sense?

/Göran

At 15.23 -0400 08-07-20, decorior@... wrote:

>Hi, Goran:
>
>You may be thinking along these lines, but here is the detail.
>
>So as part of the integration testing framework
>the idea is that response pages are "included"
>in the test (Literally as an include statement).
>
>So the test framework must setup all the initial
>parameters prior to the include statement and
>then have the "tests" after the include
>statement, something like this:
>
>var:'myvar' = 1;
>var:'myvar' = 'smith';
>var:'testmode' = boolean:true;   // turn on the test;
>var:'debug' = boolean:true; // turn on the timer;
>output_none; // cause we are just testing here!
>include:'responseToBetested.lasso';
>/output_none;
>testresults; // Greg's modified L-unit
>timerstats; // Jason's timer :-)
>
>so you cannot manipulate parameters inside the include.
>
>My workaround is simple...
>
>In the code I have:
>
>if:!(var:'testmode');
>var:'myvar1 = (action_param:'myvar1');
>var:'myvar2' = (action_param:'myvar2');
>/if;
>
>So I just skip all my variable assignments if I
>am in test mode and do them outside the file.
>
>deco
>
>
>
>-----Original Message-----
>From: "Göran Törnquist" <goran@...>
>Sent: Sunday, July 20, 2008 2:06pm
>To: "Lasso Talk" <lasso@...>
>Subject: Re: Overwriting action_params
>
>Ok, we're on the same page. But I don't
>understand how that can't be accomplished using
>my method. Would you care to elaborate?
>
>/Göran
>
>At 21.44 -0600 08-07-19, Deco Rior wrote:
>>I agree with you.
>>
>>My workaround does not change the structure. I
>>am working on extending Greg L-Unit into an
>>Integration frame work and as such need to
>>simulate forms being passed into these
>>structures.
>>
>>It just means that I have to modify a large
>>number of pages to accommodate the test
>>framework. Unfortunately the method you describe
>>does not work in this case.
>>
>>In general, I never pass the action_params directly into any tag or inline.
>>
>>So my workaround is this:
>>
>>If I am in test mode, I do not populate
>>variables from action_params, but do so
>>directly. So I am modifying my files to
>>accommodate essentially overwriting the
>>action_params for the test framework.
>>
>>I hope this makes sense?
>>
>>If I used more XML I would just be inserting an
>>XML test data set instead of what was passed
>>from an external action. So I have to simulate
>>this much more cryptically.
>>
>>Deco
>>
>>
>>On Jul 19, 2008, at 9:32 PM, Göran Törnquist wrote:
>>
>>>No matter how much you'll find a workaround,
>>>you're creating dependencies on underlying data
>>>structures. That is really bad since the
>>>action_params array is documented as read only,
>>>and in the future the way it works internally
>>>may change. So, in my opinion, you're creating
>>>a maintenance nightmare.
>>>
>>>The way I showed you, is documented. I stand by
>>>my recommendation even though it will be a tiny
>>>bit slower than your solution.
>>>
>>>/Göran
>>>
>>>Deco Rior wrote:
>>>>Thanks, Goran:
>>>>
>>>>But I am trying t manipulate action_params itself.
>>>>
>>>>II have a workaround for now.
>>>>
>>>>Deco
>>>>On Jul 19, 2008, at 3:26 PM, Göran Törnquist wrote:
>>>>
>>>>>The action_params tag returns an array.
>  >>>>Manipulate it as you wish, and then feed into
>>>>>an inline. The action_params tag returns the
>>>>>action_params local to the inline.
>>>>>
>>>>>local('params' = action_params);
>>>>>
>>>>>#params->removeAll('paramName');
>>>>>#params->insert('paramName'='myValue');
>>>>>inline(#params);
>>>>>   //here action_params('paramName') returns 'myValue'
>>>>>/inline;
>>>>>
>>>>>/Göran
>>>>>
>>>>>Deco Rior wrote:
>>>>>>Is there an easy way to replace a value in
>>>>>>action_params? I want to simulate a url
>>>>>>submission and do it in a single page?
>>>>>>
>>>>>>Deco
>>>>>>
>>>
>>>--
>>>This message has been scanned for viruses and
>>>dangerous content by MailScanner, and is
>>>believed to be clean.
>>>
>>>
>>>--
>>>This list is a free service of LassoSoft: http://www.LassoSoft.com/
>>>Search the list archives: http://www.ListSearch.com/Lasso/Browse/
>>>Manage your subscription: http://www.ListSearch.com/Lasso/
>>>
>>
>>
>>
>>
>>--
>>This list is a free service of LassoSoft: http://www.LassoSoft.com/
>>Search the list archives: http://www.ListSearch.com/Lasso/Browse/
>>Manage your subscription: http://www.ListSearch.com/Lasso/
>>
>>
>>--
>>This message has been scanned for viruses and
>>dangerous content by MailScanner, and is
>>believed to be clean.
>
>
>--
>-----------------
>Göran Törnquist
>Cortland AB
>Sjökarbyvägen 23
>184 34 Åkersberga
>
>08-673 50 40
>0733-86 04 70
>
>--
>This message has been scanned for viruses and
>dangerous content by MailScanner, and is
>believed to be clean.
>
>
>--
>This list is a free service of LassoSoft: http://www.LassoSoft.com/
>Search the list archives: http://www.ListSearch.com/Lasso/Browse/
>Manage your subscription: http://www.ListSearch.com/Lasso/
>
>
>
>
>--
>This list is a free service of LassoSoft: http://www.LassoSoft.com/
>Search the list archives: http://www.ListSearch.com/Lasso/Browse/
>Manage your subscription: http://www.ListSearch.com/Lasso/
>
>
>--
>This message has been scanned for viruses and
>dangerous content by MailScanner, and is
>believed to be clean.


--
-----------------
Göran Törnquist
Cortland AB
Sjökarbyvägen 23
184 34 Åkersberga

08-673 50 40
0733-86 04 70

--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.


--
This list is a free service of LassoSoft: http://www.LassoSoft.com/
Search the list archives: http://www.ListSearch.com/Lasso/Browse/
Manage your subscription: http://www.ListSearch.com/Lasso/


Parent Message unknown Re: Overwriting action_params

by Deco Rior :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Yes, thanks a bunch. that worked great.

Wow that will save me a bunch of code changes.

I had not realized I could effectively overwrite the action params with a wrapper inline. Did I miss this in the documentation?

IS anyone else out there using this type of model to build a test environment??

Thanks,

Deco

-----Original Message-----
From: "Göran Törnquist" <goran@...>
Sent: Sunday, July 20, 2008 5:10pm
To: "Lasso Talk" <lasso@...>
Subject: Re: Overwriting action_params

I saw that Jason took a shot on this one, but I'm
set to follow through on it anyway.

Here's the deal.

If you wrap an include in an inline, it will
essentially be working as a simulated environment
that provides with action_params for the include.

So, the following will work out as you want it to be.

var:'myvar' = 1;
var:'myvar' = 'smith';
var:'testmode' = boolean:true;   // turn on the test;
var:'debug' = boolean:true; // turn on the timer;

inline('myvar1'=2, 'myvar2'=3);
     output_none; // cause we are just testing here!
         include:'responseToBetested.lasso';
     /output_none;
/inline;
testresults; // Greg's modified L-unit
timerstats; // Jason's timer :-)

The cool thing about this is that the code that
is supposed to be tested (in
responseToBeTested.lasso) will not need to know
anything about the testing conditions.

Makes sense?

/Göran

At 15.23 -0400 08-07-20, decorior@... wrote:

>Hi, Goran:
>
>You may be thinking along these lines, but here is the detail.
>
>So as part of the integration testing framework
>the idea is that response pages are "included"
>in the test (Literally as an include statement).
>
>So the test framework must setup all the initial
>parameters prior to the include statement and
>then have the "tests" after the include
>statement, something like this:
>
>var:'myvar' = 1;
>var:'myvar' = 'smith';
>var:'testmode' = boolean:true;   // turn on the test;
>var:'debug' = boolean:true; // turn on the timer;
>output_none; // cause we are just testing here!
>include:'responseToBetested.lasso';
>/output_none;
>testresults; // Greg's modified L-unit
>timerstats; // Jason's timer :-)
>
>so you cannot manipulate parameters inside the include.
>
>My workaround is simple...
>
>In the code I have:
>
>if:!(var:'testmode');
>var:'myvar1 = (action_param:'myvar1');
>var:'myvar2' = (action_param:'myvar2');
>/if;
>
>So I just skip all my variable assignments if I
>am in test mode and do them outside the file.
>
>deco
>
>
>
>-----Original Message-----
>From: "Göran Törnquist" <goran@...>
>Sent: Sunday, July 20, 2008 2:06pm
>To: "Lasso Talk" <lasso@...>
>Subject: Re: Overwriting action_params
>
>Ok, we're on the same page. But I don't
>understand how that can't be accomplished using
>my method. Would you care to elaborate?
>
>/Göran
>
>At 21.44 -0600 08-07-19, Deco Rior wrote:
>>I agree with you.
>>
>>My workaround does not change the structure. I
>>am working on extending Greg L-Unit into an
>>Integration frame work and as such need to
>>simulate forms being passed into these
>>structures.
>>
>>It just means that I have to modify a large
>>number of pages to accommodate the test
>>framework. Unfortunately the method you describe
>>does not work in this case.
>>
>>In general, I never pass the action_params directly into any tag or inline.
>>
>>So my workaround is this:
>>
>>If I am in test mode, I do not populate
>>variables from action_params, but do so
>>directly. So I am modifying my files to
>>accommodate essentially overwriting the
>>action_params for the test framework.
>>
>>I hope this makes sense?
>>
>>If I used more XML I would just be inserting an
>>XML test data set instead of what was passed
>>from an external action. So I have to simulate
>>this much more cryptically.
>>
>>Deco
>>
>>
>>On Jul 19, 2008, at 9:32 PM, Göran Törnquist wrote:
>>
>>>No matter how much you'll find a workaround,
>>>you're creating dependencies on underlying data
>>>structures. That is really bad since the
>>>action_params array is documented as read only,
>>>and in the future the way it works internally
>>>may change. So, in my opinion, you're creating
>>>a maintenance nightmare.
>>>
>>>The way I showed you, is documented. I stand by
>>>my recommendation even though it will be a tiny
>>>bit slower than your solution.
>>>
>>>/Göran
>>>
>>>Deco Rior wrote:
>>>>Thanks, Goran:
>>>>
>>>>But I am trying t manipulate action_params itself.
>>>>
>>>>II have a workaround for now.
>>>>
>>>>Deco
>>>>On Jul 19, 2008, at 3:26 PM, Göran Törnquist wrote:
>>>>
>>>>>The action_params tag returns an array.
>  >>>>Manipulate it as you wish, and then feed into
>>>>>an inline. The action_params tag returns the
>>>>>action_params local to the inline.
>>>>>
>>>>>local('params' = action_params);
>>>>>
>>>>>#params->removeAll('paramName');
>>>>>#params->insert('paramName'='myValue');
>>>>>inline(#params);
>>>>>   //here action_params('paramName') returns 'myValue'
>>>>>/inline;
>>>>>
>>>>>/Göran
>>>>>
>>>>>Deco Rior wrote:
>>>>>>Is there an easy way to replace a value in
>>>>>>action_params? I want to simulate a url
>>>>>>submission and do it in a single page?
>>>>>>
>>>>>>Deco
>>>>>>
>>>
>>>--
>>>This message has been scanned for viruses and
>>>dangerous content by MailScanner, and is
>>>believed to be clean.
>>>
>>>
>>>--
>>>This list is a free service of LassoSoft: http://www.LassoSoft.com/
>>>Search the list archives: http://www.ListSearch.com/Lasso/Browse/
>>>Manage your subscription: http://www.ListSearch.com/Lasso/
>>>
>>
>>
>>
>>
>>--
>>This list is a free service of LassoSoft: http://www.LassoSoft.com/
>>Search the list archives: http://www.ListSearch.com/Lasso/Browse/
>>Manage your subscription: http://www.ListSearch.com/Lasso/
>>
>>
>>--
>>This message has been scanned for viruses and
>>dangerous content by MailScanner, and is
>>believed to be clean.
>
>
>--
>-----------------
>Göran Törnquist
>Cortland AB
>Sjökarbyvägen 23
>184 34 Åkersberga
>
>08-673 50 40
>0733-86 04 70
>
>--
>This message has been scanned for viruses and
>dangerous content by MailScanner, and is
>believed to be clean.
>
>
>--
>This list is a free service of LassoSoft: http://www.LassoSoft.com/
>Search the list archives: http://www.ListSearch.com/Lasso/Browse/
>Manage your subscription: http://www.ListSearch.com/Lasso/
>
>
>
>
>--
>This list is a free service of LassoSoft: http://www.LassoSoft.com/
>Search the list archives: http://www.ListSearch.com/Lasso/Browse/
>Manage your subscription: http://www.ListSearch.com/Lasso/
>
>
>--
>This message has been scanned for viruses and
>dangerous content by MailScanner, and is
>believed to be clean.


--
-----------------
Göran Törnquist
Cortland AB
Sjökarbyvägen 23
184 34 Åkersberga

08-673 50 40
0733-86 04 70

--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.


--
This list is a free service of LassoSoft: http://www.LassoSoft.com/
Search the list archives: http://www.ListSearch.com/Lasso/Browse/
Manage your subscription: http://www.ListSearch.com/Lasso/




--
This list is a free service of LassoSoft: http://www.LassoSoft.com/
Search the list archives: http://www.ListSearch.com/Lasso/Browse/
Manage your subscription: http://www.ListSearch.com/Lasso/


Re: Overwriting action_params

by Göran Törnquist-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I use a similar approach as the L-Unit test environment.

IIRC, in the early days (Lasso 3) you used an
inline with the -reuseparams param. With Lasso
Professional 5 it changed to simply use any
params you included in the inline to the
action_params array. The downside is that if you
make an inline without adding action_params to
the inline params, then you  won't have any
action_params at all from the request.

Makes sense? Maybe not. But I guess Jasons
previous example makes it quite clear.

/Göran

At 17.26 -0400 08-07-20, decorior@... wrote:

>Yes, thanks a bunch. that worked great.
>
>Wow that will save me a bunch of code changes.
>
>I had not realized I could effectively overwrite
>the action params with a wrapper inline. Did I
>miss this in the documentation?
>
>IS anyone else out there using this type of
>model to build a test environment??
>
>Thanks,
>
>Deco
>
>-----Original Message-----
>From: "Göran Törnquist" <goran@...>
>Sent: Sunday, July 20, 2008 5:10pm
>To: "Lasso Talk" <lasso@...>
>Subject: Re: Overwriting action_params
>
>I saw that Jason took a shot on this one, but I'm
>set to follow through on it anyway.
>
>Here's the deal.
>
>If you wrap an include in an inline, it will
>essentially be working as a simulated environment
>that provides with action_params for the include.
>
>So, the following will work out as you want it to be.
>
>var:'myvar' = 1;
>var:'myvar' = 'smith';
>var:'testmode' = boolean:true;   // turn on the test;
>var:'debug' = boolean:true; // turn on the timer;
>
>inline('myvar1'=2, 'myvar2'=3);
>      output_none; // cause we are just testing here!
>          include:'responseToBetested.lasso';
>      /output_none;
>/inline;
>testresults; // Greg's modified L-unit
>timerstats; // Jason's timer :-)
>
>The cool thing about this is that the code that
>is supposed to be tested (in
>responseToBeTested.lasso) will not need to know
>anything about the testing conditions.
>
>Makes sense?
>
>/Göran
>
>At 15.23 -0400 08-07-20, decorior@... wrote:
>>Hi, Goran:
>>
>>You may be thinking along these lines, but here is the detail.
>>
>>So as part of the integration testing framework
>>the idea is that response pages are "included"
>>in the test (Literally as an include statement).
>>
>>So the test framework must setup all the initial
>>parameters prior to the include statement and
>>then have the "tests" after the include
>>statement, something like this:
>>
>>var:'myvar' = 1;
>>var:'myvar' = 'smith';
>>var:'testmode' = boolean:true;   // turn on the test;
>>var:'debug' = boolean:true; // turn on the timer;
>>output_none; // cause we are just testing here!
>>include:'responseToBetested.lasso';
>>/output_none;
>>testresults; // Greg's modified L-unit
>>timerstats; // Jason's timer :-)
>>
>>so you cannot manipulate parameters inside the include.
>>
>>My workaround is simple...
>>
>>In the code I have:
>>
>>if:!(var:'testmode');
>>var:'myvar1 = (action_param:'myvar1');
>>var:'myvar2' = (action_param:'myvar2');
>>/if;
>>
>>So I just skip all my variable assignments if I
>>am in test mode and do them outside the file.
>>
>>deco
>>
>>
>>
>>-----Original Message-----
>>From: "Göran Törnquist" <goran@...>
>>Sent: Sunday, July 20, 2008 2:06pm
>>To: "Lasso Talk" <lasso@...>
>>Subject: Re: Overwriting action_params
>>
>>Ok, we're on the same page. But I don't
>>understand how that can't be accomplished using
>>my method. Would you care to elaborate?
>>
>>/Göran
>>
>>At 21.44 -0600 08-07-19, Deco Rior wrote:
>>>I agree with you.
>>>
>>>My workaround does not change the structure. I
>>>am working on extending Greg L-Unit into an
>>>Integration frame work and as such need to
>>>simulate forms being passed into these
>>>structures.
>>>
>>>It just means that I have to modify a large
>>>number of pages to accommodate the test
>>>framework. Unfortunately the method you describe
>>>does not work in this case.
>>>
>>>In general, I never pass the action_params directly into any tag or inline.
>>>
>>>So my workaround is this:
>>>
>  >>If I am in test mode, I do not populate
>>>variables from action_params, but do so
>>>directly. So I am modifying my files to
>>>accommodate essentially overwriting the
>>>action_params for the test framework.
>>>
>>>I hope this makes sense?
>>>
>>>If I used more XML I would just be inserting an
>>>XML test data set instead of what was passed
>>>from an external action. So I have to simulate
>>>this much more cryptically.
>>>
>>>Deco
>>>
>>>
>>>On Jul 19, 2008, at 9:32 PM, Göran Törnquist wrote:
>>>
>>>>No matter how much you'll find a workaround,
>>>>you're creating dependencies on underlying data
>>>>structures. That is really bad since the
>>>>action_params array is documented as read only,
>>>>and in the future the way it works internally
>>>>may change. So, in my opinion, you're creating
>>>>a maintenance nightmare.
>>>>
>>>>The way I showed you, is documented. I stand by
>>>>my recommendation even though it will be a tiny
>>>>bit slower than your solution.
>>>>
>>>>/Göran
>>>>
>>>>Deco Rior wrote:
>>>>>Thanks, Goran:
>>>>>
>>>>>But I am trying t manipulate action_params itself.
>>>>>
>>>>>II have a workaround for now.
>>>>>
>>>>>Deco
>>>>>On Jul 19, 2008, at 3:26 PM, Göran Törnquist wrote:
>>>>>
>>>>>>The action_params tag returns an array.
>>   >>>>Manipulate it as you wish, and then feed into
>>>>>>an inline. The action_params tag returns the
>>>>>>action_params local to the inline.
>>>>>>
>>>>>>local('params' = action_params);
>>>>>>
>>>>>>#params->removeAll('paramName');
>>>>>>#params->insert('paramName'='myValue');
>>>>>>inline(#params);
>>>>>>    //here action_params('paramName') returns 'myValue'
>>>>>>/inline;
>>>>>>
>>>>>>/Göran
>>>>>>
>>>>>>Deco Rior wrote:
>>>>>>>Is there an easy way to replace a value in
>>>>>>>action_params? I want to simulate a url
>>>>>>>submission and do it in a single page?
>>>>>>>
>>>>>>>Deco
>>>>>>>
>>>>
>>>>--
>>>>This message has been scanned for viruses and
>>>>dangerous content by MailScanner, and is
>>>>believed to be clean.
>>>>
>>>>
>>>>--
>>>>This list is a free service of LassoSoft: http://www.LassoSoft.com/
>>>>Search the list archives: http://www.ListSearch.com/Lasso/Browse/
>>>>Manage your subscription: http://www.ListSearch.com/Lasso/
>>>>
>>>
>>>
>>>
>>>
>>>--
>>>This list is a free service of LassoSoft: http://www.LassoSoft.com/
>>>Search the list archives: http://www.ListSearch.com/Lasso/Browse/
>>>Manage your subscription: http://www.ListSearch.com/Lasso/
>>>
>>>
>>>--
>>>This message has been scanned for viruses and
>>>dangerous content by MailScanner, and is
>>>believed to be clean.
>>
>>
>>--
>>-----------------
>>Göran Törnquist
>>Cortland AB
>>Sjökarbyvägen 23
>>184 34 Åkersberga
>>
>>08-673 50 40
>>0733-86 04 70
>>
>>--
>>This message has been scanned for viruses and
>>dangerous content by MailScanner, and is
>>believed to be clean.
>>
>>
>>--
>>This list is a free service of LassoSoft: http://www.LassoSoft.com/
>>Search the list archives: http://www.ListSearch.com/Lasso/Browse/
>>Manage your subscription: http://www.ListSearch.com/Lasso/
>>
>>
>>
>>
>>--
>>This list is a free service of LassoSoft: http://www.LassoSoft.com/
>>Search the list archives: http://www.ListSearch.com/Lasso/Browse/
>>Manage your subscription: http://www.ListSearch.com/Lasso/
>>
>>
>>--
>>This message has been scanned for viruses and
>>dangerous