On May 9, 7:21 pm, Vinay Sajip <[EMAIL PROTECTED]> wrote:
> It appears not. Just to see if it would work, I tried just adding
> overriding __getattribute__ (which just calls the superclass
> behaviour) and it causes some unexpected behaviour in the unit tests.

False alarm - it was a typo on my part. How about this in
django.contrib.auth.User:

    def __getattribute__(self, attrname):
        if attrname == '_profile_cache':
            return models.Model.__getattribute__(self, attrname)
        try:
            rv = models.Model.__getattribute__(self, attrname)
        except AttributeError, e:
            if not settings.AUTH_PROFILE_MODULE:
                raise
            try:
                profile = self.get_profile()
                rv = getattr(profile, attrname)
            except SiteProfileNotAvailable:
                raise e
        return rv

This would appear to allow access to profile attributes directly on a
User instance, without the need to explicitly show ".get_profile()".

Regards,

Vinay Sajip


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to