| |
- BoundaryError
-
- BoundaryTypeError(BoundaryError, TypeError)
- BoundaryValueError(BoundaryError, ValueError)
- object
-
- Boundary
-
- ForEachBoundary
- LengthBoundary
- NonNullBoundary
- RangeBoundary
- TypeBoundary
class Boundary(object) |
|
Base class from which boundary conditions should be derived |
|
Methods defined here:
- __call__(self, property, client, value)
- Check value against boundary conditions
Your boundary should override this method, check the value
and raise appropriate BoundaryError's if the value is
outside of bounds
Data and other attributes defined here:
- __dict__ = <dictproxy object at 0x01A303B0>
- dictionary for instance variables (if defined)
- __weakref__ = <attribute '__weakref__' of 'Boundary' objects>
- list of weak references to the object (if defined)
|
class BoundaryError |
|
Base class for all Boundary exceptions
This class keeps references to the objects involved in the
transgression of the boundary. This allows for higher level
systems (such as a GUI application) to provide interactive
support for fixing the boundary transgression. |
|
Methods defined here:
- __init__(self, property, boundary, client, value, message='')
- Initialize the error, just stores the references to minimize overhead where the error isn't actually needed
- __repr__(self)
- Get a short user-friendly representation of the error
- __str__(self)
- Get a full user-friendly string representation of the error
Data and other attributes defined here:
- index = None
|
class LengthBoundary(Boundary) |
|
Restrict the length of value to between/above/below boundary minimum and/or maximum lengths
Conceptually, LengthBoundary is a very minor sub-class of
RangeBoundary, where the result of passing the value to
a function (in this case len) is compared with the boundary
values, rather then the initial value. This implementation
doesn't currently take advantage of this abstraction. |
|
- Method resolution order:
- LengthBoundary
- Boundary
- object
Methods defined here:
- __call__(self, property, client, value)
- Check value against boundary conditions
- __init__(self, minimum=[], maximum=[])
- Specify minimum and/or maximum, if one or both is left off, that bound is not checked
- __repr__(self)
Data and other attributes inherited from Boundary:
- __dict__ = <dictproxy object at 0x01A30DD0>
- dictionary for instance variables (if defined)
- __weakref__ = <attribute '__weakref__' of 'Boundary' objects>
- list of weak references to the object (if defined)
|
class NonNullBoundary(Boundary) |
|
Require that value evaluate to true (non-null) |
|
- Method resolution order:
- NonNullBoundary
- Boundary
- object
Methods defined here:
- __call__(self, property, client, value)
- Check value against boundary conditions
- __repr__(self)
Data and other attributes inherited from Boundary:
- __dict__ = <dictproxy object at 0x01A30D70>
- dictionary for instance variables (if defined)
- __weakref__ = <attribute '__weakref__' of 'Boundary' objects>
- list of weak references to the object (if defined)
|
class RangeBoundary(Boundary) |
|
Restrict the value to between/above/below boundary minimum and/or maximum values
The RangeBoundary allows you to constrain values based on
comparisons with minimum and/or maximum values. The class
allows for specifying one or both of the boundary conditions.
Note: minimum and maximum are included in the set of valid values
Note: although the obvious use for RangeBoundaries is for
simple data types (integers, floats, strings), there is nothing
in the Boundary itself which restricts the use to simple data
types. All that is required is the ability to compare instances
using the < and > operators |
|
- Method resolution order:
- RangeBoundary
- Boundary
- object
Methods defined here:
- __call__(self, property, client, value)
- Check value against boundary conditions
- __init__(self, minimum=[], maximum=[])
- Specify minimum and/or maximum, if one or both is left off, that bound is not checked
Note: minimum and maximum are included in the set of valid values
(i.e. the range is inclusive of the end points)
- __repr__(self)
Data and other attributes inherited from Boundary:
- __dict__ = <dictproxy object at 0x01A30DB0>
- dictionary for instance variables (if defined)
- __weakref__ = <attribute '__weakref__' of 'Boundary' objects>
- list of weak references to the object (if defined)
|
class TypeBoundary(Boundary) |
|
Restrict the type of the value to a subclass of a boundary type (or types)
The TypeBoundary provides a way of checking that a value
is an instance of a particular type, or one of a set of
types. Objects are within the boundary if:
isinstance( object, boundaryTypes ) |
|
- Method resolution order:
- TypeBoundary
- Boundary
- object
Methods defined here:
- __call__(self, property, client, value)
- Check value against boundary conditions
- __init__(self, boundaryType)
- Initialize the TypeBoundary object with a boundaryType specifier
The boundaryType specifier can be any of the following:
string -- dotted-name specifying the full class name
(including module) for a single class/type
for example "wxPython.wx.wxFramePtr"
This specification allows for late-binding of the
data type, which avoids mutual import problems in certain
situations.
Note: if this specification is used, the type boundary
may raise BoundaryTypeError exceptions on the first
__call__ of the Boundary when the attempt is made
to import the class/type.
class -- a single class/type object,
for example str or wxPython.wx.wxFramePtr
tuple -- a tuple of class/type objects,
for example ( str, list, tuple, unicode ) or
string specifiers (as above)
- __repr__(self)
- resolveBoundary(self, boundarySpecifier, property, client, value)
- Resolve a particular boundary specifier into a boundary class
Data and other attributes inherited from Boundary:
- __dict__ = <dictproxy object at 0x01A301F0>
- dictionary for instance variables (if defined)
- __weakref__ = <attribute '__weakref__' of 'Boundary' objects>
- list of weak references to the object (if defined)
| |