Ticket #8 (closed review: fixed)

Opened 3 years ago

Last modified 20 months ago

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

Changed 3 years ago by mscott

  • description modified (diff)

Changed 3 years ago by mscott

  • milestone set to 2006 August software release

Changed 21 months ago by mscott

Milestone 2006 October software release deleted

Changed 21 months ago by mscott

  • component set to All Components
  • milestone set to Schevo 3.0.1

Seems worthwhile for inclusion in both 3.0.1 and 3.1; it enforces behavior that is desirable no matter which version you use.

Changed 21 months ago by mscott

  • milestone changed from Schevo 3.0.1 to Schevo 3.1

Milestone Schevo 3.0.1 deleted

Changed 20 months ago by mscott

  • owner set to mscott
  • status changed from new to assigned
  • type changed from discussion to implementation

implementation in r3174. tests and docs to follow.

Changed 20 months ago by mscott

  • type changed from implementation to review
  • milestone changed from Schevo 3.1 to Schevo 3.1a1

docs and doctest in r3176.

ready for review and merge.

Changed 20 months ago by mscott

  • status changed from assigned to closed
  • resolution set to fixed

Reviewed by pobrien, merged at r3189

Note: See TracTickets for help on using tickets.