Hi Alexander,
Yes, that's how I'm storing the users. Let's say I have five users
that all store UserInfo. I call users.get_current_user() to get the
user and then save the Info. My problem is accessing a user's
information again, when that user is not logged in.
The documentation says, "A User object with an email address that
doesn't correspond to a valid Google account can be stored in the
datastore, but will never match a real user." That implies to me that
a user object with an email address that does correspond to a valid
google account will match a real user. But I guess that's too much of
a leap? What's the point of these user objects constructed from emails
if they don't match real users?
Again thank you all for reading -- I'll come up with some other
strategy to approach this.
- savraj
On Aug 28, 7:48 pm, Alexander Kojevnikov <[EMAIL PROTECTED]>
wrote:
> As far as I can see, there's very little point in storing User
> instances constructed from an e-mail address. These instances don't
> correspond to real Google accounts, GAE doesn't do anything special to
> verify the validity of supplied e-mail addresses, and basically it
> just stores the e-mail addresses as strings.
>
> If you want your User instances to correspond to real accounts you
> need to use users.get_current_user(). If not, I suppose it's less
> confusing to just store the (lower-cased) e-mail addresses in a string
> property.
>
> On Aug 29, 6:53 am, Savraj Singh <[EMAIL PROTECTED]> wrote:
>
> > Yes, I can do that, thanks -- but I still think this behavior is a
> > problem.
>
> > Let's say I create a datastore model:
>
> > class UserInfo(db.Model):
> > owner = db.UserProperty()
> > Info = db.StringProperty()
>
> > Now let's say I create a UserInfo entity with owner set as user1 and
> > save it to the datastore.
>
> > I can't look up this saved entity unless I match the case of the
> > original email address (user2 will not match it). That's the problem.
>
> > I discovered this problem because when I assign owners in parts of my
> > application, sometimes Google capitalizes the email addresses, and
> > other times, it does not.
>
> > I can resort to using strings, but that defeats the purpose of having
> > a special 'userProperty' that abstracts away this stuff.
>
> > Thanks for your help, everyone.
>
> > - s
>
> > On Aug 28, 4:30 pm, Davide Rognoni <[EMAIL PROTECTED]> wrote:
>
> > > str(user1).lower() == str(user2).lower()
>
> > > On Aug 28, 6:35 pm, Savraj Singh <[EMAIL PROTECTED]> wrote:
>
> > > > Hi everyone, quick question.
>
> > > > class Tests(webapp.RequestHandler):
> > > > def get(self):
> > > > user1 = users.User(email="[EMAIL PROTECTED]")
> > > > user2 = users.User(email="[EMAIL PROTECTED]")
>
> > > > if user1 == user2:
> > > > self.response.out.write("users are the same")
> > > > else:
> > > > self.response.out.write("users are different")
>
> > > > The result is that "users are different" -- I'm surprised by that.
> > > > Shouldn't they be the same? Especially savraj and Savraj both point to
> > > > my valid google account? I can work around this issue but according
> > > > to the API documentation I would assume that user1 and user2 are
> > > > equal.
>
> > > > Thanks for your help!
>
> > > > -Savraj
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---