Esempio n. 1
0
    def _modify_package_schema(self, schema):

        ##
        # Getting custom package schema
        ##

        for field in dcatapit_schema.get_custom_package_schema():
            if 'ignore' in field and field['ignore'] == True:
                continue

            if 'couples' in field:
                for couple in field['couples']:
                    self.update_schema_field(schema, couple)
            else:
                self.update_schema_field(schema, field)

        schema.update({'notes': [toolkit.get_validator('not_empty')]})

        ##
        # Getting custom resource schema
        ##

        for field in dcatapit_schema.get_custom_resource_schema():
            if 'ignore' in field and field['ignore'] == True:
                continue

            validators = []
            for validator in field['validator']:
                validators.append(toolkit.get_validator(validator))

            schema['resources'].update({field['name']: validators})

        log.debug("Schema updated for DCAT_AP-TI:  %r", schema)

        return schema
Esempio n. 2
0
    def show_package_schema(self):
        schema = super(DCATAPITPackagePlugin, self).show_package_schema()
        
        ##
        # Getting custom package schema
        ##

        for field in dcatapit_schema.get_custom_package_schema():
            if 'ignore' in field and field['ignore'] == True:
                continue

            if 'couples' in field:
                for couple in field['couples']:
                    self.update_show_schema_field(schema, couple)
            else:
                self.update_show_schema_field(schema, field)

        schema.update({
            'notes': [
                toolkit.get_validator('not_empty')
            ]
        })

        ##
        # Getting custom resource schema
        ##

        for field in dcatapit_schema.get_custom_resource_schema():
            if 'ignore' in field and field['ignore'] == True:
                continue

            validators = []
            for validator in field['validator']:
                validators.append(toolkit.get_validator(validator))

            schema['resources'].update({
                field['name']: validators
            })


        # conditionally include schema fields from MultilangResourcesPlugin
        if MLR:
            schema = MLR.update_schema(schema)
        
        log.debug("Schema updated for DCAT_AP-TI:  %r", schema)

        return schema
Esempio n. 3
0
    def _modify_package_schema(self, schema):
        # Package schema
        for field in dcatapit_schema.get_custom_package_schema():
            if field.get('ignore'):
                continue

            if 'couples' in field:
                for couple in field['couples']:
                    self._update_schema_field(schema, couple)
            else:
                self._update_schema_field(schema, field)

        schema['notes'] = [toolkit.get_validator('not_empty')]

        # ignore theme extra fields
        junk = schema.get('__junk', [])
        junk.append(toolkit.get_validator('dcatapit_remove_theme'))
        schema['__junk'] = junk

        # Resource schema
        for field in dcatapit_schema.get_custom_resource_schema():
            if field.get('ignore'):
                continue

            validators = []
            for validator in field['validator']:
                validators.append(toolkit.get_validator(validator))

            schema['resources'].update({
                field['name']: validators
            })

        # conditionally include schema fields from MultilangResourcesPlugin
        if MLR:
            schema = MLR.update_schema(schema)

        return schema
def get_dcatapit_resource_schema():
    log.debug('Retrieving DCAT-AP_IT resource schema fields...')
    return dcatapit_schema.get_custom_resource_schema()