Closed fabiankirstein closed 9 years ago
ignore_missing is the wrong validator for fluent text fields.
Try setting "required": false
instead.
I tried this too and it does not do the trick.
This definitely works in our schema, e.g. https://github.com/open-data/ckanext-canada/blob/wet4-scheming/ckanext/canada/schemas/raw.json#L2599-L2610 Can you try it without the "validators" specified?
Also, please paste the full traceback, not just the error message
I removed the validators already.
URL: http://xubuntu:5000/dataset/hallo
File '/home/john/dev/eodp/local/lib/python2.7/site-packages/weberror/evalexception.py', line 431 in respond
app_iter = self.application(environ, detect_start_response)
File '/home/john/dev/eodp/local/lib/python2.7/site-packages/webob/dec.py', line 147 in __call__
resp = self.call_func(req, *args, **self.kwargs)
File '/home/john/dev/eodp/local/lib/python2.7/site-packages/webob/dec.py', line 208 in call_func
return self.func(req, *args, **kwargs)
File '/home/john/dev/eodp/local/lib/python2.7/site-packages/fanstatic/publisher.py', line 234 in __call__
return request.get_response(self.app)
File '/home/john/dev/eodp/local/lib/python2.7/site-packages/webob/request.py', line 1053 in get_response
application, catch_exc_info=False)
File '/home/john/dev/eodp/local/lib/python2.7/site-packages/webob/request.py', line 1022 in call_application
app_iter = application(self.environ, start_response)
File '/home/john/dev/eodp/local/lib/python2.7/site-packages/webob/dec.py', line 147 in __call__
resp = self.call_func(req, *args, **self.kwargs)
File '/home/john/dev/eodp/local/lib/python2.7/site-packages/webob/dec.py', line 208 in call_func
return self.func(req, *args, **kwargs)
File '/home/john/dev/eodp/local/lib/python2.7/site-packages/fanstatic/injector.py', line 54 in __call__
response = request.get_response(self.app)
File '/home/john/dev/eodp/local/lib/python2.7/site-packages/webob/request.py', line 1053 in get_response
application, catch_exc_info=False)
File '/home/john/dev/eodp/local/lib/python2.7/site-packages/webob/request.py', line 1022 in call_application
app_iter = application(self.environ, start_response)
File '/home/john/dev/eodp/local/lib/python2.7/site-packages/beaker/middleware.py', line 73 in __call__
return self.app(environ, start_response)
File '/home/john/dev/eodp/local/lib/python2.7/site-packages/beaker/middleware.py', line 155 in __call__
return self.wrap_app(environ, session_start_response)
File '/home/john/dev/eodp/local/lib/python2.7/site-packages/routes/middleware.py', line 131 in __call__
response = self.app(environ, start_response)
File '/home/john/dev/eodp/local/lib/python2.7/site-packages/pylons/wsgiapp.py', line 125 in __call__
response = self.dispatch(controller, environ, start_response)
File '/home/john/dev/eodp/local/lib/python2.7/site-packages/pylons/wsgiapp.py', line 324 in dispatch
return controller(environ, start_response)
File '/home/john/dev/eodp/src/ckan/ckan/lib/base.py', line 338 in __call__
res = WSGIController.__call__(self, environ, start_response)
File '/home/john/dev/eodp/local/lib/python2.7/site-packages/pylons/controllers/core.py', line 221 in __call__
response = self._dispatch_call()
File '/home/john/dev/eodp/local/lib/python2.7/site-packages/pylons/controllers/core.py', line 172 in _dispatch_call
response = self._inspect_call(func)
File '/home/john/dev/eodp/local/lib/python2.7/site-packages/pylons/controllers/core.py', line 107 in _inspect_call
result = self._perform_call(func, args)
File '/home/john/dev/eodp/local/lib/python2.7/site-packages/pylons/controllers/core.py', line 60 in _perform_call
return func(**args)
File '/home/john/dev/eodp/src/ckan/ckan/controllers/package.py', line 424 in read
extra_vars={'dataset_type': package_type})
File '/home/john/dev/eodp/src/ckan/ckan/lib/base.py', line 217 in render
loader_class=loader_class)
File '/home/john/dev/eodp/local/lib/python2.7/site-packages/pylons/templating.py', line 249 in cached_template
return render_func()
File '/home/john/dev/eodp/src/ckan/ckan/lib/base.py', line 155 in render_template
return render_jinja2(template_name, globs)
File '/home/john/dev/eodp/src/ckan/ckan/lib/base.py', line 104 in render_jinja2
return template.render(**extra_vars)
File '/home/john/dev/eodp/local/lib/python2.7/site-packages/jinja2/environment.py', line 894 in render
return self.environment.handle_exception(exc_info, True)
File '/home/john/dev/eodp/src/ckanext-scheming/ckanext/scheming/templates/scheming/package/read.html', line 3 in top-level template code
{%- set schema = h.scheming_get_dataset_schema(dataset_type) -%}
File '/home/john/dev/eodp/src/ckan/ckan/templates/package/read.html', line 3 in top-level template code
{% set pkg = c.pkg_dict %}
File '/home/john/dev/eodp/src/ckanext-eodp/ckanext/eodp/templates/package/read_base.html', line 1 in top-level template code
{% ckan_extends %}
File '/home/john/dev/eodp/src/ckan/ckan/templates/package/read_base.html', line 1 in top-level template code
{% extends "package/base.html" %}
File '/home/john/dev/eodp/src/ckan/ckan/templates/package/base.html', line 3 in top-level template code
{% set pkg = c.pkg_dict or pkg_dict %}
File '/home/john/dev/eodp/src/ckan/ckan/templates/page.html', line 1 in top-level template code
{% extends "base.html" %}
File '/home/john/dev/eodp/src/ckanext-eodp/ckanext/eodp/templates/base.html', line 1 in top-level template code
{% ckan_extends %}
File '/home/john/dev/eodp/src/ckan/ckan/templates/base.html', line 103 in top-level template code
{%- block page %}{% endblock -%}
File '/home/john/dev/eodp/src/ckan/ckan/templates/page.html', line 19 in block "page"
{%- block content %}
File '/home/john/dev/eodp/src/ckan/ckan/templates/page.html', line 22 in block "content"
{% block main_content %}
File '/home/john/dev/eodp/src/ckan/ckan/templates/page.html', line 57 in block "main_content"
{% block primary %}
File '/home/john/dev/eodp/src/ckan/ckan/templates/page.html', line 70 in block "primary"
{% block primary_content %}
File '/home/john/dev/eodp/src/ckan/ckan/templates/page.html', line 90 in block "primary_content"
{% block primary_content_inner %}
File '/home/john/dev/eodp/src/ckan/ckan/templates/package/read.html', line 44 in block "primary_content_inner"
{% block package_additional_info %}
File '/home/john/dev/eodp/src/ckanext-scheming/ckanext/scheming/templates/scheming/package/read.html', line 20 in block "package_additional_info"
{% snippet "scheming/package/snippets/additional_info.html",
File '/home/john/dev/eodp/src/ckan/ckan/lib/jinja_extensions.py', line 255 in _call
return base.render_snippet(args[0], **kwargs)
File '/home/john/dev/eodp/src/ckan/ckan/lib/base.py', line 79 in render_snippet
renderer='snippet')
File '/home/john/dev/eodp/src/ckan/ckan/lib/base.py', line 217 in render
loader_class=loader_class)
File '/home/john/dev/eodp/local/lib/python2.7/site-packages/pylons/templating.py', line 249 in cached_template
return render_func()
File '/home/john/dev/eodp/src/ckan/ckan/lib/base.py', line 155 in render_template
return render_jinja2(template_name, globs)
File '/home/john/dev/eodp/src/ckan/ckan/lib/base.py', line 104 in render_jinja2
return template.render(**extra_vars)
File '/home/john/dev/eodp/local/lib/python2.7/site-packages/jinja2/environment.py', line 894 in render
return self.environment.handle_exception(exc_info, True)
File '/home/john/dev/eodp/src/ckanext-scheming/ckanext/scheming/templates/scheming/package/snippets/additional_info.html', line 3 in top-level template code
{%- set exclude_fields = [
File '/home/john/dev/eodp/src/ckanext-eodp/ckanext/eodp/templates/package/snippets/additional_info.html', line 1 in top-level template code
{% ckan_extends %}
File '/home/john/dev/eodp/src/ckan/ckan/templates/package/snippets/additional_info.html', line 11 in top-level template code
{% block package_additional_info %}
File '/home/john/dev/eodp/src/ckanext-scheming/ckanext/scheming/templates/scheming/package/snippets/additional_info.html', line 22 in block "package_additional_info"
}}"{% endif %}>{%- snippet 'scheming/snippets/display_field.html',
File '/home/john/dev/eodp/src/ckan/ckan/lib/jinja_extensions.py', line 255 in _call
return base.render_snippet(args[0], **kwargs)
File '/home/john/dev/eodp/src/ckan/ckan/lib/base.py', line 79 in render_snippet
renderer='snippet')
File '/home/john/dev/eodp/src/ckan/ckan/lib/base.py', line 217 in render
loader_class=loader_class)
File '/home/john/dev/eodp/local/lib/python2.7/site-packages/pylons/templating.py', line 249 in cached_template
return render_func()
File '/home/john/dev/eodp/src/ckan/ckan/lib/base.py', line 155 in render_template
return render_jinja2(template_name, globs)
File '/home/john/dev/eodp/src/ckan/ckan/lib/base.py', line 104 in render_jinja2
return template.render(**extra_vars)
File '/home/john/dev/eodp/local/lib/python2.7/site-packages/jinja2/environment.py', line 894 in render
return self.environment.handle_exception(exc_info, True)
File '/home/john/dev/eodp/src/ckanext-scheming/ckanext/scheming/templates/scheming/snippets/display_field.html', line 18 in top-level template code
{%- snippet display_snippet, field=field, data=data, errors=errors,
File '/home/john/dev/eodp/src/ckan/ckan/lib/jinja_extensions.py', line 255 in _call
return base.render_snippet(args[0], **kwargs)
File '/home/john/dev/eodp/src/ckan/ckan/lib/base.py', line 79 in render_snippet
renderer='snippet')
File '/home/john/dev/eodp/src/ckan/ckan/lib/base.py', line 217 in render
loader_class=loader_class)
File '/home/john/dev/eodp/local/lib/python2.7/site-packages/pylons/templating.py', line 249 in cached_template
return render_func()
File '/home/john/dev/eodp/src/ckan/ckan/lib/base.py', line 155 in render_template
return render_jinja2(template_name, globs)
File '/home/john/dev/eodp/src/ckan/ckan/lib/base.py', line 104 in render_jinja2
return template.render(**extra_vars)
File '/home/john/dev/eodp/local/lib/python2.7/site-packages/jinja2/environment.py', line 894 in render
return self.environment.handle_exception(exc_info, True)
File '/home/john/dev/eodp/src/ckanext-fluent/ckanext/fluent/templates/scheming/display_snippets/fluent_text.html', line 5 in top-level template code
{%- if values.get(lang) -%}
File '/home/john/dev/eodp/local/lib/python2.7/site-packages/jinja2/environment.py', line 372 in getattr
return getattr(obj, attribute)
UndefinedError: 'dict object' has no attribute u'books'
interesting. Would you paste a
ckanapi action package_show id=<your package id>
Sure!
{
"help": "http://xubuntu:5000/api/3/action/help_show?name=package_show",
"success": true,
"result":
{
"maintainer": "",
"relationships_as_object": [ ],
"private": false,
"maintainer_email": "",
"num_tags": 0,
"id": "7d862d33-3e48-4b26-84e7-86994f3de106",
"metadata_created": "2015-03-30T14:38:17.795874",
"metadata_modified": "2015-03-30T15:39:23.981017",
"author": "",
"author_email": "",
"state": "active",
"version": "",
"test": "{\"en\":\"kaulquappe\"}",
"creator_user_id": "bfefdee0-d973-409b-b10b-4586718ec2d4",
"type": "dataset",
"resources":
[
{
"cache_last_updated": null,
"package_id": "7d862d33-3e48-4b26-84e7-86994f3de106",
"webstore_last_updated": null,
"id": "a59ec273-94c4-4096-81d5-b62ac07629a1",
"size": null,
"state": "active",
"hash": "",
"description": "",
"format": "",
"tracking_summary":
{
"total": 0,
"recent": 0
},
"last_modified": null,
"url_type": null,
"mimetype": null,
"cache_url": null,
"name": "",
"created": "2015-03-30T16:38:22.477966",
"url": "http://www.ocdirectory.org/",
"webstore_url": null,
"mimetype_inner": null,
"position": 0,
"revision_id": "54ce1b3b-3528-4260-9d21-df448f4334fb",
"resource_type": null
}
],
"num_resources": 1,
"tags": [ ],
"tracking_summary":
{
"total": 0,
"recent": 0
},
"groups": [ ],
"license_id": "notspecified",
"relationships_as_subject": [ ],
"organization": null,
"name": "hallo",
"isopen": false,
"url": "",
"notes": "",
"license_title": "License not specified",
"title": "Hallo",
"revision_id": "b195c71d-4bdb-44da-ab3d-a6f7d438e270"
}
}
Let me know if #8 resolves this
I added a multi-language field to the existing default dataset schema, but I want to have it optional:
However with this settings I cannot add the values and I get the following error for newly created and existing datasets:
Is it possible to have a language-aware field optional? Thank you!