Skip to content

Commit

Permalink
Merge branch '606-nice-error-on-no-resource'
Browse files Browse the repository at this point in the history
  • Loading branch information
Sean Hammond committed Apr 12, 2013
2 parents bfc96b7 + 60fb73f commit 5354769
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
13 changes: 10 additions & 3 deletions ckan/controllers/package.py
Expand Up @@ -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))
Expand Down
1 change: 1 addition & 0 deletions ckan/lib/app_globals.py
Expand Up @@ -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'},
Expand Down

0 comments on commit 5354769

Please sign in to comment.