Skip to content

Commit

Permalink
Merge pull request #182 from volunteer-planner/develop
Browse files Browse the repository at this point in the history
Release 2.1
  • Loading branch information
maiksprenger committed Oct 9, 2015
2 parents 714b2c3 + 540a78a commit aff8581
Show file tree
Hide file tree
Showing 34 changed files with 1,034 additions and 480 deletions.
21 changes: 19 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,24 @@
language: python

python: "2.7"

env: DJANGO_SETTINGS_MODULE=volunteer_planner.settings.tests

install: "pip install -r requirements/dev.txt"
env: DJANGO_SETTINGS_MODULE=volunteer_planner.settings.local
script: py.test --create-db tests/

# Fire up a webserver for Selenium
before_script:
- ./manage.py migrate
- gunicorn -D volunteer_planner.wsgi_behave

script:
# Python tests (mostly unit tests)
- py.test --create-db tests/

# Our behave tests (using Selenium)
- behave tests/_behave

# Disable Travis rather annoying email notifications. Talk to Maik
# if you want them enabled.
notifications:
email: false
76 changes: 52 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -166,13 +166,10 @@ If you just use "python manage.py create_dummy_data 5" without --flush it is NOT

### Running Tests

*Note*: we're committed to testing and hope, the next paragraph will not be a lie any longer soon :-)
Feature PR should be accompanied by appropriate test. We have unit and integration tests that
are run with `py.test`, and functional/behave tests that are run with `selenium`.

