[Laszlo-user] Querystring Dataset Attribute
P T Withington
ptw at openlaszlo.org
Mon Sep 10 12:19:26 PDT 2007
What you are trying to do is merge the existing query with some new
parameters, not set. So what you would need to do (untested):
// There probably should be a dataset getQueryParams API
// so you don't have to do these two steps manually
var parms = new LzParam();
parms.parseQueryString(<dataset>.getQueryString());
// for each parameter you need to add
parms.addValue(<key>, <val>);
// Replace the query with the updated parameters
<dataset>.setQueryString(parms);
On 2007-09-10, at 14:56 EDT, David Buckler wrote:
> Here is how I used to use the querystring attribute. I have a file
> where the datasets for the whole application are declared, each
> with the
> querystring attribute holding the method that the dataset is calling.
>> From there the application would fill in additional query parameters
> from the user interaction with the setQueryParams call. We then
> call a
> method in the application that adds the user authentication with
> setQueryParams right before we doRequest. From what has been
> described
> below it sounds like even if the querystring bug is fixed this feature
> of using querystring and then setQueryParams will no longer be
> supported. This workflow theory is the foundation for every database
> call in our application, how would you suggest fitting this theory
> into
> with the new way that the dataset class is being layed out. For right
> now I am thinking of a duct tape solution where oninit of the
> application I setQueryParams with the method for each dataset I am
> using.
>
> David
>
> -----Original Message-----
> From: Henry Minsky [mailto:henry.minsky at gmail.com]
> Sent: Friday, September 07, 2007 2:03 PM
> To: P T Withington
> Cc: David Buckler; Laszlo
> Subject: Re: [Laszlo-user] Querystring Dataset Attribute
>
> Yeah, that's it. The issue was whether the API should attempt to merge
> all the query info together: from the original URL, from the query
> params table, and from the query string, and that just seemed even
> more confusing if you considered all the possible permutations
>
>
> On 9/7/07, P T Withington <ptw at openlaszlo.org> wrote:
>> I think the intent was that set of src, query string or query params
>> all boil down to setting the query on the src url. The string and
>> params interfaces are convenience methods, but they should all be
>> affecting the same underlying url.
>>
>> On 2007-09-07, at 16:41 EDT, Henry Minsky wrote:
>>
>>> Yes, that is actually by design, setqueryparams blanks out the
>>> querystring attribute.
>>> I forgot why we made it do that, it does seem confusing now.
>>>
>>>
>>>
>>> On 9/7/07, David Buckler <db at intuvo.com> wrote:
>>>> I did reproduce this and it does work. However in my case I need
> to
>>>> call setQueryParam/setQueryParams and when you do that it blanks
>>>> out the
>>>> querystring attribute. Let me know if you are noticing the same
>>>> behavior.
>>>>
>>>> David
>>>>
>>>> -----Original Message-----
>>>> From: Henry Minsky [mailto:henry.minsky at gmail.com]
>>>> Sent: Thursday, September 06, 2007 3:41 PM
>>>> To: David Buckler
>>>> Cc: laszlo-user at openlaszlo.org
>>>> Subject: Re: [Laszlo-user] Querystring Dataset Attribute
>>>>
>>>> Are you sure about that? If I run this example
>>>>
>>>> <dataset name="ds_test" request="false" queuerequests="true"
>>>> type="http"
>>>> src="https://testing.laszlo.com/test.cfc?method=baz"
>>>> secure="true"
>>>> />
>>>>
>>>> And then ask for ds_test.querystring in the debugger, I get the
>>>> 'method=baz' string as the value
>>>>
>>>> lzx> ds_test.querystring
>>>> 'method=baz'
>>>>
>>>>
>>>>
>>>> On 9/6/07, David Buckler <db at intuvo.com> wrote:
>>>>> In addition when I add "?method=foo" to the src url, where it
> should
>>>>> parse out and set the querystring, it doesn't behave correctly
>>>>> either.
>>>>>
>>>>> Its almost seems like the setSrc function is being called twice;
> the
>>>>> first time when it gets parsed correctly and the "?method=foo"
> gets
>>>>> stripped from the src attribute by:
>>>>>
>>>>> url.query = null;
>>>>> this.src = url.toString();
>>>>>
>>>>> then it gets run again and the querystring gets blanked out, just
>>>>> like
>>>>> when you set the querystring attribute like I have.
>>>>>
>>>>> Just a thought.
>>>>> David
>>>>>
>>>>> -----Original Message-----
>>>>> From: Henry Minsky [mailto:henry.minsky at gmail.com]
>>>>> Sent: Thursday, September 06, 2007 3:02 PM
>>>>> To: David Buckler
>>>>> Cc: laszlo-user at openlaszlo.org
>>>>> Subject: Re: [Laszlo-user] Querystring Dataset Attribute
>>>>>
>>>>> Yes, that is a bug. I will file a bug report.
>>>>>
>>>>> The setter for the "src" attribute in LzDataset.lzs is nulling
>>>>> out the
>>>>> querystring arg, because it tries to parse it out of the src url.
>>>>>
>>>>> LzDataset.lzs:
>>>>> function setSrc( src ) {
>>>>> var url = new LzURL(src);
>>>>> this.querystring = url.query;
>>>>> url.query = null;
>>>>> this.src = url.toString();
>>>>> if ( this.autorequest ){
>>>>> this.doRequest() ;
>>>>> }
>>>>> }
>>>>>
>>>>> I guess it ought to check if the user supplied the argument during
>>>>> init. The question is what to do if there is a conflict between
> the
>>>>> src url and the querystring, like
>>>>>
>>>>> <dataset src="http:foo.php?method=foo" querystring="method=bar"/>
>>>>>
>>>>> I guess a runtime warning would be the right thing to do.
>>>>>
>>>>> The workaround for you would be to call setQueryString manually
>>>>> before
>>>>> making the request.
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> On 9/6/07, David Buckler <db at intuvo.com> wrote:
>>>>>>
>>>>>> Thanks for checking this out Henry, here is a test line,
> obviously
>>>> the
>>>>>> cfc that this points to isn't real. Also in our situation we add
>>>>> query
>>>>>> parameters with the setQueryParam method. When I watch the HTTP
>>>>> requests
>>>>>> I notice that the querystring parameter is never added but the
>>>>>> parameters that are with setQueryParam are. I also tested by
>>>>>> adding
>>>>> the
>>>>>> method=testme to the end of the src and that didn't work either.
>>>>>> However from what I understand that is just pulled off the end of
>>>> the
>>>>>> src and is stored in the querystring attribute. Note that other
>>>>>> datasets we are using where we set the method by means of the
>>>>>> setQueryParam work fine.
>>>>>>
>>>>>> David
>>>>>>
>>>>>>
>>>>>> <dataset name="ds_test" request="false" queuerequests="true"
>>>>> type="http"
>>>>>> src="https://testing.laszlo.com/test.cfc" secure="true"
>>>>>> querystring="method=testme"/>
>>>>>>
>>>>>> -----Original Message-----
>>>>>> From: Henry Minsky [mailto:henry.minsky at gmail.com]
>>>>>> Sent: Thursday, September 06, 2007 1:42 PM
>>>>>> To: David Buckler
>>>>>> Cc: laszlo-user at openlaszlo.org
>>>>>> Subject: Re: [Laszlo-user] Querystring Dataset Attribute
>>>>>>
>>>>>> You might want to compare the behavior in one of the nightly
> builds
>>>> of
>>>>>> LPS 4, to see if there is an issue that may have been recently
>>>> fixed,
>>>>>> as well.
>>>>>>
>>>>>>
>>>>>>
>>>>>> On 9/6/07, Henry Minsky <henry.minsky at gmail.com> wrote:
>>>>>>> Do you have a small test case you can send me?
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> On 9/6/07, David Buckler <db at intuvo.com> wrote:
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> I just installed 4.0.3 and have begun moving my code base from
>>>>> 3.3.3
>>>>>> over to
>>>>>>>> the new version. I am having an issue with the querystring
>>>>>> attribute in the
>>>>>>>> dataset object. It appears that Laszlo isn't even paying
>>>>> attention
>>>>>> to it.
>>>>>>>> Has anyone had a similar problem or know anything about this?
>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>> Henry Minsky
>>>>>>> Software Architect
>>>>>>> hminsky at laszlosystems.com
>>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> Henry Minsky
>>>>>> Software Architect
>>>>>> hminsky at laszlosystems.com
>>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Henry Minsky
>>>>> Software Architect
>>>>> hminsky at laszlosystems.com
>>>>>
>>>>
>>>>
>>>> --
>>>> Henry Minsky
>>>> Software Architect
>>>> hminsky at laszlosystems.com
>>>>
>>>
>>>
>>> --
>>> Henry Minsky
>>> Software Architect
>>> hminsky at laszlosystems.com
>>
>>
>
>
> --
> Henry Minsky
> Software Architect
> hminsky at laszlosystems.com
>
More information about the Laszlo-user
mailing list