예제 #1
0
 def display_name(self):
     languages = ''
     if self.role_descriptor == 'SP':
         path = [
             addns('SPSSODescriptor'),
             addns('Extensions'),
             addns('UIInfo', MDUI_NAMESPACE),
             addns('DisplayName', MDUI_NAMESPACE)
         ]
     else:
         path = [
             addns('IDPSSODescriptor'),
             addns('Extensions'),
             addns('UIInfo', MDUI_NAMESPACE),
             addns('DisplayName', MDUI_NAMESPACE)
         ]
     displays = self.etree.findall('/'.join(path))
     for dn_node in displays:
         lang = getlang(dn_node)
         if lang is None:
             continue  # the lang attribute is required
         if lang == 'en':
             languages = dn_node.text
     if languages == '' and len(displays) > 0:
         languages = displays[0].text
     return languages
예제 #2
0
 def store_spcategory_database(self, metadata=None):
     if metadata is None:
         metadata = self._load_metadata()
     if (metadata.has_categories_el()
             or metadata.has_assurance_certification_el()):
         sp_cats, created = SPEntityCategory.objects.get_or_create(
             entity=self)
     else:
         return
     if metadata.has_categories_el():
         categories = metadata.sp_categories
         sp_cats.research_and_scholarship = SP_CATEGORIES[
             'R&S'] in categories
         sp_cats.code_of_conduct = SP_CATEGORIES['CoCo'] in categories
         sp_cats.research_and_education = SP_CATEGORIES['R&E'] in categories
         sp_cats.rae_hei_service = SP_CATEGORIES['HEI'] in categories
         sp_cats.rae_nren_service = SP_CATEGORIES['NREN'] in categories
         sp_cats.rae_eu_protection = SP_CATEGORIES['EU'] in categories
         sp_cats.swamid_sfs = SP_CATEGORIES['SFS'] in categories
         if sp_cats.code_of_conduct:
             lang, psu = self.privacy_statement_url
             sp_cats.coc_priv_statement_url = psu
             sp_cats.lang_priv_statement_url = getlang(psu)
     self._store_certifications_database(metadata, sp_cats)
     sp_cats.save()
예제 #3
0
파일: models.py 프로젝트: enriquepablo/peer
    def display_name(self):
        languages = {}
        path = [addns('SPSSODescriptor'), addns('Extensions'),
                addns('UIInfo', MDUI_NAMESPACE),
                addns('DisplayName', MDUI_NAMESPACE)]
        for dn_node in self.etree.findall('/'.join(path)):
            lang = getlang(dn_node)
            if lang is None:
                continue  # the lang attribute is required

            languages[lang] = dn_node.text

        return languages
예제 #4
0
파일: models.py 프로젝트: pombredanne/peer
    def display_name(self):
        languages = {}
        path = [
            addns("SPSSODescriptor"),
            addns("Extensions"),
            addns("UIInfo", MDUI_NAMESPACE),
            addns("DisplayName", MDUI_NAMESPACE),
        ]
        for dn_node in self.etree.findall("/".join(path)):
            lang = getlang(dn_node)
            if lang is None:
                continue  # the lang attribute is required

            languages[lang] = dn_node.text

        return languages
예제 #5
0
파일: models.py 프로젝트: pombredanne/peer
    def organization(self):
        languages = {}
        for org_node in self.etree.findall(addns("Organization")):
            for attr in ("name", "displayName", "URL"):
                node_name = "Organization" + attr[0].upper() + attr[1:]
                for node in org_node.findall(addns(node_name)):
                    lang = getlang(node)
                    if lang is None:
                        continue  # the lang attribute is required

                    lang_dict = languages.setdefault(lang, {})
                    lang_dict[attr] = node.text

        result = []
        for lang, data in languages.items():
            data["lang"] = lang
            result.append(data)
        return result
예제 #6
0
    def organization(self):
        languages = {}
        for org_node in self.etree.findall(addns('Organization')):
            for attr in (('name', 'Name'), ('displayName', 'DisplayName'),
                         ('URL', 'URL')):
                node_name = 'Organization' + attr[1]
                for node in org_node.findall(addns(node_name)):
                    lang = getlang(node)
                    if lang is None:
                        continue  # the lang attribute is required

                    lang_dict = languages.setdefault(lang, {})
                    lang_dict[attr[0]] = node.text

        result = []
        for lang, data in languages.items():
            data['lang'] = lang
            result.append(data)
        return result
예제 #7
0
    def organization(self):
        languages = {}
        for org_node in self.etree.findall(addns('Organization')):
            for attr in (('name', 'Name'),
                         ('displayName', 'DisplayName'),
                         ('URL', 'URL')):
                node_name = 'Organization' + attr[1]
                for node in org_node.findall(addns(node_name)):
                    lang = getlang(node)
                    if lang is None:
                        continue  # the lang attribute is required

                    lang_dict = languages.setdefault(lang, {})
                    lang_dict[attr[0]] = node.text

        result = []
        for lang, data in languages.items():
            data['lang'] = lang
            result.append(data)
        return result
