ModifyPassage¶
-
class
ucca.core.ModifyPassage(fn)[source]¶ Bases:
objectDecorator for changing a
Passageor any member of it.This decorator is mandatory for anything which causes the elements in a
Passageto change by adding or removing an element, or changing an attribute.It validates that the Passage is not frozen before allowing the change.
The decorator can’t be used for __init__ calls, as at the stage of the check there are no instance attributes to check. So in such cases, a function that binds the object created with the Passage should be decorated instead (and should be called after the instance attributes are set).
- Attributes:
- fn: the function object to decorate
Methods Summary
__call__(*args, **kwargs)Decorating functions which modify Passageelements.Methods Documentation
-
__call__(*args, **kwargs)[source]¶ Decorating functions which modify
Passageelements.Parameters: - args – list of all arguments, assuming the first is the object
which modifies
Passage, and it has an attribute root which points to the Passage it is part of. - kwargs – list of all keyword arguments
Returns: The decorated function result.
Raises: FrozenPassageError – if the
Passageis frozen and can’t be modified.- args – list of all arguments, assuming the first is the object
which modifies