On 17 févr. 2015, at 11:06, Loïc Bistuer <loic.bist...@gmail.com> wrote:

> The proposed fix for the release blocker 
> https://code.djangoproject.com/ticket/24351 suggests changing the signature 
> of the `allow_migrate` database router.
> 
> From:
> def allow_migrate(self, db, model):
> 
> To:
> def allow_migrate(self, db, app_label, model, **hints):
> 
> We need to make a design decision.

It appears that we have the change the signature of this function one way or 
another and that inspect.getargspec is our only option to preserve 
compatibility.

Did you consider the following signature?
def allow_migrate(self, db, app_label, model_name=None, **hints):

While it’s a slightly larger change, it has a several advantages:
- passing (app_label, model_name) as strings is an established convention in 
many other APIs.
- it removes the possibility that app_label != model._meta.app_label — which 
doesn’t make much sense anyway.
- our examples only ever use app_label — and keep repeating 
model._meta.app_label to get it.

If the model class is needed, it can be fetched with apps.get_model(app_label, 
model_name).

-- 
Aymeric.

PS: we chose to make 1.8 the next LTS instead of 1.7 precisely so we could make 
such adjustments.

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" 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/B42BA226-16FE-43D5-BE12-8FFD3DCD3094%40polytechnique.org.
For more options, visit https://groups.google.com/d/optout.

Reply via email to