Hey all,

In the process of my work on adding multi-db support to Django it has
become necessary to alter the signatures of Field.db_type and
Field.get_db_prep_(save, value, lookup).  These methods are both
documented in the custom-fields documentation, so I believe we should
strive to maintain backwards compatibility with existing
implementations of these methods.  The change that has been made is to
add a new (required) "connection" parameter to these methods.  Were
this change to be made on it's own this would be a backwards
incompatible change since existing implementations would fail:

def get_db_prep_value(self, value):
    pass

field.get_db_prep_value(value, connection)

Results in a TypeError.  To ameliorate this concern I have wrapped all
calls to get_db_prep_* and db_type with a function that instrospects
the method and checks if it accepts a connection parameter, in order
that existing methods could be called safely, and allowing for a
smooth deprecation path.  The issue to be resolve (in my view) is
whether we need to provide a default value for connection in the
implementations of these methods within Django.  That is to say, is
this a public API for users to call, in addition to define.

I'd like to hear any thoughts people have on this issue (or anything
else I've said).

Thanks,
Alex

-- 
"I disapprove of what you say, but I will defend to the death your
right to say it." -- Voltaire
"The people's good is the highest law." -- Cicero
"Code can always be simpler than you think, but never as simple as you
want" -- Me

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

Reply via email to