twisted.python._oldstyle module documentationtwisted.python
View Source
Utilities to assist in the "flag day" new-style object transition.
| Function | passthru | Return arg. Do nothing. |
| Function | _shouldEnableNewStyle | No summary |
| Function | _ensureOldClass | Ensure that cls is an old-style class. |
| Function | _oldStyle | No summary |
Returns whether or not we should enable the new-style conversion of
old-style classes. It inspects the environment for
TWISTED_NEWSTYLE, accepting an empty string, no,
false, False, and 0 as falsey values
and everything else as a truthy value.
| Returns | (type: bool) | |
Ensure that cls is an old-style class.
| Parameters | cls | The class to check. |
| Returns | The class, if it is an old-style class. | |
| Raises | ValueError
if it is a new-style class. | |
A decorator which conditionally converts old-style classes to new-style
classes. If it is Python 3, or if the TWISTED_NEWSTYLE
environment variable has a falsey (no, false,
False, or 0) value in the environment, this
decorator is a no-op.
| Parameters | cls | An old-style class to convert to new-style. (type: types.ClassType) |
| Returns | A new-style version of cls. | |