New data structure for attachments.
This commit is contained in:
@@ -21,8 +21,13 @@ class ValidateCustomFields(Validator):
|
||||
prop_type = schema_prop['type']
|
||||
|
||||
if prop_type == 'dict':
|
||||
properties[prop] = self.convert_properties(
|
||||
properties[prop], schema_prop['schema'])
|
||||
try:
|
||||
dict_valueschema = schema_prop['schema']
|
||||
except KeyError:
|
||||
# TODO: will be renamed to 'keyschema' in Cerberus 1.0
|
||||
dict_valueschema = schema_prop['valueschema']
|
||||
properties[prop] = self.convert_properties(properties[prop], dict_valueschema)
|
||||
|
||||
elif prop_type == 'list':
|
||||
if properties[prop] in ['', '[]']:
|
||||
properties[prop] = []
|
||||
|
@@ -17,7 +17,10 @@ _attachments_embedded_schema = {
|
||||
'valueschema': {
|
||||
'type': 'dict',
|
||||
'schema': {
|
||||
'oid': 'objectid',
|
||||
'oid': {
|
||||
'type': 'objectid',
|
||||
'required': True,
|
||||
},
|
||||
'collection': {
|
||||
'type': 'string',
|
||||
'allowed': ['files'],
|
||||
|
@@ -90,3 +90,10 @@ def create_new_project(project_name, user_id, overrides):
|
||||
log.info('Created project %s for user %s', project['_id'], user_id)
|
||||
|
||||
return project
|
||||
|
||||
|
||||
def get_node_type(project, node_type_name):
|
||||
"""Returns the named node type, or None if it doesn't exist."""
|
||||
|
||||
return next((nt for nt in project['node_types']
|
||||
if nt['name'] == node_type_name), None)
|
||||
|
Reference in New Issue
Block a user