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

Public Member Functions

def __init__ (self, import_name, template_folder=None, root_path=None)
 
def static_folder (self)
 
def static_folder (self, value)
 
def static_url_path (self)
 
def static_url_path (self, value)
 
def has_static_folder (self)
 
def jinja_loader (self)
 
def get_send_file_max_age (self, filename)
 
def send_static_file (self, filename)
 
def open_resource (self, resource, mode="rb")
 

Data Fields

 cli
 

Static Public Attributes

 import_name
 
 template_folder
 
 root_path
 

Constructor & Destructor Documentation

◆ __init__()

def __init__ (   self,
  import_name,
  template_folder = None,
  root_path = None 
)

Member Function Documentation

◆ get_send_file_max_age()

def get_send_file_max_age (   self,
  filename 
)
Provides default cache_timeout for the :func:`send_file` functions.

By default, this function returns ``SEND_FILE_MAX_AGE_DEFAULT`` from
the configuration of :data:`~flask.current_app`.

Static file functions such as :func:`send_from_directory` use this
function, and :func:`send_file` calls this function on
:data:`~flask.current_app` when the given cache_timeout is ``None``. If a
cache_timeout is given in :func:`send_file`, that timeout is used;
otherwise, this method is called.

This allows subclasses to change the behavior when sending files based
on the filename.  For example, to set the cache timeout for .js files
to 60 seconds::

    class MyFlask(flask.Flask):
def get_send_file_max_age(self, name):
    if name.lower().endswith('.js'):
        return 60
    return flask.Flask.get_send_file_max_age(self, name)

.. versionadded:: 0.9

◆ has_static_folder()

def has_static_folder (   self)
This is ``True`` if the package bound object's container has a
folder for static files.

.. versionadded:: 0.5

◆ jinja_loader()

def jinja_loader (   self)
The Jinja loader for this package bound object.

.. versionadded:: 0.5

◆ open_resource()

def open_resource (   self,
  resource,
  mode = "rb" 
)
Opens a resource from the application's resource folder.  To see
how this works, consider the following folder structure::

    /myapplication.py
    /schema.sql
    /static
/style.css
    /templates
/layout.html
/index.html

If you want to open the :file:`schema.sql` file you would do the
following::

    with app.open_resource('schema.sql') as f:
contents = f.read()
do_something_with(contents)

:param resource: the name of the resource.  To access resources within
         subfolders use forward slashes as separator.
:param mode: Open file in this mode. Only reading is supported,
    valid values are "r" (or "rt") and "rb".

◆ send_static_file()

def send_static_file (   self,
  filename 
)
Function used internally to send static files from the static
folder to the browser.

.. versionadded:: 0.5

◆ static_folder() [1/2]

def static_folder (   self)
The absolute path to the configured static folder.

◆ static_folder() [2/2]

def static_folder (   self,
  value 
)

◆ static_url_path() [1/2]

def static_url_path (   self)
The URL prefix that the static route will be accessible from.

If it was not configured during init, it is derived from
:attr:`static_folder`.

◆ static_url_path() [2/2]

def static_url_path (   self,
  value 
)

Field Documentation

◆ cli

cli

◆ import_name

import_name
static

◆ root_path

root_path
static

◆ template_folder

template_folder
static

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