diff --git a/ckan/controllers/package.py b/ckan/controllers/package.py index 2be958f72ed..85a84e86c64 100644 --- a/ckan/controllers/package.py +++ b/ckan/controllers/package.py @@ -607,9 +607,16 @@ def new_resource(self, id, data=None, errors=None, error_summary=None): abort(401, _('Unauthorized to update dataset')) if not len(data_dict['resources']): # no data so keep on page - h.flash_error(_('You must add at least one data resource')) - redirect(h.url_for(controller='package', - action='new_resource', id=id)) + msg = _('You must add at least one data resource') + # On new templates do not use flash message + if g.legacy_templates: + h.flash_error(msg) + redirect(h.url_for(controller='package', + action='new_resource', id=id)) + else: + errors = {} + error_summary = {_('Error'): msg} + return self.new_resource(id, data, errors, error_summary) # we have a resource so let them add metadata redirect(h.url_for(controller='package', action='new_metadata', id=id)) diff --git a/ckan/lib/app_globals.py b/ckan/lib/app_globals.py index e98f975ca7d..ce32ca74505 100644 --- a/ckan/lib/app_globals.py +++ b/ckan/lib/app_globals.py @@ -57,6 +57,7 @@ 'openid_enabled': {'default': 'true', 'type' : 'bool'}, 'debug': {'default': 'false', 'type' : 'bool'}, 'ckan.debug_supress_header' : {'default': 'false', 'type' : 'bool'}, + 'ckan.legacy_templates' : {'default': 'false', 'type' : 'bool'}, # int 'ckan.datasets_per_page': {'default': '20', 'type': 'int'},