def db_to_form_schema(self): schema = package_form_schema() schema.update({ 'tags': { '__extras': [keep_extras, free_tags_only] }, 'vocab_tags_selected': [convert_from_tags(TEST_VOCAB_NAME), ignore_missing], }) 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. """ schema = package_form_schema() schema.update({ 'published_by': [ignore_missing, unicode, convert_to_extras], 'genre_tags': [ignore_missing, convert_to_tags(GENRE_VOCAB)], 'composer_tags': [ignore_missing, convert_to_tags(COMPOSER_VOCAB)] }) return schema
def _check_data_dict(self, data_dict): '''Check if the return data is correct, mostly for checking out if spammers are submitting only part of the form''' surplus_keys_schema = ['__extras', '__junk', 'state', 'groups', 'extras_validation', 'save', 'preview', 'return_to'] schema_keys = package_form_schema().keys() keys_in_schema = set(schema_keys) - set(surplus_keys_schema) if keys_in_schema - set(data_dict.keys()): log.info('incorrect form fields posted') raise DataError(data_dict)
def _check_data_dict(self, data_dict): '''Check if the return data is correct, mostly for checking out if spammers are submitting only part of the form''' # Resources might not exist yet (eg. Add Dataset) surplus_keys_schema = ['__extras', '__junk', 'state', 'groups', 'extras_validation', 'save', 'return_to', 'resources'] schema_keys = package_form_schema().keys() keys_in_schema = set(schema_keys) - set(surplus_keys_schema) missing_keys = keys_in_schema - set(data_dict.keys()) if missing_keys: #print data_dict #print missing_keys log.info('incorrect form fields posted') raise DataError(data_dict)
def db_to_form_schema(self): """ Returns the schema for mapping package data from the database into a format suitable for the form (optional) """ schema = package_form_schema() schema.update({ 'tags': { '__extras': [keep_extras, free_tags_only] }, 'genre_tags_selected': [convert_from_tags(GENRE_VOCAB), ignore_missing], 'composer_tags_selected': [convert_from_tags(COMPOSER_VOCAB), ignore_missing], 'published_by': [convert_from_extras, ignore_missing], }) schema['groups'].update({ 'name': [not_empty, unicode], 'title': [ignore_missing] }) return schema
def db_to_form_schema(self): schema = package_form_schema() # Configuration to get working the extension schema.update({ 'id': [ignore_missing, unicode], 'isopen': [ignore_missing], }) schema['groups'].update({ 'name': [not_empty, unicode], 'title': [ignore_missing], 'capacity': [ignore_missing, unicode] }) # SourcePlanet customization schema.update({ 'dataset_type': [ignore_missing], 'evaluations': evaluation_model, }) return schema
def db_to_form_schema(self): """ Returns the schema for mapping package data from the database into a format suitable for the form (optional) """ schema = package_form_schema() schema.update({ 'tags': { '__extras': [keep_extras, free_tags_only] }, 'genre_tags_selected': [ convert_from_tags(GENRE_VOCAB), ignore_missing ], 'composer_tags_selected': [ convert_from_tags(COMPOSER_VOCAB), ignore_missing ], 'published_by': [convert_from_extras, ignore_missing], }) schema['groups'].update({ 'name': [not_empty, unicode], 'title': [ignore_missing] }) 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. """ return package_form_schema()
def _form_to_db_schema(self): return package_form_schema()
def form_to_db_schema(self): schema = package_form_schema() schema.update({ 'vocab_tags': [ignore_missing, convert_to_tags(TEST_VOCAB_NAME)], }) return schema