I tried to do some tests about transferring data via context from one page to another in pier. I did
renderContentOn: html | ctx | self context propertyAt: #forwardText put: 'set on old context'. ctx := self context structure: (PRPathLookup start: self context structure path: '/targetpage'). ctx propertyAt: #forwardText put: 'set on new context'. html anchor goto: ctx; with: 'go' On the targetpage there is a component that reads the property from the context and displays it. What makes me wonder is that under any circumstances the text being display is "set on old context". Even if I press the link "go". Why is that so? Norbert _______________________________________________ Magritte, Pier and Related Tools ... https://www.iam.unibe.ch/mailman/listinfo/smallwiki |
Does your component store the old context instead of the current one?
Lukas On 8 April 2010 08:21, Norbert Hartl <[hidden email]> wrote: > I tried to do some tests about transferring data via context from one page to another in pier. I did > > renderContentOn: html > | ctx | > self context propertyAt: #forwardText put: 'set on old context'. > ctx := self context structure: (PRPathLookup start: self context structure path: '/targetpage'). > ctx propertyAt: #forwardText put: 'set on new context'. > html anchor > goto: ctx; > with: 'go' > > On the targetpage there is a component that reads the property from the context and displays it. What makes me wonder is that under any circumstances the text being display is "set on old context". Even if I press the link "go". Why is that so? > > Norbert > _______________________________________________ > Magritte, Pier and Related Tools ... > https://www.iam.unibe.ch/mailman/listinfo/smallwiki > -- Lukas Renggli www.lukas-renggli.ch _______________________________________________ Magritte, Pier and Related Tools ... https://www.iam.unibe.ch/mailman/listinfo/smallwiki |
On 08.04.2010, at 08:35, Lukas Renggli wrote: > Does your component store the old context instead of the current one? > I don't understand your question. I just created the context through using structure: and this context is bound to the html anchor. What do you mean by "store"? There is no storing of a context. The other component is simply: renderContentOn: html html text: (self context propertyAt: #forwardText ifAbsent: ['kein Text vorhanden']) Norbert > On 8 April 2010 08:21, Norbert Hartl <[hidden email]> wrote: >> I tried to do some tests about transferring data via context from one page to another in pier. I did >> >> renderContentOn: html >> | ctx | >> self context propertyAt: #forwardText put: 'set on old context'. >> ctx := self context structure: (PRPathLookup start: self context structure path: '/targetpage'). >> ctx propertyAt: #forwardText put: 'set on new context'. >> html anchor >> goto: ctx; >> with: 'go' >> >> On the targetpage there is a component that reads the property from the context and displays it. What makes me wonder is that under any circumstances the text being display is "set on old context". Even if I press the link "go". Why is that so? >> >> Norbert >> _______________________________________________ >> Magritte, Pier and Related Tools ... >> https://www.iam.unibe.ch/mailman/listinfo/smallwiki >> > > > > -- > Lukas Renggli > www.lukas-renggli.ch > > _______________________________________________ > Magritte, Pier and Related Tools ... > https://www.iam.unibe.ch/mailman/listinfo/smallwiki _______________________________________________ Magritte, Pier and Related Tools ... https://www.iam.unibe.ch/mailman/listinfo/smallwiki |
> The other component is simply:
> > renderContentOn: html > html text: (self context propertyAt: #forwardText ifAbsent: ['kein Text vorhanden']) Yeah, but maybe #context uses an old cached context? Can you check which is returned from that method, "self context" or "ctx"? To me it looks like "self context" is returned, because there are several tests that set properties and copy contexts, and they pass. Lukas > > Norbert > >> On 8 April 2010 08:21, Norbert Hartl <[hidden email]> wrote: >>> I tried to do some tests about transferring data via context from one page to another in pier. I did >>> >>> renderContentOn: html >>> | ctx | >>> self context propertyAt: #forwardText put: 'set on old context'. >>> ctx := self context structure: (PRPathLookup start: self context structure path: '/targetpage'). >>> ctx propertyAt: #forwardText put: 'set on new context'. >>> html anchor >>> goto: ctx; >>> with: 'go' >>> >>> On the targetpage there is a component that reads the property from the context and displays it. What makes me wonder is that under any circumstances the text being display is "set on old context". Even if I press the link "go". Why is that so? >>> >>> Norbert >>> _______________________________________________ >>> Magritte, Pier and Related Tools ... >>> https://www.iam.unibe.ch/mailman/listinfo/smallwiki >>> >> >> >> >> -- >> Lukas Renggli >> www.lukas-renggli.ch >> >> _______________________________________________ >> Magritte, Pier and Related Tools ... >> https://www.iam.unibe.ch/mailman/listinfo/smallwiki > > > _______________________________________________ > Magritte, Pier and Related Tools ... > https://www.iam.unibe.ch/mailman/listinfo/smallwiki > -- Lukas Renggli www.lukas-renggli.ch _______________________________________________ Magritte, Pier and Related Tools ... https://www.iam.unibe.ch/mailman/listinfo/smallwiki |
On 08.04.2010, at 09:10, Lukas Renggli wrote: >> The other component is simply: >> >> renderContentOn: html >> html text: (self context propertyAt: #forwardText ifAbsent: ['kein Text vorhanden']) > > Yeah, but maybe #context uses an old cached context? Can you check > which is returned from that method, "self context" or "ctx"? To me it > looks like "self context" is returned, because there are several tests > that set properties and copy contexts, and they pass. > > Norbert >> >> Norbert >> >>> On 8 April 2010 08:21, Norbert Hartl <[hidden email]> wrote: >>>> I tried to do some tests about transferring data via context from one page to another in pier. I did >>>> >>>> renderContentOn: html >>>> | ctx | >>>> self context propertyAt: #forwardText put: 'set on old context'. >>>> ctx := self context structure: (PRPathLookup start: self context structure path: '/targetpage'). >>>> ctx propertyAt: #forwardText put: 'set on new context'. >>>> html anchor >>>> goto: ctx; >>>> with: 'go' >>>> >>>> On the targetpage there is a component that reads the property from the context and displays it. What makes me wonder is that under any circumstances the text being display is "set on old context". Even if I press the link "go". Why is that so? >>>> >>>> Norbert >>>> _______________________________________________ >>>> Magritte, Pier and Related Tools ... >>>> https://www.iam.unibe.ch/mailman/listinfo/smallwiki >>>> >>> >>> >>> >>> -- >>> Lukas Renggli >>> www.lukas-renggli.ch >>> >>> _______________________________________________ >>> Magritte, Pier and Related Tools ... >>> https://www.iam.unibe.ch/mailman/listinfo/smallwiki >> >> >> _______________________________________________ >> Magritte, Pier and Related Tools ... >> https://www.iam.unibe.ch/mailman/listinfo/smallwiki >> > > > > -- > Lukas Renggli > www.lukas-renggli.ch > > _______________________________________________ > Magritte, Pier and Related Tools ... > https://www.iam.unibe.ch/mailman/listinfo/smallwiki _______________________________________________ Magritte, Pier and Related Tools ... https://www.iam.unibe.ch/mailman/listinfo/smallwiki |
In reply to this post by NorbertHartl
At 09:03 08/04/2010, Norbert Hartl wrote:
>I don't understand your question. Hi Norbert, The default implementations of #context in Pier, which is *PRCurrentContext value*, return the CURRENT context. In your case, the current context holds 'set on new context'. So, the behavior that you are observing seems rather 'normal', except if "your component store[s] the old context". This is what I understood from Lukas' message. In other terms, what I understand is that if you need the 'old' context, it should be cached by your component. Hoping this helps, Reza _______________________________________________ Magritte, Pier and Related Tools ... https://www.iam.unibe.ch/mailman/listinfo/smallwiki |
In reply to this post by Lukas Renggli
In
PRContext>>urlOn there is (self command isRestful and: [ html context session hasSessionCookie ]) ifTrue: [ url purgeSeasideFields ] ifFalse: [ url addParameter: '_n'; addParameter: (html callbacks registerActionCallback: [ PRCurrentContext value: self.]) ]. At a first glance it looks like the new context is only set in the ifFalse: block. In my installation hasSessionCookie is true even if I switch off session cookie in the app configuration. I loaded per with ConfigurationOfSeaside and version string '1.2.1.3' Norbert On 08.04.2010, at 09:10, Lukas Renggli wrote: >> The other component is simply: >> >> renderContentOn: html >> html text: (self context propertyAt: #forwardText ifAbsent: ['kein Text vorhanden']) > > Yeah, but maybe #context uses an old cached context? Can you check > which is returned from that method, "self context" or "ctx"? To me it > looks like "self context" is returned, because there are several tests > that set properties and copy contexts, and they pass. > > Lukas > > > > >> >> Norbert >> >>> On 8 April 2010 08:21, Norbert Hartl <[hidden email]> wrote: >>>> I tried to do some tests about transferring data via context from one page to another in pier. I did >>>> >>>> renderContentOn: html >>>> | ctx | >>>> self context propertyAt: #forwardText put: 'set on old context'. >>>> ctx := self context structure: (PRPathLookup start: self context structure path: '/targetpage'). >>>> ctx propertyAt: #forwardText put: 'set on new context'. >>>> html anchor >>>> goto: ctx; >>>> with: 'go' >>>> >>>> On the targetpage there is a component that reads the property from the context and displays it. What makes me wonder is that under any circumstances the text being display is "set on old context". Even if I press the link "go". Why is that so? >>>> >>>> Norbert >>>> _______________________________________________ >>>> Magritte, Pier and Related Tools ... >>>> https://www.iam.unibe.ch/mailman/listinfo/smallwiki >>>> >>> >>> >>> >>> -- >>> Lukas Renggli >>> www.lukas-renggli.ch >>> >>> _______________________________________________ >>> Magritte, Pier and Related Tools ... >>> https://www.iam.unibe.ch/mailman/listinfo/smallwiki >> >> >> _______________________________________________ >> Magritte, Pier and Related Tools ... >> https://www.iam.unibe.ch/mailman/listinfo/smallwiki >> > > > > -- > Lukas Renggli > www.lukas-renggli.ch > > _______________________________________________ > Magritte, Pier and Related Tools ... > https://www.iam.unibe.ch/mailman/listinfo/smallwiki _______________________________________________ Magritte, Pier and Related Tools ... https://www.iam.unibe.ch/mailman/listinfo/smallwiki |
In reply to this post by Reza Razavi
On 08.04.2010, at 10:11, Reza RAZAVI wrote: > At 09:03 08/04/2010, Norbert Hartl wrote: >> I don't understand your question. > > Hi Norbert, > > The default implementations of #context in Pier, which is *PRCurrentContext value*, return the CURRENT context. In your case, the current context holds 'set on new context'. So, the behavior that you are observing seems rather 'normal', except if "your component store[s] the old context". This is what I understood from Lukas' message. In other terms, what I understand is that if you need the 'old' context, it should be cached by your component. > Well, no. I forgot to mention that I used a PRWidget for testing. In PRWidget the #context is cached. I think Lukas meant this. What I expect is to create a new context by invoking self context structure: ... This new context is attached to an html anchor. When this anchor is pressed I would expect that the context provided via goto: is active. Exactly this does not happen. I don't need the old context it is just a test measure to see that setting a property has an effect. But I would have expected that the old context message is set on the old context, the old context is copied to a new one and the setting of the property with the new context text should have overriden the old one. Norbert _______________________________________________ Magritte, Pier and Related Tools ... https://www.iam.unibe.ch/mailman/listinfo/smallwiki |
At 10:16 08/04/2010, you wrote:
In PRWidget the #context is cached. Yes, but the cache is updated upon a context change by: But I would have expected that the old context message is set on the old context, the old context is copied to a new one and the setting of the property with the new context text should have overriden the old one. I unfortunately don't have time to double check this right now, but am pretty sure that this is how Pier works. I don't need the old context it is just a test measure to see that setting a property has an effect. I'm not sure about your test setup, since your 'old' context is cached by PRWidget, and 'lost' upon the context change (that replaces the 'old' context, with the 'new' one). This new context is attached to an html anchor. When this anchor is pressed I would expect that the context provided via goto: is active. Exactly this does not happen In your first post on this thread, you also said "What makes me wonder is that under any circumstances the text being display is "set on old context". Even if I press the link "go". Why is that so?" These two observations put together, would they mean that when the anchor is pressed, the current context is neither the 'old' one, nor the 'new' one? What do you get exactly as context then? (My understanding is that in any case it can't be the old one, since it is 'lost', as explained above.) Reza _______________________________________________ Magritte, Pier and Related Tools ... https://www.iam.unibe.ch/mailman/listinfo/smallwiki |
On 08.04.2010, at 11:17, Reza RAZAVI wrote: It doesn't make any difference. I already exchanged the usage of "self context" with "PRCurrentContext value" but without effect.
It is not lost, it is the active one.
Norbert _______________________________________________ Magritte, Pier and Related Tools ... https://www.iam.unibe.ch/mailman/listinfo/smallwiki |
In reply to this post by NorbertHartl
It seems the setting in the application "Use Session Cookie" is useless in pier.
PRRestfulSession>>returnResponse: aResponse self hasSessionCookie ifFalse: [ aResponse addCookie: self sessionCookie ]. ^ super returnResponse: aResponse If I force the hasSessionCookie to return false than the behaviour I expect happens. Now I'm asking myself is this something that is wrong in my installation? This things are so severe that they must have been recognized if it is an error in pier. Norbert On 08.04.2010, at 10:12, Norbert Hartl wrote: > In > > PRContext>>urlOn > > there is > > (self command isRestful and: [ html context session hasSessionCookie ]) > ifTrue: [ url purgeSeasideFields ] > ifFalse: [ > url > addParameter: '_n'; > addParameter: (html callbacks > registerActionCallback: [ PRCurrentContext value: self.]) ]. > > At a first glance it looks like the new context is only set in the ifFalse: block. In my installation hasSessionCookie is true even if I switch off session cookie in the app configuration. > > I loaded per with ConfigurationOfSeaside and version string '1.2.1.3' > > Norbert > > On 08.04.2010, at 09:10, Lukas Renggli wrote: > >>> The other component is simply: >>> >>> renderContentOn: html >>> html text: (self context propertyAt: #forwardText ifAbsent: ['kein Text vorhanden']) >> >> Yeah, but maybe #context uses an old cached context? Can you check >> which is returned from that method, "self context" or "ctx"? To me it >> looks like "self context" is returned, because there are several tests >> that set properties and copy contexts, and they pass. >> >> Lukas >> >> >> >> >>> >>> Norbert >>> >>>> On 8 April 2010 08:21, Norbert Hartl <[hidden email]> wrote: >>>>> I tried to do some tests about transferring data via context from one page to another in pier. I did >>>>> >>>>> renderContentOn: html >>>>> | ctx | >>>>> self context propertyAt: #forwardText put: 'set on old context'. >>>>> ctx := self context structure: (PRPathLookup start: self context structure path: '/targetpage'). >>>>> ctx propertyAt: #forwardText put: 'set on new context'. >>>>> html anchor >>>>> goto: ctx; >>>>> with: 'go' >>>>> >>>>> On the targetpage there is a component that reads the property from the context and displays it. What makes me wonder is that under any circumstances the text being display is "set on old context". Even if I press the link "go". Why is that so? >>>>> >>>>> Norbert >>>>> _______________________________________________ >>>>> Magritte, Pier and Related Tools ... >>>>> https://www.iam.unibe.ch/mailman/listinfo/smallwiki >>>>> >>>> >>>> >>>> >>>> -- >>>> Lukas Renggli >>>> www.lukas-renggli.ch >>>> >>>> _______________________________________________ >>>> Magritte, Pier and Related Tools ... >>>> https://www.iam.unibe.ch/mailman/listinfo/smallwiki >>> >>> >>> _______________________________________________ >>> Magritte, Pier and Related Tools ... >>> https://www.iam.unibe.ch/mailman/listinfo/smallwiki >>> >> >> >> >> -- >> Lukas Renggli >> www.lukas-renggli.ch >> >> _______________________________________________ >> Magritte, Pier and Related Tools ... >> https://www.iam.unibe.ch/mailman/listinfo/smallwiki > > > _______________________________________________ > Magritte, Pier and Related Tools ... > https://www.iam.unibe.ch/mailman/listinfo/smallwiki _______________________________________________ Magritte, Pier and Related Tools ... https://www.iam.unibe.ch/mailman/listinfo/smallwiki |
At 12:28 08/04/2010, you wrote:
>PRRestfulSession>>returnResponse: aResponse > self hasSessionCookie > ifFalse: [ aResponse addCookie: self sessionCookie ]. > ^ super returnResponse: aResponse I had PRRestfulSession only in Pier 1. AFAK, it's not part of Pier2. Reza _______________________________________________ Magritte, Pier and Related Tools ... https://www.iam.unibe.ch/mailman/listinfo/smallwiki |
On 08.04.2010, at 12:33, Reza RAZAVI wrote: > At 12:28 08/04/2010, you wrote: >> PRRestfulSession>>returnResponse: aResponse >> self hasSessionCookie >> ifFalse: [ aResponse addCookie: self sessionCookie ]. >> ^ super returnResponse: aResponse > > I had PRRestfulSession only in Pier 1. > AFAK, it's not part of Pier2. > I am on Pier 1 Norbert _______________________________________________ Magritte, Pier and Related Tools ... https://www.iam.unibe.ch/mailman/listinfo/smallwiki |
In reply to this post by NorbertHartl
I suspect that #hasSessionCookie is just checking whether the browser *submitted* a cookie. If you previously had cookies turned on, your browser might already have the cookie (though of course it would eventually be for an expired session). I'm really not sure off the top of my head what the code path looks like in that case in 2.8 - can you try deleting the cookie in your browser and see if that helps?
Julian On Thu, Apr 8, 2010 at 11:28 AM, Norbert Hartl <[hidden email]> wrote: It seems the setting in the application "Use Session Cookie" is useless in pier. _______________________________________________ Magritte, Pier and Related Tools ... https://www.iam.unibe.ch/mailman/listinfo/smallwiki |
On 09.04.2010, at 09:10, Julian Fitzell wrote: I suspect that #hasSessionCookie is just checking whether the browser *submitted* a cookie. If you previously had cookies turned on, your browser might already have the cookie (though of course it would eventually be for an expired session). I'm really not sure off the top of my head what the code path looks like in that case in 2.8 - can you try deleting the cookie in your browser and see if that helps?I did this multiple times. The cookie is assigned again and the seaside parameters vanish from the url. I think the code shown below is pretty obvious. Regardless if there is a cookie or not after that method there is a cookie. Well, and the newly created context is not used. But all of this is code of pier not of seaside. So the problem lays there. Norbert Julian _______________________________________________ Magritte, Pier and Related Tools ... https://www.iam.unibe.ch/mailman/listinfo/smallwiki |
Free forum by Nabble | Edit this page |