Finally, I've rewritten all model and field tests and checks. Some new tests
were written. First draft of checking framework documentation was written. 
All
tests passes (at least at my computer). I've rebased my branch
(`gsoc2013-checks` [1]) against master. The branch is ready to deep review.

[1] https://github.com/chrismedrela/django/tree/gsoc2013-checks

I've created pull request [2] for ticket [#19934]. The patch clarifies that
importing `django.utils.image` cannot result in ImportError. I've also 
created
ticket [#20735] about confusing ManyToManyField documentation. There is a 
pull
request too [3]. Both pull requests were merged.

[2] https://github.com/django/django/pull/1349
[3] https://github.com/django/django/pull/1350
[#19934] https://code.djangoproject.com/ticket/19934
[#20735] https://code.djangoproject.com/ticket/20735

1. I wrote some tests [4] where nose tests generators [5] would be really
helpful. I tried to emulate them. Is the code I wrote a good approach?

[4] 
https://github.com/chrismedrela/django/blob/1c14c674aa52c666ec8742c72657d5dad2efe0cb/tests/invalid_models/tests.py#L690
[5] 
https://nose.readthedocs.org/en/latest/writing_tests.html#test-generators

2. Two m2m through the same model are forbidden. The new error message is:

applabel.modelname: Two m2m relations through the same model.
The model has two many-to-many relations through the intermediary Membership
model, which is not permitted.
(No hint.)


Is there any reasonable hint we can provide except for suggesting 
duplicating
the intermediary model?

3. I've deleted `app_errors` [6] because it wasn't used anywhere (inside
Django). Was it left by accident or was there a reason for that?

[6] 
https://github.com/chrismedrela/django/commit/3b221caefc151f7750a322e18798c22343daba6f

4. I've renamed DatabaseValidation.validate_field to check_field and 
changed its
arguments. They were: `errors` -- ModelErrorCollection [7], `opts` -- meta 
of
the model of the field and `f` -- the field; The method returned None. Now 
there
is only `field` argument and the method returns list of errors. It's not 
public
API, but we should go through deprecation process.

How can we do that regarding changed arguments? We can call old 
`validate_field`
method where the backend specific validation is triggered [8]. By default, 
the
old method will call `check_field` method. The old one need to transform 
list of
errors into strings and add them to `errors` list. The problem is that at 
[8] we
need to convert the strings again to errors. That cannot be done in a 
graceful
way. Is there any other way to achieve deprecation?

[7] 
https://github.com/django/django/blob/master/django/core/management/validation.py#L11
[8] 
https://github.com/chrismedrela/django/blob/1c14c674aa52c666ec8742c72657d5dad2efe0cb/django/db/models/fields/__init__.py#L710

-- 
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-developers.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to