Projet

Général

Profil

0001-authentic2-saml-forms-remove-self.childs-there-are-n.patch

Benjamin Dauvergne, 18 décembre 2015 12:21

Télécharger (1,72 ko)

Voir les différences:

Subject: [PATCH] authentic2/saml/forms: remove self.childs, there are no
 children models anymore

 src/authentic2/saml/forms.py | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)
src/authentic2/saml/forms.py
26 26
        url = cleaned_data.get('url')
27 27
        ou = cleaned_data.get('ou')
28 28
        self.instance = None
29
        self.childs = []
30 29
        if name and slug and url:
31 30
            try:
32 31
                content = urllib2.urlopen(url).read().decode('utf-8')
......
40 39
                    slug=slug, metadata=content, metadata_url=url, ou=ou)
41 40
                liberty_provider.full_clean(exclude=
42 41
                        ('entity_id', 'protocol_conformance'))
43
                self.childs.append(liberty_provider,
44
                    enabled=True)
45 42
            except ValidationError, e:
46 43
                raise
47 44
            except Exception, e:
45
                raise
48 46
                raise ValidationError('unsupported error: %s' % e)
49 47
            self.instance = liberty_provider
50 48
        return cleaned_data
51 49

  
52 50
    def save(self):
53
        if not self.instance is None:
54
            self.instance.save()
55
            for child in self.childs:
56
                child.liberty_provider = self.instance
57
                child.save()
51
        self.instance.save()
58 52
        return self.instance
59
-