def post(self, request, tablename=None):
        klass = get_model(tablename)
        dbrow = klass()
        try:
            webhelpers.update_row(request.POST, klass, dbrow)
        except types.ValidationError, err:
            webhelpers.dbsession.rollback()
            request.log_error("create ValidationError: %s: %s\n" % (tablename, err))
            title = "Recreate new %s %s" % (tablename, dbrow)
            resp = self.get_response(request, title=title)
            resp.new_para(title)
            resp.new_para(err, class_="error")
            form = resp.add_form(action=request.get_url(addentry, tablename=tablename))
            webhelpers.build_add_form(form, klass)
            return resp.finalize()
        webhelpers.dbsession.add(dbrow)

        try:
            webhelpers.dbsession.commit()
        except (DataError, IntegrityError), err:
            webhelpers.dbsession.rollback()
            request.log_error("create error: %s: %s\n" % (tablename, err))
            title = "Create new %s" % (tablename, )
            resp = self.get_response(request, title=title)
            resp.new_para(title + ", again.")
            resp.new_para(err, class_="error")
            form = resp.add_form(action=request.get_url(addentry, tablename=tablename))
            webhelpers.build_add_form(form, klass)
            return resp.finalize()
        else:
            return framework.HttpResponseRedirect(request.get_url(listtable, tablename=tablename))
dataset/ETHPy150Open kdart/pycopia/storage/pycopia/db/webservice.py/CreateRequestHandler.post/original