Table of Contents

Class: ITraversalContext ./src/peak/web/interfaces.py

A traversed-to location

Note: this inherits from security.IInteraction, so it also supports the user attribute, allows() method, and so on.

Base Classes   
Interface
Methods   
allows
childContext
clone
getResource
parentContext
peerContext
renderHTTP
requireAccess
shift
traverseName
  allows 
allows (
        subject,
        name=None,
        permissionNeeded=NOT_GIVEN,
        user=NOT_GIVEN,
        )

Return true if user has permissionNeeded for subject

If user is not supplied, the traversal context's current user is checked. If the permission is not supplied, the policy object's permissionFor() method is used to determine one.

This method should return a true value, or a security.Denial() with an appropriate message value.

  childContext 
childContext ( name,  ob )

Return a new child context with name name and current->ob

  clone 
clone ( **kw )

Create a duplicate context, using supplied keyword arguments

Acceptable keyword arguments include: name, current, environ, policy, skin, rootURL, user, previous, and clone_from. Most of these just set the corresponding attribute on the new context, but the following names are special:

clone_from
an existing context to clone. If supplied, its user, skin, policy, and previous attributes will be used as defaults for the corresponding keyword arguments, if they are not supplied.
previous
an existing context that will be used as the new context's parent context.

  getResource 
getResource ( path )

Return the named resource

  parentContext 
parentContext ()

Return this context's parent, or self if no parent

  peerContext 
peerContext ( name,  ob )

Return a new peer context with name name and current->ob

  renderHTTP 
renderHTTP ()

Equivalent to IHTTPHandler(self.current).handle_http()

  requireAccess 
requireAccess (
        qname,
        subject,
        name=None,
        permissionNeeded=NOT_GIVEN,
        user=NOT_GIVEN,
        )

NotAllowed unless user has permissionNeeded for subject

qname is used only for generating an appropriate error if permission isn't granted. The other arguments are per the allows() method of security.IInteraction. There is no return value.

  shift 
shift ()

Shift a path component from PATH_INFO to SCRIPT_NAME

This modifies the context's (possibly shared) environment such that one path component is moved from the beginning of PATH_INFO to the end of SCRIPT_NAME. The shifted path component is returned, or None if PATH_INFO is empty.

Before the shift, PATH_INFO is normalized to eliminate empty path components and path components that contain a single dot, so these should never be returned. Double-dot components, however, are returned, and SCRIPT_NAME is adjusted accordingly (i.e., the trailing path component of SCRIPT_NAME is stripped, if one is present).

Note that this changes the environ being used by this context and any parent or child contexts that share it. Thus, it's usually only safe to use this method from within a handle_http() method, such as when determining the next object to traverse to, if any.

  traverseName 
traverseName ( name,  default=NOT_GIVEN )

Return a new context obtained by traversing to name


Table of Contents

This document was automatically generated on Mon Aug 19 01:11:13 2019 by HappyDoc version 2.1