def create_default_member(): from app.models import db from app.models.member import Member member = Member() member.type = 9 member.username = '******' member.password = '******' try: db.session.add(member) db.session.commit() except: db.session.rollback() db.session.remove()
def post(self): parser = RequestParser(trim=True) parser.add_argument('username', type=str, required=True) args = parser.parse_args(strict=True) try: member = Member() member.type = 9 member.username = args['username'] member.registrationTime = time_to_value() member.registrationHost = host_to_value(request.remote_addr) db.session.add(member) db.session.commit() except: db.session.rollback() db.session.remove() abort(500) return make_response([]), 201