]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
- add docs for hybrid
authorMike Bayer <mike_mp@zzzcomputing.com>
Sun, 28 Nov 2010 22:13:07 +0000 (17:13 -0500)
committerMike Bayer <mike_mp@zzzcomputing.com>
Sun, 28 Nov 2010 22:13:07 +0000 (17:13 -0500)
doc/build/orm/extensions/hybrid.rst [new file with mode: 0644]
doc/build/orm/extensions/index.rst
lib/sqlalchemy/ext/hybrid.py

diff --git a/doc/build/orm/extensions/hybrid.rst b/doc/build/orm/extensions/hybrid.rst
new file mode 100644 (file)
index 0000000..e986f17
--- /dev/null
@@ -0,0 +1,12 @@
+Hybrid Attributes
+=================
+
+.. automodule:: sqlalchemy.ext.hybrid
+
+API Reference
+-------------
+
+.. autoclass:: method
+.. autoclass:: property_
+.. autoclass:: Comparator
+
index 5033ad5e9066fc82af2828709c125c8c45b56d76..05f86771cae5f1bf900d745698527e96fbababad 100644 (file)
@@ -14,5 +14,6 @@ functionality to the core behavior.
     declarative
     orderinglist
     horizontal_shard
+    hybrid
     sqlsoup
 
index 5bb158413b8ca580f31fb04ed5af9ce9b6b8b1bf..b499490718859425ca07bc7cbc0466046a90d208 100644 (file)
@@ -42,25 +42,10 @@ or as the class itself::
     
         @hybrid.method
         def intersects(self, other):
-            return (self.start < other.end) & (self.end > other.start)
+            return self.contains(other.start) | self.contains(other.end)
 
-    mapper(Interval1, interval_table1)
 
-    session = sessionmaker(engine)()
-
-    session.add_all(
-        [Interval1(1,4), Interval1(3,15), Interval1(11,16)]
-    )
-    intervals = 
-
-    for interval in intervals:
-        session.add(interval)
-        session.add(Interval2(interval.start, interval.length))
-
-    session.commit()
-
-    ### TODO ADD EXAMPLES HERE AND STUFF THIS ISN'T FINISHED ###
-    
+        
 """
 from sqlalchemy import util
 from sqlalchemy.orm import attributes, interfaces