Seaside 2.9 - how do I access session ivars? WARequestContextNotFound error

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

Seaside 2.9 - how do I access session ivars? WARequestContextNotFound error

Paul DeBruicker
Hi -


I am in the initial stages of porting some code to Seaside2.9a3.  The
code works in Seaside 2.8.4. When a user logs in I store their user
info in the session in an instance variable called user.  In Seaside
2.8.4 calling 'self session user userId' would return the user's user
id, after they'd logged in.  With whatever I've done + 2.9a3 calling:


self session user userId


inside a renderContentOn: method throws an error that says
UndefinedObject(Object)>>doesNotUnderstand: #userId.  In the debugger
for that error if I try to explore 'self session' I get a
WARequestContextNotFound error.  I do include


webapp preferencesAt: #sessionClass add: AMSession.


in the initialize statement for the application.  I'm willing to
believe that my login function is also a little off because I set the
session ivar 'user' with 'self session user: user'

How do I store and access information in the session in Seaside 2.9?
Is it the same as 2.8.4 and I've just got another error somewhere else
thats just showing up here?  I'd appreciate any suggestions for
remedying my lack of understanding.  Thanks


Paul
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Seaside 2.9 - how do I access session ivars? WARequestContextNotFound error

Mariano Martinez Peck


On Mon, Jul 20, 2009 at 5:01 PM, Paul DeBruicker <[hidden email]> wrote:
Hi -


I am in the initial stages of porting some code to Seaside2.9a3.  The
code works in Seaside 2.8.4. When a user logs in I store their user
info in the session in an instance variable called user.  In Seaside
2.8.4 calling 'self session user userId' would return the user's user
id, after they'd logged in.  With whatever I've done + 2.9a3 calling:


self session user userId


inside a renderContentOn: method throws an error that says
UndefinedObject(Object)>>doesNotUnderstand: #userId.  In the debugger
for that error if I try to explore 'self session' I get a
WARequestContextNotFound error.  I do include


webapp preferencesAt: #sessionClass add: AMSession.


in the initialize statement for the application.  I'm willing to
believe that my login function is also a little off because I set the
session ivar 'user' with 'self session user: user'

How do I store and access information in the session in Seaside 2.9?
Is it the same as 2.8.4 and I've just got another error somewhere else
thats just showing up here?  I'd appreciate any suggestions for
remedying my lack of understanding.  Thanks

I never tested 2.9 but reading here: http://www.seaside.st/documentation/migration/28to29

it says:

"#application and #session will raise a WARequestContextNotFound error if no current request context is found. This should only happen outside of the scope of a Seaside request. If your objects are using these methods as part of their display string (they probably shouldn’t) you will want to catch the error to avoid problems when opening an Inspector on your object."

I don't know if this help.

best,

Mariano

 



Paul
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside


_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Seaside 2.9 - how do I access session ivars? WARequestContextNotFound error

Julian Fitzell-2
In reply to this post by Paul DeBruicker
Where do you set the user variable? The error is just indicating that
the instvar is nil (as Mariano indicates, the RequestContextNotFound
thing in this case is an unrelated problem with the debugger).

Julian

On Mon, Jul 20, 2009 at 11:01 AM, Paul DeBruicker<[hidden email]> wrote:

> Hi -
>
>
> I am in the initial stages of porting some code to Seaside2.9a3.  The
> code works in Seaside 2.8.4. When a user logs in I store their user
> info in the session in an instance variable called user.  In Seaside
> 2.8.4 calling 'self session user userId' would return the user's user
> id, after they'd logged in.  With whatever I've done + 2.9a3 calling:
>
>
> self session user userId
>
>
> inside a renderContentOn: method throws an error that says
> UndefinedObject(Object)>>doesNotUnderstand: #userId.  In the debugger
> for that error if I try to explore 'self session' I get a
> WARequestContextNotFound error.  I do include
>
>
> webapp preferencesAt: #sessionClass add: AMSession.
>
>
> in the initialize statement for the application.  I'm willing to
> believe that my login function is also a little off because I set the
> session ivar 'user' with 'self session user: user'
>
> How do I store and access information in the session in Seaside 2.9?
> Is it the same as 2.8.4 and I've just got another error somewhere else
> thats just showing up here?  I'd appreciate any suggestions for
> remedying my lack of understanding.  Thanks
>
>
> Paul
> _______________________________________________
> seaside mailing list
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Seaside 2.9 - how do I access session ivars? WARequestContextNotFound error

Paul DeBruicker
Hi

I set the ivar in a login method thats in a callback in a submitButton
in a component displayed in a jQuery lightbox.  In 2.8.4 I was using
the 'html lightbox:' method from SULibrary to create the lightbox.  I
basically copied the lightbox dialog example from the jQuery tests
included with the image and did a 'html render: loginComponent'
instead of listing the vegetables.


Thanks

Paul




On Mon, Jul 20, 2009 at 2:19 PM, Julian Fitzell<[hidden email]> wrote:

> Where do you set the user variable? The error is just indicating that
> the instvar is nil (as Mariano indicates, the RequestContextNotFound
> thing in this case is an unrelated problem with the debugger).
>
> Julian
>
> On Mon, Jul 20, 2009 at 11:01 AM, Paul DeBruicker<[hidden email]> wrote:
>> Hi -
>>
>>
>> I am in the initial stages of porting some code to Seaside2.9a3.  The
>> code works in Seaside 2.8.4. When a user logs in I store their user
>> info in the session in an instance variable called user.  In Seaside
>> 2.8.4 calling 'self session user userId' would return the user's user
>> id, after they'd logged in.  With whatever I've done + 2.9a3 calling:
>>
>>
>> self session user userId
>>
>>
>> inside a renderContentOn: method throws an error that says
>> UndefinedObject(Object)>>doesNotUnderstand: #userId.  In the debugger
>> for that error if I try to explore 'self session' I get a
>> WARequestContextNotFound error.  I do include
>>
>>
>> webapp preferencesAt: #sessionClass add: AMSession.
>>
>>
>> in the initialize statement for the application.  I'm willing to
>> believe that my login function is also a little off because I set the
>> session ivar 'user' with 'self session user: user'
>>
>> How do I store and access information in the session in Seaside 2.9?
>> Is it the same as 2.8.4 and I've just got another error somewhere else
>> thats just showing up here?  I'd appreciate any suggestions for
>> remedying my lack of understanding.  Thanks
>>
>>
>> Paul
>> _______________________________________________
>> seaside mailing list
>> [hidden email]
>> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>>
> _______________________________________________
> seaside mailing list
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Seaside 2.9 - how do I access session ivars? WARequestContextNotFound error

John McKeon
In reply to this post by Paul DeBruicker
I'll throw in my two cents

On Mon, Jul 20, 2009 at 2:01 PM, Paul DeBruicker <[hidden email]> wrote:
Hi -

  I do include


webapp preferencesAt: #sessionClass add: AMSession. 



in the initialize statement for the application.  

This only works if you actually reinitialize the CLASS.

Check the config page that you are indeed using your custom session class

Paul
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside


John
--
http://jmck.seasidehosting.st

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Seaside 2.9 - how do I access session ivars? WARequestContextNotFound error

Paul DeBruicker
Thanks for the pointer John.  It does show AMSession as the session on
the config page. I had not thought to check there.





On Mon, Jul 20, 2009 at 2:39 PM, John McKeon<[hidden email]> wrote:

> I'll throw in my two cents
>
> On Mon, Jul 20, 2009 at 2:01 PM, Paul DeBruicker <[hidden email]> wrote:
>>
>> Hi -
>>
>>   I do include
>>
>>
>> webapp preferencesAt: #sessionClass add: AMSession.
>>
>>
>> in the initialize statement for the application.
>
> This only works if you actually reinitialize the CLASS.
>
> Check the config page that you are indeed using your custom session class
>
>> Paul
>> _______________________________________________
>> seaside mailing list
>> [hidden email]
>> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>
>
> John
> --
> http://jmck.seasidehosting.st
>
> _______________________________________________
> seaside mailing list
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>
>
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Seaside 2.9 - how do I access session ivars? WARequestContextNotFound error

Julian Fitzell-2
In reply to this post by Paul DeBruicker
I can't see anything in what you're saying that jumps out as a
problem. As I said, the issue seems to be simply that your instvar is
nil. Maybe try putting a halt in your #user: method and make sure it's
being called with the right value. If it is, put another halt in the
#user method and compare the identityHash of the two sessions and make
sure you're dealing with the same session in both cases.

Julian

On Mon, Jul 20, 2009 at 11:37 AM, Paul DeBruicker<[hidden email]> wrote:

> Hi
>
> I set the ivar in a login method thats in a callback in a submitButton
> in a component displayed in a jQuery lightbox.  In 2.8.4 I was using
> the 'html lightbox:' method from SULibrary to create the lightbox.  I
> basically copied the lightbox dialog example from the jQuery tests
> included with the image and did a 'html render: loginComponent'
> instead of listing the vegetables.
>
>
> Thanks
>
> Paul
>
>
>
>
> On Mon, Jul 20, 2009 at 2:19 PM, Julian Fitzell<[hidden email]> wrote:
>> Where do you set the user variable? The error is just indicating that
>> the instvar is nil (as Mariano indicates, the RequestContextNotFound
>> thing in this case is an unrelated problem with the debugger).
>>
>> Julian
>>
>> On Mon, Jul 20, 2009 at 11:01 AM, Paul DeBruicker<[hidden email]> wrote:
>>> Hi -
>>>
>>>
>>> I am in the initial stages of porting some code to Seaside2.9a3.  The
>>> code works in Seaside 2.8.4. When a user logs in I store their user
>>> info in the session in an instance variable called user.  In Seaside
>>> 2.8.4 calling 'self session user userId' would return the user's user
>>> id, after they'd logged in.  With whatever I've done + 2.9a3 calling:
>>>
>>>
>>> self session user userId
>>>
>>>
>>> inside a renderContentOn: method throws an error that says
>>> UndefinedObject(Object)>>doesNotUnderstand: #userId.  In the debugger
>>> for that error if I try to explore 'self session' I get a
>>> WARequestContextNotFound error.  I do include
>>>
>>>
>>> webapp preferencesAt: #sessionClass add: AMSession.
>>>
>>>
>>> in the initialize statement for the application.  I'm willing to
>>> believe that my login function is also a little off because I set the
>>> session ivar 'user' with 'self session user: user'
>>>
>>> How do I store and access information in the session in Seaside 2.9?
>>> Is it the same as 2.8.4 and I've just got another error somewhere else
>>> thats just showing up here?  I'd appreciate any suggestions for
>>> remedying my lack of understanding.  Thanks
>>>
>>>
>>> Paul
>>> _______________________________________________
>>> seaside mailing list
>>> [hidden email]
>>> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>>>
>> _______________________________________________
>> seaside mailing list
>> [hidden email]
>> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>>
> _______________________________________________
> seaside mailing list
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Seaside 2.9 - how do I access session ivars? WARequestContextNotFound error

Paul DeBruicker
OK.  I'll do that.   I added some classes that use the lightbox:
method from Scriptaculous.  When I replace the jQuery methods with the
Scriptaculous ones it starts working fine again.  I'll poke around
some more and see what I can find with the jQuery changes I made.



I'm trying to understand the documentation Mariano pointed me towards.
Does it mean that I should not use a method like this:

renderContentOn: html
   html text: 'You are logged in as: ' , self session user userId.

And instead create an instance variable in the component to hold the
'self session user' bit?  Thanks for your help


Paul






