Beispiel #1
0
    def update(self, dataset_revision, changed_fields, **fields):
        if settings.DEBUG: logger.info('Updating dataset %s' % str(fields))
        builder = DatasetImplBuilderWrapper(changed_fields=changed_fields,
                                            **fields).builder

        # TODO: Fix that
        #if builder.has_changed(changed_fields):
        #    # Build impl_details if necessary
        fields['impl_details'] = builder.build()

        if 'title' in fields:
            fields['title'] = fields['title'].strip().replace('\n', ' ')
        if 'description' in fields:
            fields['description'] = fields['description'].strip().replace(
                '\n', ' ')
        if 'notes' in fields:
            fields['notes'] = fields['notes'].strip()

        changed_fields.append('impl_details')

        dataset_revision.update(changed_fields, **fields)

        DatasetI18n.objects.get(dataset_revision=dataset_revision,
                                language=fields['language']).update(
                                    changed_fields, **fields)

        if 'tags' in fields:
            dataset_revision.add_tags(fields['tags'])
        if 'sources' in fields:
            dataset_revision.add_sources(fields['sources'])

        return dataset_revision
Beispiel #2
0
    def update(self, dataset_revision, changed_fields, **fields):
        if settings.DEBUG: logger.info('Updating dataset %s' % str(fields))
        builder = DatasetImplBuilderWrapper(changed_fields=changed_fields, **fields).builder

        # TODO: Fix that
        #if builder.has_changed(changed_fields):
        #    # Build impl_details if necessary
        fields['impl_details'] = builder.build()

        if 'title' in fields:
            fields['title'] = fields['title'].strip().replace('\n', ' ')
        if 'description' in fields:
            fields['description'] = fields['description'].strip().replace('\n', ' ')
        if 'notes' in fields:
            fields['notes'] = fields['notes'].strip()

        changed_fields.append('impl_details')

        dataset_revision.update(changed_fields, **fields)

        DatasetI18n.objects.get(dataset_revision=dataset_revision, language=fields['language']).update(
            changed_fields, **fields
        )

        if 'tags' in fields:
            dataset_revision.add_tags(fields['tags'])
        if 'sources' in fields:
            dataset_revision.add_sources(fields['sources'])

        return dataset_revision
Beispiel #3
0
    def update(self, dataset_revision, changed_fields, **fields):
        builder = DatasetImplBuilderWrapper(changed_fields=changed_fields, **fields).builder

        # TODO: Fix that
        #if builder.has_changed(changed_fields):
        #    # Build impl_details if necessary
        fields['impl_details'] = builder.build()

        fields['title'] = fields['title'].strip().replace('\n', ' ')
        fields['description'] = fields['description'].strip().replace('\n', ' ')
        fields['notes'] = fields['notes'].strip()

        changed_fields.append('impl_details')

        dataset_revision.update(changed_fields, **fields)

        DatasetI18n.objects.get(dataset_revision=dataset_revision, language=fields['language']).update(
            changed_fields, **fields
        )

        dataset_revision.add_tags(fields['tags'])
        dataset_revision.add_sources(fields['sources'])

        return dataset_revision