Esempio n. 1
0
 def form_to_db_schema(self):
     """
     Returns the schema for mapping package data from a form to a format
     suitable for the database.
     """
     schema = form_to_db_package_schema()
     schema.update({
         'license_id': [not_empty],
         'Titolare': [not_empty, convert_to_extras],
         'Descrizione campi': [not_empty, convert_to_extras],
         'Categorie': [ignore_missing, convert_to_tags(CATEGORY_VOCAB)],
         'Copertura Geografica': [not_empty, convert_to_extras],
         'Copertura Temporale (Data di inizio)': [not_empty, convert_to_extras, date_to_db],
         'Copertura Temporale (Data di fine)': [convert_to_extras, date_to_db],
         'Aggiornamento': [not_empty, convert_to_extras],
         'Data di pubblicazione': [not_empty, convert_to_extras, date_to_db],
         'Data di aggiornamento': [not_empty, convert_to_extras, date_to_db],
         'Codifica Caratteri': [not_empty, convert_to_extras],
         'Data di creazione': [convert_to_extras],
         'URL sito': [convert_to_extras],
         'maintainer': [not_empty, unicode],
         'maintainer_email': [not_empty, unicode],
     })
     schema['groups']['capacity'] = [ignore_missing, unicode]
     return schema
    def form_to_db_schema(self):
        """Returns the schema for mapping package data from a form to 
        a format suitable for the database. A schema is a list that describes
        a dataset. See ``ckan.logic.schema``
        """
        schema = ckan_schema.form_to_db_package_schema()
#        schema = package_form_schema()
#        schema.update({
#            'published_by': [unicode],
#            'genre_tags': [convert_to_tags(GENRE_VOCAB)],
#            'composer_tags': [convert_to_tags(COMPOSER_VOCAB)]
#        })
        return schema
Esempio n. 3
0
    def form_to_db_schema_options(self, package_type=None, options=None):
        schema = form_to_db_package_schema()
        for key in self.kata_fields_required:
            schema[key] = [not_empty, self.convert_to_extras_kata, unicode]
        for key in self.kata_fields_recommended:
            schema[key] = [ignore_missing, self.convert_to_extras_kata, unicode]
        schema['temporal_coverage_begin'].append(validate_lastmod)
        schema['temporal_coverage_end'].append(validate_lastmod)
        schema['language'] = [validate_language, self.convert_to_extras_kata, unicode]
        schema['phone'].append(validate_phonenum)
        schema['maintainer_email'].append(validate_email)
        schema['tag_string'].append(not_empty)
        schema.update({
           'version': [not_empty, unicode, validate_lastmod, check_last_and_update_pid],
           'versionPID': [self.update_pid, unicode, self.pid_to_extras],
           'author': {'value': [not_empty, unicode, org_auth_to_extras]},
           'organization': {'value': [not_empty, unicode, org_auth_to_extras]},
           'access': [not_missing, self.convert_to_extras_kata, validate_access],
           'accessRights': [ignore_missing, self.convert_to_extras_kata, unicode],
           'langdis': [default(False), unicode],
           '__extras': [check_author_org],
           'projdis': [default(False), unicode, check_project],
           '__junk': [check_junk],
           'name': [unicode, ignore_missing, self.update_name],
           'accessRights': [check_accessrights, self.convert_to_extras_kata, unicode],
           'accessrequestURL': [check_accessrequesturl, self.convert_to_extras_kata, unicode],
           'project_name': [check_project_dis, unicode, self.convert_to_extras_kata],
           'funder': [check_project_dis, unicode, self.convert_to_extras_kata],
           'project_funding': [check_project_dis, unicode, self.convert_to_extras_kata],
           'project_homepage': [check_project_dis, unicode, self.convert_to_extras_kata],
           'resources': default_resource_schema(),
           'discipline': [add_to_group],
        })
        schema['title'] = {'value': [not_missing, ltitle_to_extras],
                           'lang': [not_missing]}

        schema['evtype'] = {'value': [ignore_missing, unicode, event_to_extras]}
        schema['evwho'] = {'value': [ignore_missing, unicode, event_to_extras]}
        schema['evwhen'] = {'value': [ignore_missing, unicode, event_to_extras]}
        schema['evdescr'] = {'value': [ignore_missing, unicode, event_to_extras]}
        schema['groups'] = {
                'id': [ignore_missing, unicode],
                'name': [ignore_missing, unicode],
                'title': [ignore_missing, unicode],
                '__extras': [ignore],
            }
        return schema
Esempio n. 4
0
 def form_to_db_schema(self):
     schema = form_to_db_package_schema()
     schema['groups']['capacity'] = [ignore_missing, unicode]
     schema['__after'] = [group_required]
     return schema