trouble accessing session variables..

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

trouble accessing session variables..

sergio_101
okay, i know i am just doing something silly.. and it's late.. but i
have spent WAY too much time on this..

i set up a WASession for my app, and it has an instance variable
called 'oauthToken'..

in my app, i can do this:

self session inspect

and see that oauthToken indeed has a value..

but if i go:

self session oauthToken inspect

it bombs out as 'Undefined Object'

i have a conditional running against this.. so

self session oauthToken isNil  "this is always true, even though this
variable is set.."

anyone have any idea what i am doing wrong?

thanks!



--
----
peace,
sergio
photographer, journalist, visionary

http://www.ThoseOptimizeGuys.com
http://www.CodingForHire.com
http://www.coffee-black.com
http://www.painlessfrugality.com
http://www.twitter.com/sergio_101
http://www.facebook.com/sergio101
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: trouble accessing session variables..

DiegoLont
Hi Sergio,

I know that debugging in a session is tricky, because once you halt: you are accessing this from a different context. What I usually do is assign the thing that I am interested in to a local variable, and then inspect. That is:

….
temp := self session oauthToken.
self halt.


This allows me to inspect / explore the variables I am interested in.

By the way: I assume you derive from WASession and set the session class for your app?

Diego

On Oct 3, 2012, at 7:38 AM, sergio_101 wrote:

> okay, i know i am just doing something silly.. and it's late.. but i
> have spent WAY too much time on this..
>
> i set up a WASession for my app, and it has an instance variable
> called 'oauthToken'..
>
> in my app, i can do this:
>
> self session inspect
>
> and see that oauthToken indeed has a value..
>
> but if i go:
>
> self session oauthToken inspect
>
> it bombs out as 'Undefined Object'
>
> i have a conditional running against this.. so
>
> self session oauthToken isNil  "this is always true, even though this
> variable is set.."
>
> anyone have any idea what i am doing wrong?
>
> thanks!
>
>
>
> --
> ----
> peace,
> sergio
> photographer, journalist, visionary
>
> http://www.ThoseOptimizeGuys.com
> http://www.CodingForHire.com
> http://www.coffee-black.com
> http://www.painlessfrugality.com
> http://www.twitter.com/sergio_101
> http://www.facebook.com/sergio101
> _______________________________________________
> 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: trouble accessing session variables..

sergio_101
> temp := self session oauthToken.
> self halt.

ah! okay.. let me try this..


>
> This allows me to inspect / explore the variables I am interested in.
>
> By the way: I assume you derive from WASession and set the session class for your app?
>

yes.. the session object is instantiated correctly..

as a matter of fact, i can do this:

SBSession allInstances inspect

and see my session.. and even see that oauthToken is set.. from the workspace..


--
----
peace,
sergio
photographer, journalist, visionary

http://www.ThoseOptimizeGuys.com
http://www.CodingForHire.com
http://www.coffee-black.com
http://www.painlessfrugality.com
http://www.twitter.com/sergio_101
http://www.facebook.com/sergio101
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: trouble accessing session variables..

Paul DeBruicker
Does your oauthToken method look like this:


SBSession>>#oauthToken
        ^oauthToken


?






On 10/03/2012 05:17 AM, sergio_101 wrote:

>> temp := self session oauthToken.
>> self halt.
>
> ah! okay.. let me try this..
>
>
>>
>> This allows me to inspect / explore the variables I am interested in.
>>
>> By the way: I assume you derive from WASession and set the session class for your app?
>>
>
> yes.. the session object is instantiated correctly..
>
> as a matter of fact, i can do this:
>
> SBSession allInstances inspect
>
> and see my session.. and even see that oauthToken is set.. from the workspace..
>
>

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

Re: trouble accessing session variables..

sergio_101
On Wed, Oct 3, 2012 at 11:24 AM, Paul DeBruicker <[hidden email]> wrote:
> Does your oauthToken method look like this:
>
>
> SBSession>>#oauthToken
>         ^oauthToken
>

yes, it does...
--
----
peace,
sergio
photographer, journalist, visionary

http://www.ThoseOptimizeGuys.com
http://www.CodingForHire.com
http://www.coffee-black.com
http://www.painlessfrugality.com
http://www.twitter.com/sergio_101
http://www.facebook.com/sergio101
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: trouble accessing session variables..

sergio_101
In reply to this post by Paul DeBruicker
On Wed, Oct 3, 2012 at 11:24 AM, Paul DeBruicker <[hidden email]> wrote:
> Does your oauthToken method look like this:
>
>
> SBSession>>#oauthToken
>         ^oauthToken
>

actually, one of the things i tried was..

deleting the instance var and its accessors.. and then rebuilding them..

still no dice.

--
----
peace,
sergio
photographer, journalist, visionary

http://www.ThoseOptimizeGuys.com
http://www.CodingForHire.com
http://www.coffee-black.com
http://www.painlessfrugality.com
http://www.twitter.com/sergio_101
http://www.facebook.com/sergio101
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: trouble accessing session variables..

Paul DeBruicker
How and when does the oauthToken get its value set?  e.g. are you
checking for it in your conditional before it gets set but then manually
verifying its existence after it gets set.






On 10/03/2012 08:27 AM, sergio_101 wrote:

> On Wed, Oct 3, 2012 at 11:24 AM, Paul DeBruicker <[hidden email]> wrote:
>> Does your oauthToken method look like this:
>>
>>
>> SBSession>>#oauthToken
>>          ^oauthToken
>>
>
> actually, one of the things i tried was..
>
> deleting the instance var and its accessors.. and then rebuilding them..
>
> still no dice.
>

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

Re: trouble accessing session variables..

Bob Arning-2
In reply to this post by sergio_101
I think we may not be seeing exactly what you are seeing (especially after some of the suggestions here), but one thought occurs: how many SBSession instances are there? Is it possible that the one with oauthToken set is not the same one that is referenced when you encounter the problem?

Cheers,
Bob


On 10/3/12 8:17 AM, sergio_101 wrote:
as a matter of fact, i can do this:

SBSession allInstances inspect

and see my session.. and even see that oauthToken is set.. from the workspace..


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

Re: trouble accessing session variables..

sergio_101
In reply to this post by Paul DeBruicker
> How and when does the oauthToken get its value set?  e.g. are you checking
> for it in your conditional before it gets set but then manually verifying
> its existence after it gets set.

exactly.. if it is nil, i run a method that grabs it from facebook,
then sets it.. then returns..

when it returns, the value is set, and we're good to go..

BUT.. even though the value is set, i can't read it to find out..

--
----
peace,
sergio
photographer, journalist, visionary

http://www.ThoseOptimizeGuys.com
http://www.CodingForHire.com
http://www.coffee-black.com
http://www.painlessfrugality.com
http://www.twitter.com/sergio_101
http://www.facebook.com/sergio101
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: trouble accessing session variables..

Paul DeBruicker
So when you instantiate your session if you set the value of the
oauthToken variable to 'abcd' in the initialize method and then do
nothing else does your conditional pass?


Also - What Bob Arning just said







On 10/03/2012 08:54 AM, sergio_101 wrote:

>> How and when does the oauthToken get its value set?  e.g. are you checking
>> for it in your conditional before it gets set but then manually verifying
>> its existence after it gets set.
>
> exactly.. if it is nil, i run a method that grabs it from facebook,
> then sets it.. then returns..
>
> when it returns, the value is set, and we're good to go..
>
> BUT.. even though the value is set, i can't read it to find out..
>

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

Re: trouble accessing session variables..

Jon Paynter-2
Doing 'self session' from a debugger will never work, it will always return nil.  This is the way it was implemented.

Follow Diego's advice and set it to a local var first, then you can inspect the local var.
temp := self session.
self halt.


or a pattern I use:
self session inspect.
self halt.

Then I have an inspector already opened on the session instance.

On Wed, Oct 3, 2012 at 9:24 AM, Paul DeBruicker <[hidden email]> wrote:
So when you instantiate your session if you set the value of the oauthToken variable to 'abcd' in the initialize method and then do nothing else does your conditional pass?


Also - What Bob Arning just said

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

Re: trouble accessing session variables..

fstephany
In reply to this post by Bob Arning-2
Yeah, that sounds plausible.

Sergio, when is the oauth token disappearing? Between two clicks in the
app? When redirected from somewhere?


On 03/10/12 08:54, Bob Arning wrote:

