OpenQuizz
Une application de gestion des contenus pédagogiques
Range Class Reference
Inheritance diagram for Range:
Collaboration diagram for Range:

Public Member Functions

def __init__ (self, units, ranges)
 
def range_for_length (self, length)
 
def make_content_range (self, length)
 
def to_header (self)
 
def to_content_range_header (self, length)
 
def __str__ (self)
 
def __repr__ (self)
 

Data Fields

 units
 
 ranges
 

Detailed Description

Represents a ``Range`` header. All methods only support only
bytes as the unit. Stores a list of ranges if given, but the methods
only work if only one range is provided.

:raise ValueError: If the ranges provided are invalid.

.. versionchanged:: 0.15
    The ranges passed in are validated.

.. versionadded:: 0.7

Constructor & Destructor Documentation

◆ __init__()

def __init__ (   self,
  units,
  ranges 
)

Member Function Documentation

◆ __repr__()

def __repr__ (   self)

◆ __str__()

def __str__ (   self)

◆ make_content_range()

def make_content_range (   self,
  length 
)
Creates a :class:`~werkzeug.datastructures.ContentRange` object
from the current range and given content length.

◆ range_for_length()

def range_for_length (   self,
  length 
)
If the range is for bytes, the length is not None and there is
exactly one range and it is satisfiable it returns a ``(start, stop)``
tuple, otherwise `None`.

◆ to_content_range_header()

def to_content_range_header (   self,
  length 
)
Converts the object into `Content-Range` HTTP header,
based on given length

◆ to_header()

def to_header (   self)
Converts the object back into an HTTP header.

Field Documentation

◆ ranges

ranges

◆ units

units

The documentation for this class was generated from the following file: