def titlecasecar(self): try: carid = request.POST.get('carid', None) log.info('request to titlecase car %s' % carid) car = self.session.query(Car).get(carid) for attr in ('make', 'model', 'color'): setattr(car, attr, titlecase(getattr(car, attr), attr)) self.session.commit() return ""; except Exception, e: log.info('title case car failed: %s' % e) abort(400);
def titlecasedriver(self): try: driverid = request.POST.get('driverid', None) log.info('request to titlecase driver %s' % driverid) dr = self.session.query(Driver).get(driverid) for attr in ('firstname', 'lastname', 'address', 'city', 'state'): setattr(dr, attr, titlecase(getattr(dr, attr), attr)) self.session.commit() return ""; except Exception, e: log.info('title case driver failed: %s' % e) abort(400);