Ticket #8 (closed review: fixed)
Prevent Create/Delete/Update subclasses from overriding _execute and __init__ methods
| Reported by: | mscott | Owned by: | mscott |
|---|---|---|---|
| Priority: | normal | Milestone: | Schevo 3.1a1 |
| Component: | All Components | Keywords: | |
| Cc: |
Description (last modified by mscott) (diff)
The best practice for customizing Create, Delete, and Update subclasses is to define _setup, _before_execute, and _after_execute methods, and to do nothing with __init__ and _execute.
Because of the complexity of __init__ and _execute themselves for these types of transactions, we need to prevent them from even being defined for subclasses of those transaction types, thus enforcing the practice described above.
Proposed implementation:
- Add _restrict_subclasses = False to base Transaction class.
- In Create, Delete, and Update subclasses, set _restrict_subclasses = True
- Create a TransactionMeta(schema_metaclass('T')) class in schevo.transaction, and extend it to check for _restrict_subclasses; if that is True, then raise an exception if __init__ or _execute are in the class_dict passed to the metaclass.
Change History
Note: See
TracTickets for help on using
tickets.
