Closed GoogleCodeExporter closed 9 years ago
If not done this way, at least please remove the unnecessary count(). It's
slowing us
down!
Original comment by pwnfact...@gmail.com
on 14 Apr 2010 at 4:20
Attachments:
The concept sounds good but I'm wary of breaking backwards compatibility.
Can you easily add support for the legacy style lookups as well?
Original comment by mattbrow...@gmail.com
on 16 Apr 2010 at 11:07
It seems like adding in a hack for maintaining legacy support would make it
similarly
inefficient.
Original comment by pwnfact...@gmail.com
on 20 Apr 2010 at 5:13
Not necessarily (see attached patch with legacy User support)
Original comment by mmcdon...@google.com
on 29 Apr 2010 at 12:03
Attachments:
Patch looks good, and seems effectively as efficient as without legacy support.
One question:
legacy_django_user = cls.all().filter('user =', user).get()
Is this guaranteed to be the *old* User object?
Original comment by pwnfact...@gmail.com
on 29 Apr 2010 at 10:55
Ah, good catch. Fixed in this patch:
Original comment by mmcdon...@google.com
on 29 Apr 2010 at 4:23
Attachments:
There is an issue with the patch in comment 6 - if you delete the legacy user,
this
will break all existing references to the legacy User entity.
For backwards compatibility, you should leave the legacy User entity in place,
and
check for it using the 'user =' filter if the get_by_key_name fails. If
neither
key_name or 'user =' filter matches, then you can create the new User with the
key_name. Otherwise, you have to go through your datastore and fixup any
references
from the old legacy User entity to the new one you are creating by key_name.
For new projects which do not need to support legacy User entities, you might
want to
include a setting to only use the new key_name approach, and then you can use
the
get_or_insert method.
Original comment by dherbst
on 18 May 2010 at 12:57
Another good catch.
As for having a config knob for turning off the filter('user', user) check,
it's only
going to get called the first time each user visits the site; Subsequent visits
will
just fetch by the key_name, so it doesn't seem too big of an issue.
Original comment by mmcdon...@google.com
on 26 May 2010 at 7:41
Attachments:
Woop, noticed a small nit at the end of the previous patch; 2nd try:
Original comment by mmcdon...@google.com
on 26 May 2010 at 7:47
Attachments:
Patch submitted in r103
Original comment by mmcdon...@google.com
on 4 Jun 2010 at 5:34
Original comment by mmcdon...@google.com
on 19 Nov 2010 at 4:16
Original issue reported on code.google.com by
mmcdon...@google.com
on 18 Feb 2010 at 8:00Attachments: