def get_organizer_info(self, activity_data):
     org_details = clean_text(activity_data.get('organiserdetails', ''),
                              strip_newlines=True,
                              parse_html=True)
     reg_details = clean_text(activity_data.get('regdetails', ''),
                              strip_newlines=True,
                              parse_html=True)
     return {
         'fi': f'{reg_details} {org_details}'.strip()
     } if org_details or reg_details else ''
def get_string_from_data(data, field, localized=False):
    value = data.get(field)
    if not isinstance(value, str):
        return None
    value = clean_text(value)
    if not value:
        return None
    return {'fi': value} if localized else value
def get_string_from_data(data, field, localized=False):
    value = data.get(field)
    if not isinstance(value, str):
        return None
    value = clean_text(value)
    if not value:
        return None
    return {'fi': value} if localized else value
Exemple #4
0
 def _get_nested_values(self, data: dict, fields: list):
     value = data.get(fields.pop(0))
     if isinstance(value, dict):
         return self._get_nested_values(data=value, fields=fields)
     elif isinstance(value, list) and value:
         return self._get_nested_values(data=value[0], fields=fields)
     elif not value:
         return ''
     else:
         return clean_text(value)