diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2005-12-23 01:49:44 +0000 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2005-12-23 01:49:44 +0000 |
commit | 8111fda29fe49146d3858ea1b4a53088e8beb0de (patch) | |
tree | b6dc40987d9c49dee13bdadddefa9e104a0fbe48 /lib/sqlalchemy/attributes.py | |
parent | dbd407d62ac3cbf6e54de7499f1a95b54e3e4204 (diff) | |
download | sqlalchemy-8111fda29fe49146d3858ea1b4a53088e8beb0de.tar.gz |
refactor/cleanup to mapper options methodology to allow for incoming defer/undefer options
mapper/relations are stricter about class attributes and primary mapper - is_primary flag
on relations fixed (wasnt working before). new primary mappers clear off old class attributes,
secondary mappers insure that their property was set up by the primary; otherwise secondary
mappers can add behavior to properties that are unmanaged by the primary mapper
added "group" option to deferred loaders so a group of properties can be loaded at once
mapper adds the "oid" column to the select list if "distinct" is set to true and its
using the default "order by oid" ordering (mysql benefits from ansisql fix to only print out unique
columns in the select list since its oid is the same as the pk column)
fixed unittests to comply with stricter primary mapper rules
Diffstat (limited to 'lib/sqlalchemy/attributes.py')
-rw-r--r-- | lib/sqlalchemy/attributes.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/sqlalchemy/attributes.py b/lib/sqlalchemy/attributes.py index ed5da3284..2cc617612 100644 --- a/lib/sqlalchemy/attributes.py +++ b/lib/sqlalchemy/attributes.py @@ -374,7 +374,21 @@ class AttributeManager(object): class_._attribute_manager = self return attr + def reset_class_managed(self, class_): + try: + attr = getattr(class_, '_class_managed_attributes') + for key in attr.keys(): + delattr(class_, key) + delattr(class_, '_class_managed_attributes') + except AttributeError: + pass + def is_class_managed(self, class_, key): + try: + return class_._class_managed_attributes.has_key(key) + except AttributeError: + return False + def create_history_container(self, obj, key, uselist, callable_ = None, **kwargs): """creates a new history container for the given attribute on the given object.""" if callable_ is not None: |