def braden_scores_delete(request): try: # bradenScores = DBSession.query(BradenScores).get(request.GET['id']) msg = '' data = {} id = int(request.POST['id']) if id <= 0: msg = 'Illegal row id (' + str(id) + ') passed to delete routine' return print "Deleting BradenScores with id = %d" % (id) bradenScores = DBSession.query(BradenScores).get(id) DBSession.delete(bradenScores) DBSession.flush() # DBSession.commit() # Not needed since Pyramid uses the Zope transaction manager print "Delete successful" except exc.SQLAlchemyError as e: print "In braden_scores_delete caught exception of type: " print type(e) msg = str(e) print msg DBSession.rollback() except Exception as e: print "In braden_scores_post caught exception of type: " print type(e) msg = str(e) DBSession.rollback() finally: return {'msg': msg, 'id': str(id)} return {'msg': msg, 'id': str(id)}
def treatment_plan_delete(request): try: msg = '' data = {} id = int(request.POST['id']) if id <= 0: msg = 'Illegal row id (' + str(id) + ') passed to delete routine' return print "Deleting TreatmentPlan with id = %d" % (id) treatmentPlan = DBSession.query(TreatmentPlan).get(id) DBSession.delete(treatmentPlan) DBSession.flush() # DBSession.commit() # Not needed since Pyramid uses the Zope transaction manager print "Delete successful" except exc.SQLAlchemyError as e: print "In treatment_plan_delete caught exception of type: " print type(e) msg = str(e) print msg DBSession.rollback() except Exception as e: print "In treatment_plan_delete caught exception of type: " print type(e) msg = str(e) DBSession.rollback() finally: return {'msg': msg, 'id': str(id)} return {'msg': msg, 'id': str(id)}
def patient_identification_delete(request): try: msg = '' data = {} patient_id = int(request.POST['patient_id']) if id <= 0: msg = 'Illegal row patient_id (' + str(patient_id) + ') passed to delete routine' return print "Deleting PatientIdentification with id = %d" % (patient_id) patient = DBSession.query(PatientIdentification).get(patient_id) DBSession.delete(patient) DBSession.flush() # DBSession.commit() # Not needed since Pyramid uses the Zope transaction manager print "Delete successful" except exc.SQLAlchemyError as e: print "In patient_identification_delete caught exception of type: " print type(e) msg = str(e) print msg DBSession.rollback() except Exception as e: print "In patient_identification_delete caught exception of type: " print type(e) msg = str(e) DBSession.rollback() finally: return {'msg': msg, 'patient_id': str(patient_id)} return {'msg': msg, 'patient_id': str(patient_id)}