On Mon, Jul 20, 2009 at 4:07 PM, Julian Fitzell<[hidden email]> wrote:

> I can't see anything in what you're saying that jumps out as a
> problem. As I said, the issue seems to be simply that your instvar is
> nil. Maybe try putting a halt in your #user: method and make sure it's
> being called with the right value. If it is, put another halt in the
> #user method and compare the identityHash of the two sessions and make
> sure you're dealing with the same session in both cases.
>
> Julian
>
> On Mon, Jul 20, 2009 at 11:37 AM, Paul DeBruicker<[hidden email]> wrote:
>> Hi
>>
>> I set the ivar in a login method thats in a callback in a submitButton
>> in a component displayed in a jQuery lightbox.  In 2.8.4 I was using
>> the 'html lightbox:' method from SULibrary to create the lightbox.  I
>> basically copied the lightbox dialog example from the jQuery tests
>> included with the image and did a 'html render: loginComponent'
>> instead of listing the vegetables.
>>
>>
>> Thanks
>>
>> Paul
>>
>>
>>
>>
>> On Mon, Jul 20, 2009 at 2:19 PM, Julian Fitzell<[hidden email]> wrote:
>>> Where do you set the user variable? The error is just indicating that
>>> the instvar is nil (as Mariano indicates, the RequestContextNotFound
>>> thing in this case is an unrelated problem with the debugger).
>>>
>>> Julian
>>>
>>> On Mon, Jul 20, 2009 at 11:01 AM, Paul DeBruicker<[hidden email]> wrote:
>>>> Hi -
>>>>
>>>>
>>>> I am in the initial stages of porting some code to Seaside2.9a3.  The
>>>> code works in Seaside 2.8.4. When a user logs in I store their user
>>>> info in the session in an instance variable called user.  In Seaside
>>>> 2.8.4 calling 'self session user userId' would return the user's user
>>>> id, after they'd logged in.  With whatever I've done + 2.9a3 calling:
>>>>
>>>>
>>>> self session user userId
>>>>
>>>>
>>>> inside a renderContentOn: method throws an error that says
>>>> UndefinedObject(Object)>>doesNotUnderstand: #userId.  In the debugger
>>>> for that error if I try to explore 'self session' I get a
>>>> WARequestContextNotFound error.  I do include
>>>>
>>>>
>>>> webapp preferencesAt: #sessionClass add: AMSession.
>>>>
>>>>
>>>> in the initialize statement for the application.  I'm willing to
>>>> believe that my login function is also a little off because I set the
>>>> session ivar 'user' with 'self session user: user'
>>>>
>>>> How do I store and access information in the session in Seaside 2.9?
>>>> Is it the same as 2.8.4 and I've just got another error somewhere else
>>>> thats just showing up here?  I'd appreciate any suggestions for
>>>> remedying my lack of understanding.  Thanks
>>>>
>>>>
>>>> Paul
>>>> _______________________________________________
>>>> seaside mailing list
>>>> [hidden email]
>>>> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>>>>
>>> _______________________________________________
>>> seaside mailing list
>>> [hidden email]
>>> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>>>
>> _______________________________________________
>> seaside mailing list
>> [hidden email]
>> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>>
> _______________________________________________
> seaside mailing list
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Seaside 2.9 - how do I access session ivars? WARequestContextNotFound error

Julian Fitzell-2
On Mon, Jul 20, 2009 at 1:22 PM, Paul DeBruicker<[hidden email]> wrote:
> I'm trying to understand the documentation Mariano pointed me towards.
> Does it mean that I should not use a method like this:
>
> renderContentOn: html
>   html text: 'You are logged in as: ' , self session user userId.
>
> And instead create an instance variable in the component to hold the
> 'self session user' bit?  Thanks for your help

No, I don't see any problem with the first version.

If you can't spot the problem after your own debugging, try reducing
your code down to the smallest possible example that exhibits the
problem; somebody may be able to load it up and see what the problem
is.

Julian
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside