Set extensions for student quiz submissions.

        <b>Responses</b>
        
        * <b>200 OK</b> if the request was successful
        * <b>403 Forbidden</b> if you are not allowed to extend quizzes for this course
772587
def set_extensions_for_student_quiz_submissions(self, user_id, course_id, extend_from_end_at=None, extend_from_now=None, extra_attempts=None, extra_time=None, manually_unlocked=None):
        
        path = {}
        data = {}
        params = {}

        # REQUIRED - PATH - course_id
        """ID"""
        path["course_id"] = course_id

        # REQUIRED - user_id
        """The ID of the user we want to add quiz extensions for."""
        data["user_id"] = user_id

        # OPTIONAL - extra_attempts
        """Number of times the student is allowed to re-take the quiz over the
        multiple-attempt limit. This is limited to 1000 attempts or less."""
        if extra_attempts is not None:
            data["extra_attempts"] = extra_attempts

        # OPTIONAL - extra_time
        """The number of extra minutes to allow for all attempts. This will
        add to the existing time limit on the submission. This is limited to
        10080 minutes (1 week)"""
        if extra_time is not None:
            data["extra_time"] = extra_time

        # OPTIONAL - manually_unlocked
        """Allow the student to take the quiz even if it's locked for
        everyone else."""
        if manually_unlocked is not None:
            data["manually_unlocked"] = manually_unlocked

        # OPTIONAL - extend_from_now
        """The number of minutes to extend the quiz from the current time. This is
        mutually exclusive to extend_from_end_at. This is limited to 1440
        minutes (24 hours)"""
        if extend_from_now is not None:
            data["extend_from_now"] = extend_from_now

        # OPTIONAL - extend_from_end_at
        """The number of minutes to extend the quiz beyond the quiz's current
        ending time. This is mutually exclusive to extend_from_now. This is
        limited to 1440 minutes (24 hours)"""
        if extend_from_end_at is not None:
            data["extend_from_end_at"] = extend_from_end_at

        self.logger.debug("POST /api/v1/courses/{course_id}/quiz_extensions with query params: {params} and form data: {data}".format(params=params, data=data, **path))
        return self.generic_request("POST", "/api/v1/courses/{course_id}/quiz_extensions".format(**path), data=data, params=params, no_data=True)
876679
def set(self, response: 'requests.Response') -> None:
        
        self.data[response.url] = SavedEndpoint(
            response.json(),
            self._get_expiration(response.headers)
        )
678837
def publish_kb
      response = @http.put(
        "#{BASE_URL}/#{@knowledgebase_id}"
      )

      case response.code
      when 204
        nil
      when 400
        raise BadArgumentError, response.parse['error']['message'].join(' ')
      when 401
        raise UnauthorizedError, response.parse['error']['message']
      when 403
        raise ForbiddenError, response.parse['error']['message']
      when 404
        raise NotFoundError, response.parse['error']['message']
      when 409
        raise ConflictError, response.parse['error']['message']
      else
        raise UnknownError, "Oh no! (#{response.code})"
      end
    end
210571
def CourseOfDept(request):
	
	dept = request.GET['dept']
	school = request.GET['school']
	c = Course(school=school)
	return JsonResponse(c.getByDept(dept=dept, grade=request.GET['grade'] if 'grade' in request.GET else None), safe=False)
777951
public void setAllowedMethods(RequestTypeEnum... theAllowedMethods) {
		if (theAllowedMethods == null || theAllowedMethods.length == 0) {
			myAllowedMethods = null;
		} else {
			myAllowedMethods = new LinkedHashSet<RequestTypeEnum>();
			for (RequestTypeEnum next : theAllowedMethods) {
				myAllowedMethods.add(next);
			}
		}
		updateAllowHeader();
	}
897726
private static void fillReqAndRes(ServletRequest req, ServletResponse res){
		//-- 填充请求和响应对象到ActionContext本地线程
		Request.init((HttpServletRequest)req);
		Response.init((HttpServletResponse)res);
	}
746042
private function _setResponseHeaders()
    {
        $this->_response->setHeader("Expires", "Mon, 26 Jul 1997 05:00:00 GMT", true)
                        ->setHeader("Last-Modified", gmdate("D, d M Y H:i:s") . " GMT", true)
                        ->setHeader("Cache-Control", "no-store, no-cache, must-revalidate", true)
                        ->setHeader("Cache-Control", "post-check=0, pre-check=0", false)
                        ->setHeader("Pragma", "no-cache", true)
                        ->sendHeaders();
    }
1109552
@Nonnull
  public static EChange setResponseCompressionEnabled (final boolean bResponseCompressionEnabled)
  {
    return s_aRWLock.writeLocked ( () -> {
      if (s_bResponseCompressionEnabled == bResponseCompressionEnabled)
        return EChange.UNCHANGED;
      s_bResponseCompressionEnabled = bResponseCompressionEnabled;
      LOGGER.info ("CompressFilter responseCompressionEnabled=" + bResponseCompressionEnabled);
      return EChange.CHANGED;
    });
  }
168832
def post(self, request, question_level, question_number, format=None):
        

        user = User.objects.get(username=request.user.username)
        question = Question.objects.filter(question_level=question_level).filter(question_number=question_number)
        if int(user.profile.user_access_level) < int(question_level):
            content = {'user_nick':profile.user_nick, 'please move along': 'Nothing to see here' }
            return Response(content, status=status.HTTP_406_NOT_ACCEPTABLE)

        time_last = None
        time_last_query = Submission.objects.filter(submission_user__username=request.user.username).filter(submission_question__question_level=question_level).filter(submission_question__question_number=question_number).filter(submission_state='WA').order_by('submission_timestamp').last()
        check_resubmission = AcceptedQuestion.objects.filter(record_user=request.user).filter(record_question=question)
        if check_resubmission:
            content = {'user_nick':profile.user_nick, 'Do not try to resubmit': 'Already Accepted' }
            return Response(content, status=status.HTTP_406_NOT_ACCEPTABLE)
        if time_last_query:
            time_last = time_last_query.submission_timestamp
        time_limit = self.get_contest_consecutive_submission_halt_time()

#        print time_last, time_limit, datetime.datetime.now(), time_limit <= datetime.datetime.now()

        if(time_last is None or time_last + time_limit <= datetime.datetime.now()):

            type_of_contest =  self.get_contest_type()
            type_of_submission = self.get_question_type()
            if type_of_submission != STRING:
                content = { 'user_nick':profile.user_nick, 'please move along': 'WRONG TYPE SUBMISSION'}
                return Response(content, status=status.HTTP_405_METHOD_NOT_ALLOWED)

            serializer = SubmissionSerializer(data=request.data)
            if serializer.is_valid():
                serializer.save(submission_user = request.user,
                                submission_question = self.get_object(question_level,question_number)[0],
                )
                # checker_queue.delay(int(serializer.data['id']))
                return Response(serializer.data, status=status.HTTP_201_CREATED)
            else:
                return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)
        else:
            content = {'user_nick':profile.user_nick, 'Try to submit after some time': 'Nothing to see here' }
            return Response(content, status=status.HTTP_406_NOT_ACCEPTABLE)
1079612
@SuppressWarnings("MethodMayBeStatic") // Intentionally left non-static for better user experience.
    protected final boolean setResponseTimeout(ClientRequestContext ctx) {
        requireNonNull(ctx, "ctx");
        final long responseTimeoutMillis = ctx.attr(STATE).get().responseTimeoutMillis();
        if (responseTimeoutMillis < 0) {
            return false;
        }
        ctx.setResponseTimeoutMillis(responseTimeoutMillis);
        return true;
    }
1099978
def add_no_response(self):
        
        option = Option()
        option.number = defines.OptionRegistry.NO_RESPONSE.number
        option.value = 26
        self.add_option(option)
1306804
public static void putPasswordResetSecurityQuestionsEnabled(final RequestContext requestContext, final boolean value) {
        val flowScope = requestContext.getFlowScope();
        flowScope.put("questionsEnabled", value);
    }
581310
public static function can_approve_course_requests() {
        global $CFG, $DB;
        if (empty($CFG->enablecourserequests)) {
            return false;
        }
        $context = context_system::instance();
        if (!has_capability('moodle/site:approvecourse', $context)) {
            return false;
        }
        if (!$DB->record_exists('course_request', array())) {
            return false;
        }
        return true;
    }
396965
private static boolean canResponseHaveBody(int status) {
        LOG.trace("enter HttpMethodBase.canResponseHaveBody(int)");

        boolean result = true;

        if ((status >= 100 && status <= 199) || (status == 204)
            || (status == 304)) { // NOT MODIFIED
            result = false;
        }

        return result;
    }
722484
private function setLimitAndSetOffset()
    {
        if ($this->perPage === null) {
            $this->offset = null;
            $this->limit = null;
        } else {
            $this->offset = ($this->currentPage - 1) * $this->perPage;
            $this->limit = $this->perPage;
        }
    }
977059
protected void setResponseTags(HttpRequest<?> request, HttpResponse<?> response, Span span) {
        HttpStatus status = response.getStatus();
        int code = status.getCode();
        if (code > HTTP_SUCCESS_CODE_UPPER_LIMIT) {
            span.setTag(TAG_HTTP_STATUS_CODE, code);
            span.setTag(TAG_ERROR, status.getReason());
        }
        request.getAttribute(HttpAttributes.ERROR, Throwable.class).ifPresent(error ->
                setErrorTags(span, error)
        );
    }
537190
public void setResponse(byte[] contentType, byte[] value) {
        int valueSize = (value == null) ? 0 : value.length;
        byte[] len = stringToBytes(String.valueOf(valueSize));
        int size = RES_200.length;
        if (contentType != null) {
            size += CONTENT_TYPE.length;
            size += contentType.length;
            size += TextCommandConstants.RETURN.length;
        }
        size += CONTENT_LENGTH.length;
        size += len.length;
        size += TextCommandConstants.RETURN.length;
        size += TextCommandConstants.RETURN.length;
        size += valueSize;
        this.response = ByteBuffer.allocate(size);
        response.put(RES_200);
        if (contentType != null) {
            response.put(CONTENT_TYPE);
            response.put(contentType);
            response.put(TextCommandConstants.RETURN);
        }
        response.put(CONTENT_LENGTH);
        response.put(len);
        response.put(TextCommandConstants.RETURN);
        response.put(TextCommandConstants.RETURN);
        if (value != null) {
            response.put(value);
        }
        response.flip();
    }