Alexander... that seemed to do the trick. Thanks Byron and Alex for
your help.

Sam

On Sep 20, 3:54 pm, "Byron Saltysiak" <[EMAIL PROTECTED]> wrote:
> Maybe the user that you think you're using is not the one really being
> used? Maybe change the code to print out/ log the user and token
> instead of the redirect?
>
> On 9/20/08, Sam G <[EMAIL PROTECTED]> wrote:
>
>
>
>
>
> > No ideas, from anyone?
>
> > Sam
>
> > On Sep 18, 10:09 pm, Sam G <[EMAIL PROTECTED]> wrote:
> >> Hello (again),
>
> >> I'm running into a problem that I would think would be easy to solve.
> >> I've set up a system to send a given user to an AuthSub token request
> >> URL on first login. After first login, there should be a token in the
> >> datastore for the user, and they can go straight to the home page when
> >> they log in.
>
> >> In my view code (that gets run whenever someone hits '/'):
>
> >> def index(request):
> >>     result = token.CheckToken(user)
> >>     if result == True:
> >>         return HttpResponsePermanentRedirect('/home')
> >>     else:
> >>         return HttpResponsePermanentRedirect('/setup/introduction')
>
> >> CheckToken Function:
>
> >> def CheckToken(user):
> >>     token = db.GqlQuery("SELECT * FROM accountToken WHERE user
> >> = :userobj", userobj=user)
> >>     result = token.fetch(1,0)
> >>     if result is not None:
> >>         return True
> >>     else:
> >>         return False
>
> >> Here is my model for accountToken:
>
> >> class accountToken(db.Model):
> >>     user = db.UserProperty(required=True)
> >>     token = db.StringProperty(required=True)
> >>     version = db.IntegerProperty()
> >>     created = db.DateTimeProperty(auto_now_add=True)
>
> >> By the way, the key_name for each accountToken instance is the user's
> >> nickname().
>
> >> Using the code above, when I log in as a user who definitely has a
> >> token, they are redirected to the home page (like they should be).
> >> However, when I log in as a user who does not have a token, they are
> >> also redirected to the home page.
>
> >> Ideas?
>
> >> Sam
>
> --
> Sent from Gmail for mobile | mobile.google.com
>
> Byron
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to