def deposits_create(): """Record creation page.""" forms_config = dict(apiUrl='/api/records/', vocabularies=dump_vocabularies(Vocabulary)) searchbar_config = dict(searchUrl='/search') empty_record = dump_empty(MetadataSchemaV1) return render_template(current_app.config['DEPOSITS_FORMS_BASE_TEMPLATE'], forms_config=forms_config, record=empty_record, searchbar_config=searchbar_config)
def deposits_create(): """Record creation page.""" forms_config = dict( createUrl=("/api/records"), vocabularies=Vocabularies.dump(), ) return render_template( current_app.config['DEPOSITS_FORMS_BASE_TEMPLATE'], forms_config=forms_config, record=dump_empty(MetadataSchemaV1), searchbar_config=dict(searchUrl=search_url))
def deposits_edit(id): """Fake deposits edit page.""" forms_config = dict(apiUrl='/api/records/', vocabularies=dump_vocabularies(Vocabulary)) # minimal record record = { "_access": { "metadata_restricted": False, "files_restricted": False }, "_owners": [1], "_created_by": 1, "access_right": "open", "id": "{}".format(id), "resource_type": { "type": "image", "subtype": "image-photo" }, # Technically not required "creators": [], "titles": [{ "title": "A Romans story", "type": "Other", "lang": "eng" }], "links": { "edit": "/deposits/{}/edit".format(id) } } searchbar_config = dict(searchUrl='/search') initial_record = dump_empty(MetadataSchemaV1) initial_record.update(record) return render_template(current_app.config['DEPOSITS_FORMS_BASE_TEMPLATE'], forms_config=forms_config, record=initial_record, searchbar_config=searchbar_config)
def test_dumping_empty_record(): empty_record = dump_empty(MetadataSchemaV1()) assert empty_record == { '_access': {'files_restricted': None, 'metadata_restricted': None}, '_default_preview': None, '_communities': None, '_contact': None, '_created_by': None, '_embargo_date': None, '_files': [ { 'bucket': None, 'checksum': None, 'key': None, 'links': None, 'size': None, 'type': None } ], '_internal_notes': [ { 'user': None, 'timestamp': None, 'note': None } ], '_owners': [None], 'access_right': None, 'contributors': [ { 'affiliations': [ { 'name': None, 'identifiers': None, } ], 'family_name': None, 'given_name': None, 'identifiers': None, 'name': None, 'role': None, 'type': None, } ], 'creators': [ { 'affiliations': [ { 'name': None, 'identifiers': None, } ], 'family_name': None, 'given_name': None, 'identifiers': None, 'name': None, 'type': None, } ], 'dates': [ { 'type': None, 'end': None, 'description': None, 'start': None } ], 'extensions': None, 'descriptions': [ { 'type': None, 'lang': None, 'description': None } ], 'language': None, 'locations': [ { 'description': None, 'point': { 'lon': None, 'lat': None }, 'place': None } ], 'licenses': [ { 'identifier': None, 'scheme': None, 'uri': None, 'license': None } ], 'version': None, 'publication_date': None, 'references': [ { 'scheme': None, 'reference_string': None, 'identifier': None } ], 'related_identifiers': [ { 'resource_type': { 'subtype': None, 'type': None }, 'scheme': None, 'relation_type': None, 'identifier': None } ], 'resource_type': { 'subtype': None, 'type': None }, 'subjects': [{'subject': None, 'identifier': None, 'scheme': None}], 'titles': [ { 'type': None, 'lang': None, 'title': None } ], # TODO: Investigate the impact of these 2 fields on # frontend to backend to frontend flow 'identifiers': None, 'recid': None }