git clone git://git.osuosl.org/gitolite/ganeti/ganeti_webmgr
Commit access requires an account on our gitolite server. You must Submitting Patches and establish a relationship with us prior to being granted commit access.
git clone git@git.osuosl.org:ganeti/ganeti_webmgr
We use Git-flow for managing our branches. Read about the branching model and why you should use it too.
We follow PEP 8, “the guide for python style”.
In addition to PEP 8:
Try to write modular code. Focus on isolating units of code that can be easily analyzed and tested. For sanity purposes, please try to avoid mutually recursive objects.
If you need a JSON library, the import for this codebase is “from django.utils import simplejson as json”. See #6579 for more information.
Ganeti Web Manager has a fairly complete test suite. New code should have matching tests. Before committing code, run the suite for Ganeti Web Manager and Object Permissions
./manage.py test ganeti_web
./manage.py test object_permissions
Remember to tear down any resources you set up in your tests. Don’t use “YourModel.objects.all().delete()” to clean up your objects; it could be hiding bugs. Clean up exactly the resources you created.
To speed up analysis of broken tests, if you have a setUp() or tearDown() in a TestCase, add a test_trivial() method which is empty. It will pass if your setUp() and tearDown() work.
All views should be thoroughly tested for security, checking to ensure that the proper http codes are returned.
Check for invalid input.
The test suite does not yet include selenium tests for verifying javascript functionality. Some basic tests can be performed using django’s test suite:
When adding a feature to GWM, please remember to include:
The gray box with a green title bar that appears on the right side of the page when you focus on a form field is a help tip. To add one for a new field, add it to the file which corresponds to your field’s form in the ganeti_web/templates/ganeti/helptips/ directory.
Ganeti Web Manager is designed to support translation to other languages using Django’s i18n machinery. If you add text that will be displayed to the user, please remember to format it for translation:
{% trans "this text will be displayed in the correct language" %}
{% blocktrans %}
Here is a some text that will be displayed
in the correct language but would not
fit well in a single line
{% endblocktrans %}
Django’s i18n page has more information about this.
Patches should either be attached to issues, or emailed to the mailing list. If a patch is relevant to an issue, then please attach the patch to the issue to prevent it from getting lost.
Patches must be in git patch format, as generated by git format-patch.
git commit
git format-patch HEAD^
To create patches for all changes made from the origin’s master branch, try:
git format-patch origin/master
For more information, see the man page for git-format-patch.
Sending emails to the list can be made easier with git send-mail; see the man page for git-send-email for instructions on getting your email system to work with git.
If there are multiple patches comprising a series which should be applied all at once, git pull requests are fine. Send a rationale for the pull request, along with a git pull URL and branch name, to the mailing list.