CedarBackup2.config.ActionHook

Package CedarBackup2 :: Module config :: Class ActionHook |
[hide private]
[frames] | no frames]

# Class ActionHook

source code

    object --+
             |
            ActionHook

Known Subclasses:
  - PostActionHook
  - , PreActionHook

Class representing a hook associated with an action.

A hook associated with an action is a shell command to be executed either before or after a named action is executed.

The following restrictions exist on data in this class:

- The action name must be a non-empty string matching `ACTION_NAME_REGEX`
- The shell command must be a non-empty string.

The internal `before` and `after` instance variables are always set to False in this parent class.

Instance Methods | [hide private]
__init__(self, action=None, command=None) Constructor for the `ActionHook` class. | source code
__repr__(self) Official string representation for class instance. | source code
__str__(self) Informal string representation for class instance. | source code
__cmp__(self, other) Definition of equals operator for this class. | source code
_setAction(self, value) Property target used to set the action name. | source code
_getAction(self) Property target used to get the action name. | source code
_setCommand(self, value) Property target used to set the command. | source code
_getCommand(self) Property target used to get the command. | source code
_getBefore(self) Property target used to get the before flag. | source code
_getAfter(self) Property target used to get the after flag. | source code
Inherited from `object`: `__delattr__`, `__format__`, `__getattribute__`, `__hash__`, `__new__`, `__reduce__`, `__reduce_ex__`, `__setattr__`, `__sizeof__`, `__subclasshook__`

Properties | [hide private]
| action Action this hook is associated with.
| command Shell command to execute.
| before Indicates whether command should be executed before action.
| after Indicates whether command should be executed after action.
Inherited from `object`: `__class__`

Method Details | [hide private]

### __init__(self, action=None, command=None) (Constructor) | source code
Constructor for the `ActionHook` class. Parameters: `action` - Action this hook is associated with `command` - Shell command to execute Raises: `ValueError` - If one of the values is invalid. Overrides: object.__init__

### __repr__(self) (Representation operator) | source code
Official string representation for class instance. Overrides: object.__repr__

### __str__(self) (Informal representation operator) | source code
Informal string representation for class instance. Overrides: object.__str__

### __cmp__(self, other) (Comparison operator) | source code
Definition of equals operator for this class. Parameters: `other` - Other object to compare to. Returns: -1/0/1 depending on whether self is `<`, `=` or `>` other.

### _setAction(self, value) | source code
Property target used to set the action name. The value must be a non-empty string if it is not `None`. It must also consist only of lower-case letters and digits. Raises: `ValueError` - If the value is an empty string.

### _setCommand(self, value) | source code
Property target used to set the command. The value must be a non-empty string if it is not `None`. Raises: `ValueError` - If the value is an empty string.

Property Details | [hide private]

### action Action this hook is associated with. Get Method: _getAction(self) - Property target used to get the action name. Set Method: _setAction(self, value) - Property target used to set the action name.

### command Shell command to execute. Get Method: _getCommand(self) - Property target used to get the command. Set Method: _setCommand(self, value) - Property target used to set the command.

### before Indicates whether command should be executed before action. Get Method: _getBefore(self) - Property target used to get the before flag.

### after Indicates whether command should be executed after action. Get Method: _getAfter(self) - Property target used to get the after flag.