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

Public Member Functions

def __init__
 

Static Public Member Functions

def set_allowed_paths
 
def set_skip_files
 
def set_static_files
 
def is_file_accessible
 

Static Public Attributes

tuple ALLOWED_MODES = frozenset(['r', 'rb', 'U', 'rU'])
 
tuple ALLOWED_FILES
 
tuple ALLOWED_DIRS
 
tuple os_source_location = inspect.getsourcefile(os)
 

Detailed Description

File sub-class that enforces the restrictions of production.

Constructor & Destructor Documentation

def google.appengine.tools.devappserver2.python.stubs.FakeFile.__init__ (   self,
  filename,
  mode = 'r',
  bufsize = -1,
  kwargs 
)
Initializer. See file built-in documentation.

Member Function Documentation

def google.appengine.tools.devappserver2.python.stubs.FakeFile.is_file_accessible (   filename)
static
Determines if a file is accessible.

set_allowed_paths(), set_skip_files() and SetStaticFileConfigMatcher() must
be called before this method or else all file accesses will raise an error.

Args:
  filename: Path of the file to check (relative or absolute). May be a
directory, in which case access for files inside that directory will
be checked.

Returns:
  True if the file is accessible, False otherwise.

Raises:
  TypeError: filename is not a basestring.
def google.appengine.tools.devappserver2.python.stubs.FakeFile.set_allowed_paths (   root_path,
  application_paths 
)
static
Configures which paths are allowed to be accessed.

Must be called at least once before any file objects are created in the
hardened environment.

Args:
  root_path: Absolute path to the root of the application.
  application_paths: List of additional paths that the application may
access, this must include the App Engine runtime but not the Python
library directories.
def google.appengine.tools.devappserver2.python.stubs.FakeFile.set_skip_files (   skip_files)
static
Configure the skip_files regex.

Files that match this regex are inaccessible in the hardened environment.
Must be called at least once before any file objects are created in the
hardened environment.

Args:
  skip_files: A str containing a regex to match against file paths.
def google.appengine.tools.devappserver2.python.stubs.FakeFile.set_static_files (   static_files)
static
Configure the static_files regex.

Files that match this regex are inaccessible in the hardened environment.
Must be called at least once before any file objects are created in the
hardened environment.

Args:
  static_files: A str containing a regex to match against file paths.

Member Data Documentation

tuple google.appengine.tools.devappserver2.python.stubs.FakeFile.ALLOWED_DIRS
static
Initial value:
1 = set([
2  os.path.normcase(os.path.realpath(os.path.dirname(os.__file__))),
3  os.path.normcase(os.path.abspath(os.path.dirname(os.__file__))),
4  os.path.normcase(os.path.dirname(os.path.realpath(os.__file__))),
5  os.path.normcase(os.path.dirname(os.path.abspath(os.__file__))),
6  ])
tuple google.appengine.tools.devappserver2.python.stubs.FakeFile.ALLOWED_FILES
static
Initial value:
1 = set(os.path.normcase(filename)
2  for filename in mimetypes.knownfiles
3  if os.path.isfile(filename))

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