~launchpad-pqm/launchpad/devel

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
= Translation Relicensing Agreement =

Translators who have previously submitted any translations through
Launchpad can decide whether they want their translations relicensed
under BSD or not.

    >>> from zope.component import getUtility
    >>> from canonical.launchpad.webapp.testing import verifyObject
    >>> from lp.translations.model.translationrelicensingagreement \
    ...     import TranslationRelicensingAgreement
    >>> from lp.registry.interfaces.person import IPersonSet
    >>> from lp.translations.interfaces.translationsperson import (
    ...     ITranslationsPerson)
    >>> from lp.translations.interfaces.translationrelicensingagreement \
    ...     import ITranslationRelicensingAgreement
    >>> login('karl@canonical.com')
    >>> person = getUtility(IPersonSet).getByName('karl')
    >>> translations_person = ITranslationsPerson(person)
    >>> verifyObject(ITranslationsPerson, translations_person)
    True

When Karl has not made his selection yet, it is marked as None.

    >>> print translations_person.translations_relicensing_agreement
    None
    >>> choice = TranslationRelicensingAgreement.selectOneBy(person=person)
    >>> print choice
    None

Setting a value will create a new TranslationRelicensingAgreement
object.

    >>> translations_person.translations_relicensing_agreement = True
    >>> print translations_person.translations_relicensing_agreement
    True
    >>> choice = TranslationRelicensingAgreement.selectOneBy(person=person)
    >>> print choice.allow_relicensing
    True

A `choice` implements ITranslationRelicensingAgreement interface:

    >>> verifyObject(ITranslationRelicensingAgreement, choice)
    True

A translator can also change their mind later.

    >>> translations_person.translations_relicensing_agreement = False
    >>> print translations_person.translations_relicensing_agreement
    False
    >>> choice = TranslationRelicensingAgreement.selectOneBy(person=person)
    >>> print choice.allow_relicensing
    False