App Engine Python SDK  v1.6.9 rev.445
The Python runtime is available as an experimental Preview feature.
Public Member Functions | List of all members
google.appengine.tools.old_dev_appserver.StaticFileConfigMatcher Class Reference
Inheritance diagram for google.appengine.tools.old_dev_appserver.StaticFileConfigMatcher:

Public Member Functions

def __init__
 
def IsStaticFile
 
def GetMimeType
 
def GetExpiration
 
def GetHttpHeaders
 

Detailed Description

Keeps track of file/directory specific application configuration.

Specifically:
- Computes mime type based on URLMap and file extension.
- Decides on cache expiration time based on URLMap and default expiration.
- Decides what HTTP headers to add to responses.

To determine the mime type, we first see if there is any mime-type property
on each URLMap entry. If non is specified, we use the mimetypes module to
guess the mime type from the file path extension, and use
application/octet-stream if we can't find the mimetype.

Constructor & Destructor Documentation

def google.appengine.tools.old_dev_appserver.StaticFileConfigMatcher.__init__ (   self,
  url_map_list,
  default_expiration 
)
Initializer.

Args:
  url_map_list: List of appinfo.URLMap objects.
If empty or None, then we always use the mime type chosen by the
mimetypes module.
  default_expiration: String describing default expiration time for browser
based caching of static files.  If set to None this disallows any
browser caching of static content.

Member Function Documentation

def google.appengine.tools.old_dev_appserver.StaticFileConfigMatcher.GetExpiration (   self,
  path 
)
Returns the cache expiration duration to be users for the given file.

Args:
  path: A string containing the file's path relative to the app.

Returns:
  Integer number of seconds to be used for browser cache expiration time.
def google.appengine.tools.old_dev_appserver.StaticFileConfigMatcher.GetHttpHeaders (   self,
  path 
)
Returns http_headers of the matching appinfo.URLMap, or an empty one.

Args:
  path: A string containing the file's path relative to the app.

Returns:
  A user-specified HTTP headers to be used in static content response. These
  headers are contained in an appinfo.HttpHeadersDict, which maps header
  names to values (both strings).
def google.appengine.tools.old_dev_appserver.StaticFileConfigMatcher.GetMimeType (   self,
  path 
)
Returns the mime type that we should use when serving the specified file.

Args:
  path: A string containing the file's path relative to the app.

Returns:
  String containing the mime type to use. Will be 'application/octet-stream'
  if we have no idea what it should be.
def google.appengine.tools.old_dev_appserver.StaticFileConfigMatcher.IsStaticFile (   self,
  path 
)
Tests if the given path points to a "static" file.

Args:
  path: A string containing the file's path relative to the app.

Returns:
  Boolean, True if the file was configured to be static.

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