Sunday, October 31, 2010

django-registration question: activation_key_expired.boolean = True

This question refers to line 205 here:
http://bitbucket.org/ubernostrum/django-registration/src/b6b213d84d32/registration/models.py

In a nutshell:

class RegistrationProfile(models.Model):

def activation_key_expired(self):
...
expiration_date =
datetime.timedelta(days=settings.ACCOUNT_ACTIVATION_DAYS)
return self.activation_key == self.ACTIVATED or \
(self.user.date_joined + expiration_date <=
datetime.datetime.now())
activation_key_expired.boolean = True ##### <- what does this do?

What does that last line do? I have looked high and low in Django and
Python documentation, but I can't find an example or explanation of
this pattern. It appears to be clobbering the method
'activation_key_expired()' with a boolean that is always True. Surely
there's something else at work here, isn't there? Sorry if this is
obvious to everyone but me, but I can't find the answer anywhere.

Thanks.
Alan

btw: James Bennett's django-registration app is great. Elegant, well
designed, and does exactly what it needs to. I learned a lot about
django and django testing just by reading the code.

--
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 django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment