Getters and setters on fields

2006-12-15 Thread jerf
Per a discussion in django-users[1], I'm requesting that getters and setters be added to fields in Django models, for the same basic reasons that "property" is a useful keyword in Python. Ticket 3418[2] contains a proposed patch. The code is small, but I post it here because the potential impact

Re: Getters and setters on fields

2006-12-15 Thread Jacob Kaplan-Moss
On 12/15/06 7:14 PM, jerf wrote: > Per a discussion in django-users[1], I'm requesting that getters and > setters be added to fields in Django models, for the same basic reasons > that "property" is a useful keyword in Python. > > Ticket 3418[2] contains a proposed patch. The code is small, but I

Re: Getters and setters on fields

2006-12-15 Thread Jeremy Bowers
Jacob Kaplan-Moss wrote: > The patch looks pretty good to me; it applies cleanly and all the unit tests > pass (you get major props for including 'em on the first pass :). > > However, I do have one quibble: the addition of ``self._django_initializing`` > inside ``Model.__init__`` has a pretty n

Re: Getters and setters on fields

2006-12-16 Thread Adrian Holovaty
On 12/15/06, Jacob Kaplan-Moss <[EMAIL PROTECTED]> wrote: > Also, a few lines of documentation need to be added (to docs/model-api.txt) > before this can be checked in. If you can remove the ``_django_initializing`` > flag (or at least explain why you need it) and write a few lines of docs, I'll

Re: Getters and setters on fields

2006-12-16 Thread Jeremy Bowers
Adrian Holovaty wrote: > Before checking in this new functionality, I'd be very interested in > seeing whether it would be possible to allow for "normal" property > usage on models, rather than inventing a new way of doing it. > > Seems like it would be tricky to figure it out, but that shouldn't

Re: Getters and setters on fields

2006-12-18 Thread Jeremy Bowers
I got burned this weekend with authentication users, setting passwords on them directly during construction. (I knew I had to call set_password to change the password but I had gotten the idea I could pass 'password' into the constructor and get it handled correctly.) If my getters/setters pat