okfn/ckan — pull request #581 by amercader (2013-03-07 16:44:25+00:00)
Title: an IPackageController raising a ValidationError during dataset metadata creation causes crash

Steps to reproduce issue:

1. install the spatial extension
2. add a 'spatial' extra field with an IDatasetForm to the fields and make it appear in package_metadata_fields.html
3. create a dataset using the form and leave the spatial field blank

What happens:

CKAN fails with this traceback:
```
Module ckan.controllers.package:697 in new_metadata
>> return self.new_metadata(id, data, errors, error_summary)
Module ckan.controllers.package:721 in new_metadata
>> self._setup_template_variables(context, {},
UnboundLocalError: local variable 'context' referenced before assignment
```

What I expected to happen: An error should be displayed on the spatial field telling me to fill in a valid GeoJSON value.