[Schevo-devel] inheritance-fixes branch
Matthew Scott
mscott at springfieldtech.com
Thu Apr 27 14:23:07 EDT 2006
This branch is ready for review.
On Apr 27, 2006, at 12:09, schevo-commit at lists.orbtech.com wrote:
> Author: mscott
> Date: Thu Apr 27 13:09:12 2006
> New Revision: 2014
>
> Modified:
> Schevo/branches/inheritance-fixes/schevo/entity.py
> Log:
> Always create transaction and view subclasses for inner classes in
> entity
> class definitions, in case the entity class inherits from something
> other than
> E.Entity
>
>
>
> Modified: Schevo/branches/inheritance-fixes/schevo/entity.py
> ======================================================================
> ========
> --- Schevo/branches/inheritance-fixes/schevo/entity.py (original)
> +++ Schevo/branches/inheritance-fixes/schevo/entity.py Thu Apr 27
> 13:09:12 2006
> @@ -85,11 +85,16 @@
> _Create._field_spec = tx_spec.copy()
> cls._Create = _Create
> else:
> + # Always create a transaction subclass, in case the
> entity class
> + # inherits from something other than E.Entity
> + class _Create(cls._Create):
> + pass
> subclass_spec = cls._Create._field_spec
> - cls._Create._field_spec = tx_spec.copy()
> - cls._Create._field_spec.update(subclass_spec,
> reorder=True)
> - if hasattr(cls._Create, '_init_class'):
> - cls._Create._init_class()
> + _Create._field_spec = tx_spec.copy()
> + _Create._field_spec.update(subclass_spec, reorder=True)
> + if hasattr(_Create, '_init_class'):
> + _Create._init_class()
> + cls._Create = _Create
> cls._Create._fget_fields = cls._fget_fields
> # Delete
> if not hasattr(cls, '_Delete'):
> @@ -97,22 +102,33 @@
> pass
> cls._Delete = _Delete
> else:
> + # Always create a transaction subclass, in case the
> entity class
> + # inherits from something other than E.Entity
> + class _Delete(cls._Delete):
> + pass
> subclass_spec = cls._Delete._field_spec
> - cls._Delete._field_spec = tx_spec.copy()
> - cls._Delete._field_spec.update(subclass_spec,
> reorder=True)
> - if hasattr(cls._Delete, '_init_class'):
> - cls._Delete._init_class()
> + _Delete._field_spec = tx_spec.copy()
> + _Delete._field_spec.update(subclass_spec, reorder=True)
> + if hasattr(_Delete, '_init_class'):
> + _Delete._init_class()
> + cls._Delete = _Delete
> + cls._Delete._fget_fields = cls._fget_fields
> # Update
> if not hasattr(cls, '_Update'):
> class _Update(transaction.Update):
> pass
> cls._Update = _Update
> else:
> + # Always create a transaction subclass, in case the
> entity class
> + # inherits from something other than E.Entity
> + class _Update(cls._Update):
> + pass
> subclass_spec = cls._Update._field_spec
> - cls._Update._field_spec = tx_spec.copy()
> - cls._Update._field_spec.update(subclass_spec,
> reorder=True)
> - if hasattr(cls._Update, '_init_class'):
> - cls._Update._init_class()
> + _Update._field_spec = tx_spec.copy()
> + _Update._field_spec.update(subclass_spec, reorder=True)
> + if hasattr(_Update, '_init_class'):
> + _Update._init_class()
> + cls._Update = _Update
> cls._Update._fget_fields = cls._fget_fields
> #
> # Create standard view classes. View fields included in a
> @@ -126,11 +142,16 @@
> _DefaultView._field_spec = v_spec.copy()
> cls._DefaultView = _DefaultView
> else:
> + # Always create a view subclass, in case the entity class
> + # inherits from something other than E.Entity
> + class _DefaultView(cls._DefaultView):
> + pass
> subclass_spec = cls._DefaultView._field_spec
> - cls._DefaultView._field_spec = v_spec.copy()
> - cls._DefaultView._field_spec.update(subclass_spec,
> reorder=True)
> - if hasattr(cls._DefaultView, '_init_class'):
> - cls._DefaultView._init_class()
> + _DefaultView._field_spec = v_spec.copy()
> + _DefaultView._field_spec.update(subclass_spec,
> reorder=True)
> + if hasattr(_DefaultView, '_init_class'):
> + _DefaultView._init_class()
> + cls._DefaultView = _DefaultView
> cls._DefaultView._fget_fields = cls._fget_fields
> # Set the entity class and extent name on all of them.
> cls._Create._extent_name = class_name
> _______________________________________________
> Schevo-commit mailing list
> Schevo-commit at lists.orbtech.com
> http://lists.orbtech.com/mailman/listinfo/schevo-commit
--
Matthew Scott
mscott at springfieldtech.com
More information about the Schevo-devel
mailing list