예제 #8
0
 def display_name(self):
     languages = ''
     if self.role_descriptor == 'SP':
         path = [addns('SPSSODescriptor'), addns('Extensions'),
                 addns('UIInfo', MDUI_NAMESPACE),
                 addns('DisplayName', MDUI_NAMESPACE)]
     else:
         path = [addns('IDPSSODescriptor'), addns('Extensions'),
                 addns('UIInfo', MDUI_NAMESPACE),
                 addns('DisplayName', MDUI_NAMESPACE)]
     displays = self.etree.findall('/'.join(path))
     for dn_node in displays:
         lang = getlang(dn_node)
         if lang is None:
             continue  # the lang attribute is required
         if lang == 'en':
             languages = dn_node.text
     if languages == '' and len(displays) > 0:
         languages = displays[0].text
     return languages
예제 #9
0
    def logos(self):
        languages = {}
        path = [addns('SPSSODescriptor'), addns('Extensions'),
                addns('UIInfo', MDUI_NAMESPACE),
                addns('Logo', MDUI_NAMESPACE)]
        for logo_node in self.etree.findall('/'.join(path)):
            lang = getlang(logo_node)
            if lang is None:
                continue  # the lang attribute is required

            lang_dict = languages.setdefault(lang, {})
            lang_dict['width'] = logo_node.attrib.get('width', '')
            lang_dict['height'] = logo_node.attrib.get('height', '')
            lang_dict['location'] = logo_node.text

        result = []
        for lang, data in languages.items():
            data['lang'] = lang
            result.append(data)

        return result
예제 #10
0
파일: models.py 프로젝트: Emergya/peer
 def store_spcategory_database(self, metadata=None):
     if metadata is None:
         metadata = self._load_metadata()
     if (metadata.has_categories_el() or
             metadata.has_assurance_certification_el()):
         sp_cats, created = SPEntityCategory.objects.get_or_create(entity=self)
     else:
         return
     if metadata.has_categories_el():
         categories = metadata.sp_categories
         sp_cats.research_and_scholarship = SP_CATEGORIES['R&S'] in categories
         sp_cats.code_of_conduct = SP_CATEGORIES['CoCo'] in categories
         sp_cats.research_and_education = SP_CATEGORIES['R&E'] in categories
         sp_cats.rae_hei_service = SP_CATEGORIES['HEI'] in categories
         sp_cats.rae_nren_service = SP_CATEGORIES['NREN'] in categories
         sp_cats.rae_eu_protection = SP_CATEGORIES['EU'] in categories
         sp_cats.swamid_sfs = SP_CATEGORIES['SFS'] in categories
         if sp_cats.code_of_conduct:
             lang, psu = self.privacy_statement_url
             sp_cats.coc_priv_statement_url = psu
             sp_cats.lang_priv_statement_url = getlang(psu)
     self._store_certifications_database(metadata, sp_cats)
     sp_cats.save()
예제 #11
0
파일: models.py 프로젝트: pombredanne/peer
    def logos(self):
        languages = {}
        path = [
            addns("SPSSODescriptor"),
            addns("Extensions"),
            addns("UIInfo", MDUI_NAMESPACE),
            addns("Logo", MDUI_NAMESPACE),
        ]
        for logo_node in self.etree.findall("/".join(path)):
            lang = getlang(logo_node)
            if lang is None:
                continue  # the lang attribute is required

            lang_dict = languages.setdefault(lang, {})
            lang_dict["width"] = logo_node.attrib.get("width", "")
            lang_dict["height"] = logo_node.attrib.get("height", "")
            lang_dict["location"] = logo_node.text

        result = []
        for lang, data in languages.items():
            data["lang"] = lang
            result.append(data)

        return result
예제 #12
0
    def logos(self):
        languages = {}
        path = [
            addns('SPSSODescriptor'),
            addns('Extensions'),
            addns('UIInfo', MDUI_NAMESPACE),
            addns('Logo', MDUI_NAMESPACE)
        ]
        for logo_node in self.etree.findall('/'.join(path)):
            lang = getlang(logo_node)
            if lang is None:
                continue  # the lang attribute is required

            lang_dict = languages.setdefault(lang, {})
            lang_dict['width'] = logo_node.attrib.get('width', '')
            lang_dict['height'] = logo_node.attrib.get('height', '')
            lang_dict['location'] = logo_node.text

        result = []
        for lang, data in languages.items():
            data['lang'] = lang
            result.append(data)

        return result