diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2012-06-24 02:06:10 -0400 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2012-06-24 02:06:10 -0400 |
| commit | 319aa982a1312d59076478a001d6c42eaa123e70 (patch) | |
| tree | a0d59883c18fabe81833128604b4a8ea4b569e0f /lib/sqlalchemy/util/langhelpers.py | |
| parent | e47f2e03ce02f1fa1b313970291a2c024620bd73 (diff) | |
| download | sqlalchemy-319aa982a1312d59076478a001d6c42eaa123e70.tar.gz | |
- [moved] The InstrumentationManager interface
and the entire related system of alternate
class implementation is now moved out
to sqlalchemy.ext.instrumentation. This is
a seldom used system that adds significant
complexity and overhead to the mechanics of
class instrumentation. The new architecture
allows it to remain unused until
InstrumentationManager is actually imported,
at which point it is bootstrapped into
the core.
Diffstat (limited to 'lib/sqlalchemy/util/langhelpers.py')
| -rw-r--r-- | lib/sqlalchemy/util/langhelpers.py | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/lib/sqlalchemy/util/langhelpers.py b/lib/sqlalchemy/util/langhelpers.py index 9e5b0e4ad..8d08da4d8 100644 --- a/lib/sqlalchemy/util/langhelpers.py +++ b/lib/sqlalchemy/util/langhelpers.py @@ -622,7 +622,9 @@ class importlater(object): def module(self): if self in importlater._unresolved: raise ImportError( - "importlater.resolve_all() hasn't been called") + "importlater.resolve_all() hasn't " + "been called (this is %s %s)" + % (self._il_path, self._il_addtl)) m = self._initial_import if self._il_addtl: @@ -821,6 +823,17 @@ class classproperty(property): def __get__(desc, self, cls): return desc.fget(cls) +class hybridmethod(object): + """Decorate a function as cls- or instance- level.""" + def __init__(self, func, expr=None): + self.func = func + + def __get__(self, instance, owner): + if instance is None: + return self.func.__get__(owner, owner.__class__) + else: + return self.func.__get__(instance, owner) + class _symbol(int): def __new__(self, name, doc=None, canonical=None): |