> I think we may not be seeing exactly what you are seeing (especially
> after some of the suggestions here), but one thought occurs: how many
> SBSession instances are there? Is it possible that the one with
> oauthToken set is not the same one that is referenced when you encounter
> the problem?
>
> Cheers,
> Bob
>
>
> On 10/3/12 8:17 AM, sergio_101 wrote:
>> as a matter of fact, i can do this:
>>
>> SBSession allInstances inspect
>>
>> and see my session.. and even see that oauthToken is set.. from the workspace..
>
>
>
> _______________________________________________
> seaside mailing list
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>

--
http://tulipemoutarde.be
CA: +1 778 558 3225
BE: +32 65 709 131
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: trouble accessing session variables..

sergio_101
In reply to this post by Bob Arning-2
> instances are there? Is it possible that the one with oauthToken set is not
> the same one that is referenced when you encounter the problem?


hey, bob..

actually, ALL of the instances of SBSession have oauthToken set.. hmmm...

--
----
peace,
sergio
photographer, journalist, visionary

http://www.ThoseOptimizeGuys.com
http://www.CodingForHire.com
http://www.coffee-black.com
http://www.painlessfrugality.com
http://www.twitter.com/sergio_101
http://www.facebook.com/sergio101
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: trouble accessing session variables..

sergio_101
In reply to this post by Jon Paynter-2
> Doing 'self session' from a debugger will never work, it will always return
> nil.  This is the way it was implemented.
>

i should probably rephrase that whole thing..

in my component, i was doing:

self session inspect.
self halt.

that's how i was seeing the session..



> or a pattern I use:
> self session inspect.
> self halt.
>

doh! that is what i was doing

self session inspect.
self halt.

inspector shows a value for oauthToken.

self session oauthToken inspect.
self halt.

shows nil.



--
----
peace,
sergio
photographer, journalist, visionary

http://www.ThoseOptimizeGuys.com
http://www.CodingForHire.com
http://www.coffee-black.com
http://www.painlessfrugality.com
http://www.twitter.com/sergio_101
http://www.facebook.com/sergio101
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: trouble accessing session variables..

sergio_101
In reply to this post by fstephany
>
> Sergio, when is the oauth token disappearing? Between two clicks in the app?
> When redirected from somewhere?
>
>

actually, it never disappears..

i can see it if i inspect the session object..

but not when i inspect the instance variable..

--
----
peace,
sergio
photographer, journalist, visionary

http://www.ThoseOptimizeGuys.com
http://www.CodingForHire.com
http://www.coffee-black.com
http://www.painlessfrugality.com
http://www.twitter.com/sergio_101
http://www.facebook.com/sergio101
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: trouble accessing session variables..

Bob Arning-2
Hmmm.. how are you inspecting the instance variable?

Cheers,
Bob

On 10/3/12 3:13 PM, sergio_101 wrote:
Sergio, when is the oauth token disappearing? Between two clicks in the app?
When redirected from somewhere?


actually, it never disappears..

i can see it if i inspect the session object..

but not when i inspect the instance variable..



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

Re: trouble accessing session variables..

Paul DeBruicker
In reply to this post by sergio_101
On 10/03/2012 12:09 PM, sergio_101 wrote:
>> instances are there? Is it possible that the one with oauthToken set is not
>> the same one that is referenced when you encounter the problem?
>
>
> hey, bob..
>
> actually, ALL of the instances of SBSession have oauthToken set.. hmmm...
>


is there a a minimal reproducible example of what you're seeing that you
can post to the list so others can reproduce the problem and attempt to
help you figure it out?

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

Re: trouble accessing session variables..

sergio_101
On Wed, Oct 3, 2012 at 3:21 PM, Paul DeBruicker <[hidden email]> wrote:
> On 10/03/2012 12:09 PM, sergio_101 wrote:
>>>
>>> instances are there? Is it possible that the one with oauthToken set is
>>> not
>>> the same one that is referenced when you encounter the problem?
>>

hey, guys!

i am in rails world until i get home from my day job.. so i won't be
able to wrestle this around until later tonight..

but as soon as i get home, i'll report back..

thanks for all the advice..

i will die if i have a typo somewhere...


--
----
peace,
sergio
photographer, journalist, visionary

http://www.ThoseOptimizeGuys.com
http://www.CodingForHire.com
http://www.coffee-black.com
http://www.painlessfrugality.com
http://www.twitter.com/sergio_101
http://www.facebook.com/sergio101
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside