|
tuple | ALLOWED_MODES = frozenset(['r', 'rb', 'U', 'rU']) |
|
tuple | ALLOWED_FILES |
|
tuple | ALLOWED_FILES_RE = set([re.compile(r'.*/python27.zip$')]) |
|
tuple | ALLOWED_DIRS |
|
tuple | os_source_location = inspect.getsourcefile(os) |
|
tuple | NOT_ALLOWED_DIRS |
|
tuple | ALLOWED_SITE_PACKAGE_DIRS |
|
tuple | ALLOWED_SITE_PACKAGE_FILES |
|
File sub-class that enforces the security restrictions of the production
environment.
def google.appengine.tools.dev_appserver_import_hook.FakeFile.__init__ |
( |
|
self, |
|
|
|
filename, |
|
|
|
mode = 'r' , |
|
|
|
bufsize = -1 , |
|
|
|
kwargs |
|
) |
| |
Initializer. See file built-in documentation.
def google.appengine.tools.dev_appserver_import_hook.FakeFile.IsFileAccessible |
( |
|
filename, |
|
|
|
normcase = os.path.normcase , |
|
|
|
py27_optional = False |
|
) |
| |
|
static |
Determines if a file's path is accessible.
SetAllowedPaths(), SetSkippedFiles() 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.
normcase: Used for dependency injection.
py27_optional: Whether the filename being checked matches the name of an
optional python27 runtime library.
Returns:
True if the file is accessible, False otherwise.
def google.appengine.tools.dev_appserver_import_hook.FakeFile.SetAllowedModule |
( |
|
name | ) |
|
|
static |
Allow the use of a module based on where it is located.
Meant to be used by use_library() so that it has a link back into the
trusted part of the interpreter.
Args:
name: Name of the module to allow.
def google.appengine.tools.dev_appserver_import_hook.FakeFile.SetAllowedPaths |
( |
|
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.dev_appserver_import_hook.FakeFile.SetAllowSkippedFiles |
( |
|
allow_skipped_files | ) |
|
|
static |
Configures access to files matching FakeFile._skip_files.
Args:
allow_skipped_files: Boolean whether to allow access to skipped files
def google.appengine.tools.dev_appserver_import_hook.FakeFile.SetSkippedFiles |
( |
|
skip_files | ) |
|
|
static |
Sets which files in the application directory are to be ignored.
Must be called at least once before any file objects are created in the
hardened environment.
Must be called whenever the configuration was updated.
Args:
skip_files: Object with .match() method (e.g. compiled regexp).
def google.appengine.tools.dev_appserver_import_hook.FakeFile.SetStaticFileConfigMatcher |
( |
|
static_file_config_matcher | ) |
|
|
static |
Sets StaticFileConfigMatcher instance for checking if a file is static.
Must be called at least once before any file objects are created in the
hardened environment.
Must be called whenever the configuration was updated.
Args:
static_file_config_matcher: StaticFileConfigMatcher instance.
tuple google.appengine.tools.dev_appserver_import_hook.FakeFile.ALLOWED_DIRS |
|
static |
Initial value:
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__))),
tuple google.appengine.tools.dev_appserver_import_hook.FakeFile.ALLOWED_FILES |
|
static |
Initial value: 1 = set(os.path.normcase(filename)
2 for filename
in mimetypes.knownfiles
3 if os.path.isfile(filename))
tuple google.appengine.tools.dev_appserver_import_hook.FakeFile.ALLOWED_SITE_PACKAGE_DIRS |
|
static |
Initial value:
2 os.path.normcase(os.path.abspath(os.path.join(SITE_PACKAGES, path)))
tuple google.appengine.tools.dev_appserver_import_hook.FakeFile.NOT_ALLOWED_DIRS |
|
static |
The documentation for this class was generated from the following file:
- code/googleappengine-read-only/python/google/appengine/tools/dev_appserver_import_hook.py