Compassion projects

Big update on compassion projects and compassion children.

- Project info retrieval via webservice
- Description generations improved
- Unit tests for child information and project information retrieval
- Compassion Countries
- Moved accessed rules from sponsorship_compassion to child_compassion, for objects defined in chil_compassion module
- Webservice JSON field names updated (GMC changed the field names to always begin with a lowercase character)
- Refactoring of redundant code, renaming of child.property.value to translated.value and put code for retrieving translated value ids inside the class
- PEP8
- Bug fixes...
- Etc... :neckbeard:

![image](https://cloud.githubusercontent.com/assets/8435180/4665122/531cd794-5548-11e4-8bbb-644b3ab7e793.png)

I don’t agree with this one, as the dict() method can take a generator as argument and in this case, the argument is a generator and not a list comprehension, which seems to be better for performance. See the comment on the answer of this question on stackoverflow:
http://stackoverflow.com/questions/3231250/python-list-comprehension-for-dictionaries-in-dictionaries

See also this thread :
http://stackoverflow.com/questions/1747817/python-create-a-dictionary-with-list-comprehension


From: CSester [mailto:notifications@github.com]
Sent: vendredi 31 octobre 2014 12:31
To: CompassionCH/compassion-modules
Cc: Emanuel Cino (CH-IT)
Subject: Re: [compassion-modules] Compassion projects (#20)


In child_compassion/model/project_compassion.py:

> +        values = {

> +            'type': prog_impl.get('programImplementorTypeCode'),

> +            'local_church_name': prog_impl.get('organizationName'),

> +            'hiv_category': prog_impl.get('hIVCategory'),

> +            'month_school_year_begins': prog_impl.get(

> +                'monthSchoolYearBegins'),

> +            'country_denomination': prog_impl.get('countryDenomination'),

> +            'western_denomination': prog_impl.get('westernDenomination'),

> +            'community_name': prog_impl.get('communityName'),

> +            'country_id': self._update_country(

> +                cr, uid, prog_impl.get('iSOCountryCode'), context),

> +        }

> +

> +        community_id = prog_impl.get('communityID')

> +        return dict(

> +            (field_name, value) for field_name, value in values.iteritems()

What you're doing here is called a list comprehension, and the usual syntax would be dict([(x, y) for x, y, in val.iteritems() if y]). It seems to work without the [ ], but I suggest to add them to improve readability.

—
Reply to this email directly or view it on GitHub<https://github.com/CompassionCH/compassion-modules/pull/20/files#r19661998>.