--- a/createdoc.py Sat Mar 24 01:05:34 2012 +0100
+++ b/createdoc.py Sat Mar 24 01:06:51 2012 +0100
@@ -10,9 +10,7 @@
from iro.view.xmlrpc_old import User as Current
from iro.controller.viewinterface import Interface as New
-from createerm import createSchemaPlot, tables
-
-
+from createerm import createSchemaPlot, tables, tables_cls
class Link():
def __init__(self,name,title):
@@ -151,7 +149,7 @@
Method("defaultRoute",new_methods),
]
- t = [Table(f.class_) for f in tables]
+ t = [Table(tables_cls[str(f)]) for f in tables]
createSchemaPlot('doc/images/db-schema.svg')
for site in sites:
--- a/createerm.py Sat Mar 24 01:05:34 2012 +0100
+++ b/createerm.py Sat Mar 24 01:06:51 2012 +0100
@@ -1,13 +1,15 @@
from iro.model import schema
-from sqlalchemy.orm import class_mapper
-tables = []
-for attr in schema.__tables__:
- if attr[0] == '_': continue
+tables = schema.Base.metadata.sorted_tables
+
+tables_cls={}
+for i in dir(schema):
+ if i.startswith("__") or i == "Base":
+ continue
try:
- cls = getattr(schema, attr)
- tables.append(class_mapper(cls))
- except:
+ a = getattr(schema,i)
+ tables_cls[a.__tablename__] = a
+ except AttributeError:
pass