New schema for attachments, using propertyschema/valueschema.
This commit is contained in:
@@ -6,3 +6,23 @@ _file_embedded_schema = {
|
|||||||
'embeddable': True
|
'embeddable': True
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_attachments_embedded_schema = {
|
||||||
|
'type': 'dict',
|
||||||
|
# TODO: will be renamed to 'keyschema' in Cerberus 1.0
|
||||||
|
'propertyschema': {
|
||||||
|
'type': 'string',
|
||||||
|
'regex': '^[a-zA-Z0-9_ ]+$',
|
||||||
|
},
|
||||||
|
'valueschema': {
|
||||||
|
'type': 'dict',
|
||||||
|
'schema': {
|
||||||
|
'oid': 'objectid',
|
||||||
|
'collection': {
|
||||||
|
'type': 'string',
|
||||||
|
'allowed': ['files'],
|
||||||
|
'default': 'files',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
from pillar.api.node_types import _file_embedded_schema
|
from pillar.api.node_types import _file_embedded_schema, _attachments_embedded_schema
|
||||||
|
|
||||||
node_type_asset = {
|
node_type_asset = {
|
||||||
'name': 'asset',
|
'name': 'asset',
|
||||||
@@ -27,26 +27,7 @@ node_type_asset = {
|
|||||||
# We point to the original file (and use it to extract any relevant
|
# We point to the original file (and use it to extract any relevant
|
||||||
# variation useful for our scope).
|
# variation useful for our scope).
|
||||||
'file': _file_embedded_schema,
|
'file': _file_embedded_schema,
|
||||||
'attachments': {
|
'attachments': _attachments_embedded_schema,
|
||||||
'type': 'list',
|
|
||||||
'schema': {
|
|
||||||
'type': 'dict',
|
|
||||||
'schema': {
|
|
||||||
'field': {'type': 'string'},
|
|
||||||
'files': {
|
|
||||||
'type': 'list',
|
|
||||||
'schema': {
|
|
||||||
'type': 'dict',
|
|
||||||
'schema': {
|
|
||||||
'file': _file_embedded_schema,
|
|
||||||
'slug': {'type': 'string', 'minlength': 1},
|
|
||||||
'size': {'type': 'string'}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
# Tags for search
|
# Tags for search
|
||||||
'tags': {
|
'tags': {
|
||||||
'type': 'list',
|
'type': 'list',
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
from pillar.api.node_types import _file_embedded_schema
|
from pillar.api.node_types import _attachments_embedded_schema
|
||||||
|
|
||||||
node_type_page = {
|
node_type_page = {
|
||||||
'name': 'page',
|
'name': 'page',
|
||||||
@@ -22,26 +22,7 @@ node_type_page = {
|
|||||||
'url': {
|
'url': {
|
||||||
'type': 'string'
|
'type': 'string'
|
||||||
},
|
},
|
||||||
'attachments': {
|
'attachments': _attachments_embedded_schema,
|
||||||
'type': 'list',
|
|
||||||
'schema': {
|
|
||||||
'type': 'dict',
|
|
||||||
'schema': {
|
|
||||||
'field': {'type': 'string'},
|
|
||||||
'files': {
|
|
||||||
'type': 'list',
|
|
||||||
'schema': {
|
|
||||||
'type': 'dict',
|
|
||||||
'schema': {
|
|
||||||
'file': _file_embedded_schema,
|
|
||||||
'slug': {'type': 'string', 'minlength': 1},
|
|
||||||
'size': {'type': 'string'}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
'form_schema': {
|
'form_schema': {
|
||||||
'attachments': {'visible': False},
|
'attachments': {'visible': False},
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
from pillar.api.node_types import _file_embedded_schema
|
from pillar.api.node_types import _attachments_embedded_schema
|
||||||
|
|
||||||
node_type_post = {
|
node_type_post = {
|
||||||
'name': 'post',
|
'name': 'post',
|
||||||
@@ -26,26 +26,7 @@ node_type_post = {
|
|||||||
'url': {
|
'url': {
|
||||||
'type': 'string'
|
'type': 'string'
|
||||||
},
|
},
|
||||||
'attachments': {
|
'attachments': _attachments_embedded_schema,
|
||||||
'type': 'list',
|
|
||||||
'schema': {
|
|
||||||
'type': 'dict',
|
|
||||||
'schema': {
|
|
||||||
'field': {'type': 'string'},
|
|
||||||
'files': {
|
|
||||||
'type': 'list',
|
|
||||||
'schema': {
|
|
||||||
'type': 'dict',
|
|
||||||
'schema': {
|
|
||||||
'file': _file_embedded_schema,
|
|
||||||
'slug': {'type': 'string', 'minlength': 1},
|
|
||||||
'size': {'type': 'string'}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
'form_schema': {
|
'form_schema': {
|
||||||
'attachments': {'visible': False},
|
'attachments': {'visible': False},
|
||||||
|
Reference in New Issue
Block a user