Ticket #344 (closed defect: fixed)

Opened 4 years ago

Last modified 4 years ago

REST Create package with incorrect format gives 500 error

Reported by: dread Owned by:
Priority: awaiting triage Milestone:
Component: ckan Keywords:
Cc: Repository:


PUT to /rest/api/package of {"name": "name", "resources": ["someurl.com/data"] } (i.e. resource is a string, not a dictionary) gives 500 error, when it should give a 400 error and helpful error message.


Module ckan.controllers.rest:154 in create
<<              if register == 'package' and not subregister:
                       fs = ckan.forms.get_standard_fieldset()
                       request_fa_dict = ckan.forms.edit_package_dict(ckan.forms.get_package_dict(fs=fs), request_data)
                       fs = fs.bind(model.Package, data=request_fa_dict, session=model.Session)
                   elif register == 'package' and subregister in model.PackageRelationship.get_all_types():
>>  request_fa_dict = ckan.forms.edit_package_dict(ckan.forms.get_package_dict(fs=fs), request_data)
Module ckan.forms.package_dict:88 in edit_package_dict
<<                      for res_dict in value:
                               res_dict_str = {}
                               for key, value in res_dict.items():
                                   res_dict_str[str(key)] = value
>>  for key, value in res_dict.items():
AttributeError: 'unicode' object has no attribute 'items'

Change History

comment:1 Changed 4 years ago by dread

  • Status changed from new to closed
  • Resolution set to fixed

Done in cset:13737a7ba4d9

Note: See TracTickets for help on using tickets.