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 google-appengine@googlegroups.com
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