def validate_post(self, args): if args.get("claim"): if not args.get("handled_by"): return {'error': [{"message": "handled_by must be provided when claim=true"}]} if not validate_username(args.get("handled_by")): return {'error': [{"message": "handled_by must be a valid minecraft username"}]}
def validate_get(self, args): if not any([ args.get("username"), args.get("status"), args.get("server"), args.get("id") ]): return { 'error': [{ "message": "an id, a server, a status, or a username must be provided" }] } if args.get("id") and not ModReqModel.objects(uid=args.get("id")): return {'error': [{"message": "invalid id"}]} if args.get("server") and Server.verify_fid(args.get("server")): return { 'error': [{ "message": "the server field must be a valid fid" }] } if args.get("username") and not validate_username( args.get("username")): return {'error': [{"message": "invalid username"}]}
def validate_post(self, args): if args.get("username") and not validate_username( args.get("username")): return {'error': [{"message": "invalid username"}]} if args.get("request") and len(args.get("request")) > 1000: return { 'error': [{ "message": "the request must be below 1000 characters long" }] } if args.get("server") and Server.verify_fid(args.get("server")): return { 'error': [{ "message": "the server field must be a valid fid" }] } if args.get("location") and len(args.get( "location")) > 100: # need a better way to validate location # world,x,y,z,pitch,yaw is what we want # x, y, and z are doubles # pitch and yaw are floats # world should only be world, world_nether, or world_the_end return { 'error': [{ "message": "the location must be below 100 characters long" }] }
def validate_get(self, args): if not any([args.get("username"), args.get("status"), args.get("server"), args.get("id")]): return {'error': [{"message": "an id, a server, a status, or a username must be provided"}]} if args.get("id") and not ModReqModel.objects(uid=args.get("id")): return {'error': [{"message": "invalid id"}]} if args.get("server") and Server.verify_fid(args.get("server")): return {'error': [{"message": "the server field must be a valid fid"}]} if args.get("username") and not validate_username(args.get("username")): return {'error': [{"message": "invalid username"}]}
def validate_post(self, args): if args.get("handled_by") and not validate_username( args.get("handled_by")): return {'error': [{"message": "invalid handled_by"}]} if args.get("close_message") and len(args.get("close_message")) > 1000: return { 'error': [{ "message": "the close_message must be below 1000 characters long" }] }
def validate_post(self, args): if args.get("username") and not validate_username(args.get("username")): return {'error': [{"message": "invalid username"}]} if args.get("request") and len(args.get("request")) > 1000: return {'error': [{"message": "the request must be below 1000 characters long"}]} if args.get("server") and Server.verify_fid(args.get("server")): return {'error': [{"message": "the server field must be a valid fid"}]} if args.get("location") and len(args.get("location")) > 100: # need a better way to validate location # world,x,y,z,pitch,yaw is what we want # x, y, and z are doubles # pitch and yaw are floats # world should only be world, world_nether, or world_the_end return {'error': [{"message": "the location must be below 100 characters long"}]}
def validate_post(self, args): if args.get("claim"): if not args.get("handled_by"): return { 'error': [{ "message": "handled_by must be provided when claim=true" }] } if not validate_username(args.get("handled_by")): return { 'error': [{ "message": "handled_by must be a valid minecraft username" }] }
def validate_post(self, args): if args.get("handled_by") and not validate_username(args.get("handled_by")): return {'error': [{"message": "invalid handled_by"}]} if args.get("close_message") and len(args.get("close_message")) > 1000: return {'error': [{"message": "the close_message must be below 1000 characters long"}]}