Exemplo n.º 1
0
    def before_index(self, data_dict):
        kw = json.loads(data_dict.get('extras_keywords', '{}'))
        data_dict['keywords'] = kw.get('en', [])
        data_dict['keywords_fra'] = kw.get('fr', [])
        data_dict['catalog_type'] = data_dict.get('type', '')

        data_dict['subject'] = json.loads(data_dict.get('subject', '[]'))
        data_dict['topic_category'] = json.loads(
            data_dict.get('topic_category', '[]'))
        try:
            data_dict['spatial_representation_type'] = json.loads(
                data_dict.get('spatial_representation_type'))
        except (TypeError, ValueError):
            data_dict['spatial_representation_type'] = []

        if data_dict.get('portal_release_date'):
            data_dict.pop('ready_to_publish', None)
        elif data_dict.get('ready_to_publish') == 'true':
            data_dict['ready_to_publish'] = 'true'
        else:
            data_dict['ready_to_publish'] = 'false'

        geno = h.recombinant_get_geno(data_dict['type']) or {}
        data_dict['portal_type'] = geno.get('portal_type', data_dict['type'])
        if 'collection' in geno:
            data_dict['collection'] = geno['collection']

        if 'fgp_viewer' in data_dict.get('display_flags', []):
            data_dict['fgp_viewer'] = 'map_view'

        titles = json.loads(data_dict.get('title_translated', '{}'))
        data_dict['title_fr'] = titles.get('fr', '')
        data_dict['title_string'] = titles.get('en', '')
        return data_dict
Exemplo n.º 2
0
    def before_index(self, data_dict):
        kw = json.loads(data_dict.get('extras_keywords', '{}'))
        data_dict['keywords'] = kw.get('en', [])
        data_dict['keywords_fra'] = kw.get('fr', [])
        data_dict['catalog_type'] = data_dict.get('type', '')

        data_dict['subject'] = json.loads(data_dict.get('subject', '[]'))
        data_dict['topic_category'] = json.loads(data_dict.get(
            'topic_category', '[]'))
        try:
            data_dict['spatial_representation_type'] = json.loads(
                data_dict.get('spatial_representation_type')
            )
        except (TypeError, ValueError):
            data_dict['spatial_representation_type'] = []

        if data_dict.get('portal_release_date'):
            data_dict.pop('ready_to_publish', None)
        elif data_dict.get('ready_to_publish') == 'true':
            data_dict['ready_to_publish'] = 'true'
        else:
            data_dict['ready_to_publish'] = 'false'

        geno = h.recombinant_get_geno(data_dict['type']) or {}
        data_dict['portal_type'] = geno.get('portal_type', data_dict['type'])
        if 'collection' in geno:
            data_dict['collection'] = geno['collection']

        if 'fgp_viewer' in data_dict.get('display_flags', []):
            data_dict['fgp_viewer'] = 'map_view'

        return data_dict
Exemplo n.º 3
0
    def before_index(self, data_dict):
        kw = json.loads(data_dict.get("extras_keywords", "{}"))
        data_dict["keywords"] = kw.get("en", [])
        data_dict["keywords_fra"] = kw.get("fr", [])
        data_dict["catalog_type"] = data_dict.get("type", "")

        data_dict["subject"] = json.loads(data_dict.get("subject", "[]"))
        data_dict["topic_category"] = json.loads(data_dict.get("topic_category", "[]"))
        try:
            data_dict["spatial_representation_type"] = json.loads(data_dict.get("spatial_representation_type"))
        except (TypeError, ValueError):
            data_dict["spatial_representation_type"] = []

        if data_dict.get("portal_release_date"):
            data_dict.pop("ready_to_publish", None)
        elif data_dict.get("ready_to_publish") == "true":
            data_dict["ready_to_publish"] = "true"
        else:
            data_dict["ready_to_publish"] = "false"

        geno = h.recombinant_get_geno(data_dict["type"]) or {}
        data_dict["portal_type"] = geno.get("portal_type", data_dict["type"])
        if "collection" in geno:
            data_dict["collection"] = geno["collection"]

        if "fgp_viewer" in data_dict.get("display_flags", []):
            data_dict["fgp_viewer"] = "map_view"

        return data_dict