Nous sommes toujours reconnaissants pour tout correctif au code de Django. Il est vrai que les rapports de bogue avec correctif associé seront résolus bien plus rapidement que ceux sans correctif.
Si vous corrigez un problème vraiment trivial, par exemple en changeant un mot dans la documentation, la manière préférée de soumettre un correctif est de passer par les requêtes de contribution GitHub sans ouvrir un ticket Trac.
Consultez Travailler avec Git et GitHub pour plus de détails sur la manière d’utiliser les requêtes de contribution (« pull requests »).
In an open-source project with hundreds of contributors around the world, it’s important to manage communication efficiently so that work doesn’t get duplicated and contributors can be as effective as possible.
Hence, our policy is for contributors to « claim » tickets in order to let other developers know that a particular bug or feature is being worked on.
If you have identified a contribution you want to make and you’re capable of fixing it (as measured by your coding ability, knowledge of Django internals and time availability), claim it by following these steps:
Owned by
du ticket. S’il est attribué à nobody
, c’est qu’il est disponible. Sinon, quelqu’un d’autre est probablement en train de travailler sur ce ticket. Cherchez alors un autre bogue ou fonctionnalité ou contactez le développeur travaillant sur le ticket pour offrir votre aide. Si un ticket est attribué à quelqu’un depuis des semaines ou mois sans activité, il peut sans doute vous être attribué sans risque de conflit.Note
The Django software foundation requests that anyone contributing more than a trivial patch to Django sign and submit a Contributor License Agreement, this ensures that the Django Software Foundation has clear license to all contributions allowing for a clear license for all users.
Once you’ve claimed a ticket, you have a responsibility to work on that ticket in a reasonably timely fashion. If you don’t have time to work on it, either unclaim it or don’t claim it in the first place!
If there’s no sign of progress on a particular claimed ticket for a week or two, another developer may ask you to relinquish the ticket claim so that it’s no longer monopolized and somebody else can claim it.
If you’ve claimed a ticket and it’s taking a long time (days or weeks) to code, keep everybody updated by posting comments on the ticket. If you don’t provide regular updates, and you don’t respond to a request for a progress report, your claim on the ticket may be revoked.
As always, more communication is better than less communication!
Of course, going through the steps of claiming tickets is overkill in some cases.
In the case of small changes, such as typos in the documentation or small bugs that will only take a few minutes to fix, you don’t need to jump through the hoops of claiming tickets. Submit your patch directly and you’re done!
Évidemment, il est toujours acceptable de soumettre des correctifs à un ticket si vous avez un correctif déjà prêt, que le ticket soit attribué à quelqu’un ou pas.
Assurez-vous que toute contribution remplit au minimum les exigences suivantes :
When you think your work is ready to be reviewed, send a GitHub pull request. Please review the patch yourself using our patch review checklist first.
If you can’t send a pull request for some reason, you can also use patches in Trac. When using this style, follow these guidelines.
git diff
command..diff
extension; this will let the ticket
tracker apply correct syntax highlighting, which is quite helpful.Regardless of the way you submit your work, follow these steps.
A « non-trivial » patch is one that is more than a small bug fix. It’s a patch that introduces Django functionality and makes some sort of design decision.
If you provide a non-trivial patch, include evidence that alternatives have been discussed on django-developers.
If you’re not sure whether your patch should be considered non-trivial, ask on the ticket for opinions.
There are a couple of reasons that code in Django might be deprecated:
As the deprecation policy describes,
the first release of Django that deprecates a feature (A.B
) should raise a
RemovedInDjangoXXWarning
(where XX is the Django version where the feature
will be removed) when the deprecated feature is invoked. Assuming we have good
test coverage, these warnings are converted to errors when running the
test suite with warnings enabled:
python -Wa runtests.py
. Thus, when adding a RemovedInDjangoXXWarning
you need to eliminate or silence any warnings generated when running the tests.
The first step is to remove any use of the deprecated behavior by Django itself.
Next you can silence warnings in tests that actually test the deprecated
behavior by using the ignore_warnings
decorator, either at the test or class
level:
In a particular test:
from django.test import ignore_warnings
from django.utils.deprecation import RemovedInDjangoXXWarning
@ignore_warnings(category=RemovedInDjangoXXWarning)
def test_foo(self):
...
For an entire test case:
from django.test import ignore_warnings
from django.utils.deprecation import RemovedInDjangoXXWarning
@ignore_warnings(category=RemovedInDjangoXXWarning)
class MyDeprecatedTests(unittest.TestCase):
...
You can also add a test for the deprecation warning:
from django.utils.deprecation import RemovedInDjangoXXWarning
def test_foo_deprecation_warning(self):
msg = 'Expected deprecation message'
with self.assertWarnsMessage(RemovedInDjangoXXWarning, msg):
# invoke deprecated behavior
Finally, there are a couple of updates to Django’s documentation to make:
.. deprecated:: A.B
annotation. Include a short description
and a note about the upgrade path if applicable.docs/releases/A.B.txt
) under
the « Features deprecated in A.B » heading.docs/internals/deprecation.txt
) sous la version adéquate en indiquant le code qui sera supprimé.Once you have completed these steps, you are finished with the deprecation.
In each feature release, all
RemovedInDjangoXXWarning
s matching the new version are removed.
Pour des informations sur les correctifs JavaScript, consultez la documentation Correctifs JavaScript.
Use this checklist to review a pull request. If you are reviewing a pull request that is not your own and it passes all the criteria below, please set the « Triage Stage » on the corresponding Trac ticket to « Ready for checkin ». If you’ve left comments for improvement on the pull request, please tick the appropriate flags on the Trac ticket based on the results of your review: « Patch needs improvement », « Needs documentation », and/or « Needs tests ». As time and interest permits, committers do final reviews of « Ready for checkin » tickets and will either commit the patch or bump it back to « Accepted » if further works need to be done. If you’re looking to become a committer, doing thorough reviews of patches is a great way to earn trust.
Looking for a patch to review? Check out the « Patches needing review » section of the Django Development Dashboard. Looking to get your patch reviewed? Ensure the Trac flags on the ticket are set so that the ticket appears in that queue.
make html
ou make.bat html
sur Windows, à partir du répertoire docs
) ?docs/releases/A.B.C.txt
? Les corrections de bogues qui ne s’appliquent qu’à la branche master
n’ont pas besoin d’une note de publication.docs/releases/A.B.txt
?.. versionadded:: A.B
ou .. versionchanged:: A.B
?Consultez le guide Deprecating a feature.
flake8
?docs/releases/A.B.txt
) ?AUTHORS
et soumettre un Contributor License Agreement (accord de licence de contribution).août 03, 2020