@app.errorhandler(Exception) # pylint: disable=unused-variable def unknown_error(err): """All other exceptions are essentially just raised with logging""" print '{}: {}'.format(type(err).__name__, err) import traceback traceback.print_exc() return make_response(str(err), 500) return app # pylint: disable=invalid-name if __name__ == "__main__": app = create_app() # Bind to PORT if defined, otherwise default to 5000. port = int(os.environ.get('PORT', 5000)) app.run(host='0.0.0.0', port=port) # pylint: disable=no-init class DatetimeHandler(jsonpickle.handlers.BaseHandler): """Custom handler to get datetimes as ISO dates""" def flatten(self, obj, data): # pylint: disable=missing-docstring,W0613,R0201 return obj.isoformat() jsonpickle.handlers.registry.register(datetime.datetime, DatetimeHandler) jsonpickle.handlers.registry.register(datetime.date, DatetimeHandler) set_up_permissions(commit=True)
def __init__(self): self.tournaments = set() self.accounts = set() self.existing_perms = set([o.id for o in ProtObjAction.query.all()]) set_up_permissions()