def put(self, *args, **kw): new_model = kw_to_sqlalchemy(model.JobAlchemy, kw) prepare_job_for_address_update(new_model) kw = sqlalchemy_to_kw(new_model) return EasyCrudRestController.put(self, *args, **kw)
def edit(self, *args, **kw): # This is a somewhat ugly solution. There might be a better way to add # a delete button at the end of the edit form, but I haven't found one # so far. res = EasyCrudRestController.edit(self, *args, **kw) res['delete_url'] = '/%s' % tg.request.controller_url return res
def put(self, *args, **kw): new_model = kw_to_sqlalchemy(model.CompanyAlchemy, kw) prepare_company_for_validation(new_model) kw = sqlalchemy_to_kw(new_model) return EasyCrudRestController.put(self, *args, **kw)
def put(self, *args, **kw): old_model = model.CompanyAlchemy.get_company(kw['id']) new_model = kw_to_sqlalchemy(model.CompanyAlchemy, kw) # Check if the address has been modified. If it's the case, then # prepare the kw dict before insertion. if old_model.address != new_model.address: prepare_company_for_address_update(new_model) kw = sqlalchemy_to_kw(new_model) return EasyCrudRestController.put(self, *args, **kw)
def put(self, *args, **kw): # TODO: Could this test be removed if 'publication_datetime_is_fake' # TODO: was False by default and un-nullable if not kw['publication_datetime_is_fake']: kw['publication_datetime_is_fake'] = False old_model = model.JobAlchemy.get_job_offer(kw['id']) new_model = kw_to_sqlalchemy(model.JobAlchemy, kw) # Check if the address has been modified. If it's the case, then # prepare the kw dict before insertion. if old_model.address != new_model.address: prepare_job_for_address_update(new_model) kw = sqlalchemy_to_kw(new_model) return EasyCrudRestController.put(self, *args, **kw)