[Checkins] SVN: z3c.sqlalchemy/branches/elixir-integration/src/z3c/sqlalchemy/ cleanup

Andreas Jung andreas at andreas-jung.com
Thu May 10 02:23:39 EDT 2007


Log message for revision 75664:
  cleanup
  

Changed:
  U   z3c.sqlalchemy/branches/elixir-integration/src/z3c/sqlalchemy/interfaces.py
  U   z3c.sqlalchemy/branches/elixir-integration/src/z3c/sqlalchemy/model.py

-=-
Modified: z3c.sqlalchemy/branches/elixir-integration/src/z3c/sqlalchemy/interfaces.py
===================================================================
--- z3c.sqlalchemy/branches/elixir-integration/src/z3c/sqlalchemy/interfaces.py	2007-05-10 06:00:14 UTC (rev 75663)
+++ z3c.sqlalchemy/branches/elixir-integration/src/z3c/sqlalchemy/interfaces.py	2007-05-10 06:23:39 UTC (rev 75664)
@@ -95,6 +95,10 @@
         """
 
 
+    def addEntity(name, entity):
+        """ Registers an elixir.Entity subclass as 'name' """
+
+
     def items():
         """ return items in insertion order """
 

Modified: z3c.sqlalchemy/branches/elixir-integration/src/z3c/sqlalchemy/model.py
===================================================================
--- z3c.sqlalchemy/branches/elixir-integration/src/z3c/sqlalchemy/model.py	2007-05-10 06:00:14 UTC (rev 75663)
+++ z3c.sqlalchemy/branches/elixir-integration/src/z3c/sqlalchemy/model.py	2007-05-10 06:23:39 UTC (rev 75664)
@@ -14,6 +14,12 @@
 import sqlalchemy
 from zope.interface import implements
 
+try:
+    from elixir import Entity
+    HAVE_ELIXIR = True
+except ImportError:
+    HAVE_ELIXIR = False
+
 from mapper import MappedClassBase
 from interfaces import IModel
 
@@ -39,9 +45,16 @@
         for d in args:
             self.add(**d)
 
-    def addElixir(self, name, entity):
-        """ Blurb """
 
+    def addEntity(self, name, entity):
+        """ Add an Elixir entitiy"""
+
+        if not HAVE_ELIXIR:
+            raise TypeError('Elixir support is not available since the exlir package is not available')
+
+        if not issubclass(entity, Entity):
+            raise TypeError("'entity' must be an instance of elixir.Entity'")
+
         self.names.append(name)
         self[name] = {'name' : name,
                       'entity' : entity,



More information about the Checkins mailing list