google.appengine.api.dispatchinfo module

Summary

Dispatch configuration tools.

Library for parsing dispatch.yaml files and working with these in memory.

Contents

class google.appengine.api.dispatchinfo.DispatchEntry(**attributes)source

Bases: google.appengine.api.validation.Validated

A Dispatch entry describes a mapping from a URL pattern to a module.

ATTRIBUTES = {u'url': <google.appengine.api.dispatchinfo.DispatchEntryURLValidator object>, u'service': <google.appengine.api.validation.Optional object>, u'module': <google.appengine.api.validation.Optional object>}
class google.appengine.api.dispatchinfo.DispatchEntryURLValidator(default=None)source

Bases: google.appengine.api.validation.Validator

Validater for URL patterns.

Validate(value, unused_key=None)source

Validates an URL pattern.

class google.appengine.api.dispatchinfo.DispatchInfoExternal(**attributes)source

Bases: google.appengine.api.validation.Validated

Describes the format of a dispatch.yaml file.

ATTRIBUTES = {u'application': <google.appengine.api.validation.Optional object>, u'dispatch': <google.appengine.api.validation.Optional object>}
exception google.appengine.api.dispatchinfo.Errorsource

Bases: exceptions.Exception

Base class for errors in this module.

google.appengine.api.dispatchinfo.LoadSingleDispatch(dispatch_info, open_fn=None)source

Load a dispatch.yaml file or string and return a DispatchInfoExternal.

Parameters
  • dispatch_info – The contents of a dispatch.yaml file as a string, or an open file object.

  • open_fn – Function for opening files. Unused here, needed to provide a polymorphic API used by appcfg.py yaml parsing.

Returns

A DispatchInfoExternal instance which represents the contents of the parsed

yaml file.

Raises
  • MalformedDispatchConfigurationError – The yaml file contains multiple dispatch sections or is missing a required value.

  • yaml_errors.EventError – An error occured while parsing the yaml file.

exception google.appengine.api.dispatchinfo.MalformedDispatchConfigurationErrorsource

Bases: google.appengine.api.dispatchinfo.Error

Configuration file for dispatch is malformed.

class google.appengine.api.dispatchinfo.ParsedURL(url_pattern)source

Bases: object

Dispath Entry URL holder class.

host_pattern

The host pattern component of the URL pattern.

host_exact

True if the host pattern does not start with a *.

host

host_pattern with any leading * removed.

path_pattern

The path pattern component of the URL pattern.

path_exact

True if the path_pattern does not end with a *.

path

path_pattern with any trailing * removed.