annotate Doc/lib/libbastion.tex @ 5817:48b94de85bf3 legacy-trunk

Extensive changes by AMK.
author Guido van Rossum <guido@python.org>
date Thu, 17 Jul 1997 16:29:42 +0000
parents dbb76095adee
children 3468ea8645ca
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
4259
dbb76095adee Added bastion and (dummy) rexec docs
Guido van Rossum <guido@python.org>
parents:
diff changeset
1 \section{Standard Module \sectcode{Bastion}}
dbb76095adee Added bastion and (dummy) rexec docs
Guido van Rossum <guido@python.org>
parents:
diff changeset
2 \stmodindex{Bastion}
dbb76095adee Added bastion and (dummy) rexec docs
Guido van Rossum <guido@python.org>
parents:
diff changeset
3 \renewcommand{\indexsubitem}{(in module Bastion)}
dbb76095adee Added bastion and (dummy) rexec docs
Guido van Rossum <guido@python.org>
parents:
diff changeset
4
dbb76095adee Added bastion and (dummy) rexec docs
Guido van Rossum <guido@python.org>
parents:
diff changeset
5 % I'm concerned that the word 'bastion' won't be understood by people
dbb76095adee Added bastion and (dummy) rexec docs
Guido van Rossum <guido@python.org>
parents:
diff changeset
6 % for whom English is a second language, making the module name
dbb76095adee Added bastion and (dummy) rexec docs
Guido van Rossum <guido@python.org>
parents:
diff changeset
7 % somewhat mysterious. Thus, the brief definition... --amk
dbb76095adee Added bastion and (dummy) rexec docs
Guido van Rossum <guido@python.org>
parents:
diff changeset
8
dbb76095adee Added bastion and (dummy) rexec docs
Guido van Rossum <guido@python.org>
parents:
diff changeset
9 According to the dictionary, a bastion is ``a fortified area or
dbb76095adee Added bastion and (dummy) rexec docs
Guido van Rossum <guido@python.org>
parents:
diff changeset
10 position'', or ``something that is considered a stronghold.'' It's a
dbb76095adee Added bastion and (dummy) rexec docs
Guido van Rossum <guido@python.org>
parents:
diff changeset
11 suitable name for this module, which provides a way to forbid access
dbb76095adee Added bastion and (dummy) rexec docs
Guido van Rossum <guido@python.org>
parents:
diff changeset
12 to certain attributes of an object. It must always be used with the
dbb76095adee Added bastion and (dummy) rexec docs
Guido van Rossum <guido@python.org>
parents:
diff changeset
13 \code{rexec} module, in order to allow restricted-mode programs access
dbb76095adee Added bastion and (dummy) rexec docs
Guido van Rossum <guido@python.org>
parents:
diff changeset
14 to certain safe attributes of an object, while denying access to
dbb76095adee Added bastion and (dummy) rexec docs
Guido van Rossum <guido@python.org>
parents:
diff changeset
15 other, unsafe attributes.
dbb76095adee Added bastion and (dummy) rexec docs
Guido van Rossum <guido@python.org>
parents:
diff changeset
16
dbb76095adee Added bastion and (dummy) rexec docs
Guido van Rossum <guido@python.org>
parents:
diff changeset
17 % I've punted on the issue of documenting keyword arguments for now.
dbb76095adee Added bastion and (dummy) rexec docs
Guido van Rossum <guido@python.org>
parents:
diff changeset
18
dbb76095adee Added bastion and (dummy) rexec docs
Guido van Rossum <guido@python.org>
parents:
diff changeset
19 \begin{funcdesc}{Bastion}{object\optional{\, filter\, name\, class}}
dbb76095adee Added bastion and (dummy) rexec docs
Guido van Rossum <guido@python.org>
parents:
diff changeset
20 Protect the class instance \var{object}, returning a bastion for the
dbb76095adee Added bastion and (dummy) rexec docs
Guido van Rossum <guido@python.org>
parents:
diff changeset
21 object. Any attempt to access one of the object's attributes will
dbb76095adee Added bastion and (dummy) rexec docs
Guido van Rossum <guido@python.org>
parents:
diff changeset
22 have to be approved by the \var{filter} function; if the access is
dbb76095adee Added bastion and (dummy) rexec docs
Guido van Rossum <guido@python.org>
parents:
diff changeset
23 denied an AttributeError exception will be raised.
dbb76095adee Added bastion and (dummy) rexec docs
Guido van Rossum <guido@python.org>
parents:
diff changeset
24
dbb76095adee Added bastion and (dummy) rexec docs
Guido van Rossum <guido@python.org>
parents:
diff changeset
25 If present, \var{filter} must be a function that accepts a string
dbb76095adee Added bastion and (dummy) rexec docs
Guido van Rossum <guido@python.org>
parents:
diff changeset
26 containing an attribute name, and returns true if access to that
dbb76095adee Added bastion and (dummy) rexec docs
Guido van Rossum <guido@python.org>
parents:
diff changeset
27 attribute will be permitted; if \var{filter} returns false, the access
dbb76095adee Added bastion and (dummy) rexec docs
Guido van Rossum <guido@python.org>
parents:
diff changeset
28 is denied. The default filter denies access to any function beginning
dbb76095adee Added bastion and (dummy) rexec docs
Guido van Rossum <guido@python.org>
parents:
diff changeset
29 with an underscore (\code{_}). The bastion's string representation
dbb76095adee Added bastion and (dummy) rexec docs
Guido van Rossum <guido@python.org>
parents:
diff changeset
30 will be \code{<Bastion for \var{name}>} if a value for
dbb76095adee Added bastion and (dummy) rexec docs
Guido van Rossum <guido@python.org>
parents:
diff changeset
31 \var{name} is provided; otherwise, \code{repr(\var{object})} will be used.
dbb76095adee Added bastion and (dummy) rexec docs
Guido van Rossum <guido@python.org>
parents:
diff changeset
32
dbb76095adee Added bastion and (dummy) rexec docs
Guido van Rossum <guido@python.org>
parents:
diff changeset
33 \var{class}, if present, would be a subclass of \code{BastionClass};
dbb76095adee Added bastion and (dummy) rexec docs
Guido van Rossum <guido@python.org>
parents:
diff changeset
34 see the code in \file{bastion.py} for the details. Overriding the
dbb76095adee Added bastion and (dummy) rexec docs
Guido van Rossum <guido@python.org>
parents:
diff changeset
35 default \code{BastionClass} will rarely be required.
dbb76095adee Added bastion and (dummy) rexec docs
Guido van Rossum <guido@python.org>
parents:
diff changeset
36
dbb76095adee Added bastion and (dummy) rexec docs
Guido van Rossum <guido@python.org>
parents:
diff changeset
37 \end{funcdesc}