On 06/18/2014 02:59 PM, Aymeric Augustin wrote: > 2014-06-18 19:18 GMT+02:00 Carl Meyer <c...@oddbird.net > <mailto:c...@oddbird.net>>: > > If you need a Function in your > project (whether provided by Django or by a third-party library), and > the Function doesn't natively support the database backend you're using, > you can simply subclass it, add the appropriate as_vendor method, and > use your subclass. > > > I was thinking about third-party database backends. How are they expected > to ship customised implementations of Functions included in Django?
Yes, I wasn't thinking about this case in my first mail, and I agree that this is a serious problem for the pure as_vendor() approach; it's not acceptable IMO to expect third-party database backends to monkeypatch their as_vendor() methods onto the built-in Function classes. I think database backends should have a hook to override the SQL implementation of any given Function. I don't think this needs to imply pushing the default implementation of all Functions down into the database backend (that just makes life unnecessarily difficult for third-party Functions). It may be necessary to support both as_vendor() methods and a hook in the database backend (with the database backend taking priority). That allows third-party database backends to Just Work with all built-in Functions, and third-party Functions to Just Work with all built-in database backends, with no monkeypatching needed for either. Then the only case in which some form of monkeypatching (perhaps supported by a public API to register additional function-implementation overrides at ready()) would be needed would be a third-party Function used with a third-party database backend. Carl -- You received this message because you are subscribed to the Google Groups "Django developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-developers+unsubscr...@googlegroups.com. To post to this group, send email to django-developers@googlegroups.com. Visit this group at http://groups.google.com/group/django-developers. To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/53A20339.7050103%40oddbird.net. For more options, visit https://groups.google.com/d/optout.