Custom Fields API Cleanup

2008-12-16 Thread David Cramer
Recently we've been doing a lot of work with custom fields, and have had a few inconveniences come up. Some minor, some not so much. I'd like to propose a few changes to the API to make it easier to write custom fields, especially those which use custom data structures. The first of which, is the

Re: Custom Fields API Cleanup

2008-12-16 Thread Jacob Kaplan-Moss
On Tue, Dec 16, 2008 at 9:06 AM, David Cramer wrote: > The first of which, is the pre_save method. Originally we had been > using get_db_pre_value (which also is passed on to the save method), > and this seems to make a lot more sense than pre_save's > implementation. I'm not 100% sure which one

Re: Custom Fields API Cleanup

2008-12-16 Thread David Cramer
I should also note, that these changes, could possibly be carried over into Model Field's. As IIRC they were suffering from some of the same problems. On Tue, Dec 16, 2008 at 12:03 PM, Jacob Kaplan-Moss < jacob.kaplanm...@gmail.com> wrote: > > On Tue, Dec 16, 2008 at 9:06 AM, David Cramer wrote:

Re: Custom Fields API Cleanup

2008-12-16 Thread Marty Alchin
On Tue, Dec 16, 2008 at 1:03 PM, Jacob Kaplan-Moss wrote: > This seems like a good idea to me, and an easy one to implement; I'm > all for it. Are there any backwards-compatibility concerns here? It > doesn't look like it -- we're just talking about adding a new hook to > SubFieldBase, right? My

Re: Custom Fields API Cleanup

2008-12-16 Thread David Cramer
Could we just use a lazy proxy for the value value? When it's executed, it could then just call the get_value_from_db method (or whatever). On Tue, Dec 16, 2008 at 12:37 PM, Marty Alchin wrote: > > On Tue, Dec 16, 2008 at 1:03 PM, Jacob Kaplan-Moss > wrote: > > This seems like a good idea to m

Re: Custom Fields API Cleanup

2008-12-16 Thread Marty Alchin
On Tue, Dec 16, 2008 at 2:02 PM, David Cramer wrote: > Could we just use a lazy proxy for the value value? When it's executed, it > could then just call the get_value_from_db method (or whatever). I expect that the lazy approach is what most people would really want, so I'd be fine with that. I

Re: Custom Fields API Cleanup

2008-12-16 Thread Malcolm Tredinnick
On Tue, 2008-12-16 at 12:08 -0600, David Cramer wrote: > I should also note, that these changes, could possibly be carried over > into Model Field's. As IIRC they were suffering from some of the same > problems. Again, specifics are important. Pretty much all existing model fields wrap base data

Re: Custom Fields API Cleanup

2008-12-16 Thread Malcolm Tredinnick
On Tue, 2008-12-16 at 09:06 -0800, David Cramer wrote: > Recently we've been doing a lot of work with custom fields, and have > had a few inconveniences come up. Some minor, some not so much. I'd > like to propose a few changes to the API to make it easier to write > custom fields, especially th