We are using test driven development (TDD) with [py.test](http://pytest.org/).

A good read on TDD is the free o'Reilly eBook ["Test-Driven Development with Python"](http://chimera.labs.oreilly.com/books/1234000000754/index.html)

To run the tests, run the following command (with your virtual env activated, see 3.)
To run unit tests, run the following command (with your virtual env activated, see 3.)

$ py.test -v [/path/to/volunteer_planner.git/]

Expand All @@ -184,27 +181,58 @@ This generates a nice HTML coverage page, to poke around which can be found at `

*Note*: The directory `htmlcov` is git-ignored.

### Translations
We use transiflex for managing translations.
You first need to make sure that the transiflex client is installed.
```
pip install transifex-client
```
For further installation infos check http://docs.transifex.com/client/setup/
To run selenium tests, run

The workflow is like
$ behave tests/_behave

1. you code you stuff
2. "./manage.py makemessages --no-obsolete --no-wrap" The options are intended to make the output more git-friendly.
3. "tx push -s django"
3. do translations on transiflex
4. "tx pull"
5. "./manage.py compilemessages"
6. test if it looks good
7. commit push with git
### Translations

Your local installation should be translated then.
The .mo file created by compilemessages is gitignored,
We use [Transifex (tx)](https://www.transifex.com/coders4help/volunteer-planner/) for managing translations.

#### General notes

* Please read
* [Django 1.8: Internationalization and localization](https://docs.djangoproject.com/en/1.8/topics/i18n/)
* [Django 1.8: Translations](https://docs.djangoproject.com/en/1.8/topics/i18n/translation/)
* Please avoid internationalized strings / messages containing HTML markup. This makes the site layout depending on the translators and them getting the markup right; it's error prone and hardly maintainable when the page's layout changes.
* use `trimmed` option in [blocktrans](https://docs.djangoproject.com/en/1.8/topics/i18n/translation/#std:templatetag-blocktrans) template tags, if indention is not intended.
* Please provide [contextual markers](https://docs.djangoproject.com/en/1.8/topics/i18n/translation/#contextual-markers) on strings to help translators understanding the usage of the strings better. The shorter an internationalized string is, the more abigious it will be and the more important an contextual hint will be.

#### Workflow

1. Code your stuff using the `ugettext_lazy as _` etc. methods to mark internationalized strings
2. Update the po files `./manage.py makemessages --no-obsolete --no-wrap`
The options are intended to make the output more git-friendly.
3. Push the updated translations to git. **Do not intend to translate in the local .po files, any changes here will be overwritten when translations are pulled from [tx](https://www.transifex.com/coders4help/volunteer-planner/).**
4. Transifex will automatically update the source strings via github once a day and make them available for translation.
4.1. If necessary, translation managers (meaning VP's Transifex project admins) can update the source language manually using the tx client command `tx push -s django`.
5. Translators will then translate on [VP's Transifex project](https://www.transifex.com/coders4help/volunteer-planner/)
6. When new translations are available on Transifex `tx pull` will update the local .po files with translations from TX
7. `./manage.py makemessages --no-wrap --no-obsolete` will reformat po files in a more readable single-line message string format
8. `./manage.py compilemessages`
9. Test if it looks good and works as intended
10. Commit and push the updated translations to git

Your local installation should be translated then. The .mo file created by compilemessages is gitignored,
you'll need to (re-)generate it locally every time the .po file changes.

#### How to use the Transifex client

You first need to make sure that the transiflex client is installed (should be in the requirements/dev.txt file).

```
pip install transifex-client
```

* For further installation infos and setup read [Transifex: Client setup](http://docs.transifex.com/client/config/)
* Then, sign up at https://www.transifex.com, search for the project volunteer-planner.org, and join the respective team.
* If you used an Oauth-ish method (Google, Facebook, etc.) to sign up for Transifex, you might need to set a password in your [Transifex profile](https://www.transifex.com/user/settings/password/) before you can use the client.
* Edit your personal transifex configuration file that is stored in your home directory at ~/.transifexrc
```
[https://www.transifex.com]
username = YOUR_TRANSIFEX_USERNAME
token =
password = YOUR_TRANSIFEX_PASSWORD
hostname = https://www.transifex.com
```
Make sure not to share this file with anyone, as it contains your credentials! For more information on configuration, see http://docs.transifex.com/client/config/
3 changes: 2 additions & 1 deletion accounts/admin.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Register your models here.
# coding: utf-8

from django.contrib import admin

from .models import UserAccount
Expand Down
6 changes: 1 addition & 5 deletions accounts/templates/user_account_edit.html
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
{% extends 'base_non_logged_in.html' %}
{% extends 'base.html' %}
{% load i18n %}

{% block title %}{{ user.username }}{% endblock %}
{% block body_class %}helpdesk{% endblock %}

{% block navbar %}
{% include 'navbar.html' %}
{% endblock %}

{% block content %}
<div class="col-md-8 col-md-offset-2 update_form">
<form action="." method="POST">
Expand Down
6 changes: 1 addition & 5 deletions accounts/templates/user_detail.html
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
{% extends 'base_non_logged_in.html' %}
{% extends 'base.html' %}
{% load i18n %}

{% block title %}{{ user.username }}{% endblock %}
{% block body_class %}helpdesk{% endblock %}

{% block navbar %}
{% include 'navbar.html' %}
{% endblock %}

{% block content %}
<div class="col-md-8 col-md-offset-2">
<ul class="list-group">
Expand Down
3 changes: 0 additions & 3 deletions accounts/tests.py

This file was deleted.

3 changes: 3 additions & 0 deletions accounts/urls.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# coding: utf-8

from django.conf.urls import url

from .views import user_account_detail, AccountUpdateView

urlpatterns = [
Expand Down
4 changes: 3 additions & 1 deletion accounts/views.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# coding: utf-8

from django.shortcuts import render
from django.contrib.auth.decorators import login_required
from django.views.generic.edit import UpdateView
Expand All @@ -21,4 +23,4 @@ class AccountUpdateView(LoginRequiredMixin, UpdateView):
success_url = reverse_lazy('account_detail')

def get_object(self, queryset=None):
return self.request.user
return self.request.user
3 changes: 0 additions & 3 deletions blueprint/tests.py

This file was deleted.

3 changes: 0 additions & 3 deletions common/tests.py

This file was deleted.

Loading

0 comments on commit aff8581

Please sign in to comment.