def create_harvest_source(self, **kwds): source = create_harvest_source(kwds) return source
self._abort_bad_request() if isinstance(form_data, list): form_data = dict(form_data) # Bind form data to fieldset. try: form_data['HarvestSource--url'] = form_data.get('HarvestSource--url', '').strip() bound_fieldset = fieldset.bind(HarvestSource, data=form_data, session=model.Session) except Exception, error: # Todo: Replace 'Exception' with bind error. self._abort_bad_request() # Validate and save form data. try: source = create_harvest_source({ 'url':form_data['HarvestSource--url'], 'type':form_data['HarvestSource--type'], 'description':form_data['HarvestSource--description'], 'user_id':user_id, 'publisher_id':publisher_id, }) #self._create_harvest_source_entity(bound_fieldset, user_id=user_id, publisher_id=publisher_id) except ValidationException, exception: # Get the errorful fieldset. errorful_fieldset = exception.args[0] # Render the fields. fieldset_html = errorful_fieldset.render() return self._finish(400, fieldset_html) except Exception,e: return self._finish(400, str(e)) else: # Also create a job job = create_harvest_job(source['id'])
form_data['HarvestSource--url'] = form_data.get( 'HarvestSource--url', '').strip() bound_fieldset = fieldset.bind(HarvestSource, data=form_data, session=model.Session) except Exception, error: # Todo: Replace 'Exception' with bind error. self._abort_bad_request() # Validate and save form data. try: source = create_harvest_source({ 'url': form_data['HarvestSource--url'], 'type': form_data['HarvestSource--type'], 'description': form_data['HarvestSource--description'], 'user_id': user_id, 'publisher_id': publisher_id, }) #self._create_harvest_source_entity(bound_fieldset, user_id=user_id, publisher_id=publisher_id) except ValidationException, exception: # Get the errorful fieldset. errorful_fieldset = exception.args[0] # Render the fields. fieldset_html = errorful_fieldset.render() return self._finish(400, fieldset_html) except Exception, e: return self._finish(400, str(e)) else: