Index: dassmodus/trunk/dassmodus/nosferatu/nosferatu/tools/generate_web2py_db_model.py
===================================================================
--- dassmodus/trunk/dassmodus/nosferatu/nosferatu/tools/generate_web2py_db_model.py	(revision 990)
+++ dassmodus/trunk/dassmodus/nosferatu/nosferatu/tools/generate_web2py_db_model.py	(revision 991)
@@ -52,7 +52,5 @@
 
 
-
-
-def item2field(item):
+def item2field(confshort, item):
     if item.name == 'where' : # where cannot be a column name in sqlite
       item.name = 'where_'
@@ -62,5 +60,7 @@
       if item.name.endswith('pool'):
         refname = 'pool'
-      fieldtype = 'reference dird_conf__%s'  %  (refname)
+      print '### ' + refname
+      
+      fieldtype = 'reference %s_conf__%s'  %  (confshort,refname)
       defaultvalue = 0
       return """ Field('%s','%s', default=%s), """ %(item.name, fieldtype , defaultvalue)
@@ -70,5 +70,5 @@
       if item.type == "store_bool":
         fieldtype = "boolean"
-        print "#####%s %s %s" % (item.name, item.defaultvalue, defaultvalue) 
+        #print "#####%s %s %s" % (item.name, item.defaultvalue, defaultvalue) 
         return """ Field('%s','%s', default=%s), """ %(item.name, fieldtype , defaultvalue)
       return """ Field('%s','%s', default='%s'), """ %(item.name, fieldtype , defaultvalue)
@@ -81,4 +81,5 @@
 dir_res_list = list()
  
+confshort = 'dird'
 for res in auto_configrules.dird_resources:
   res_name = res[0]
@@ -88,13 +89,13 @@
   print 
   #print res_name
-  print """db.define_table('dird_conf__%s',  """ % (res_name)
-  for item in res_items:
-    item.required=False
-    item.printall=True
-    print item2field(item)
-  print """ format='%(name)s')"""
-
-
-
+  print """db.define_table('%s_conf__%s',  """ % (confshort,res_name)
+  for item in res_items:
+    item.required=False
+    item.printall=True
+    print item2field(confshort,item)
+  print """ format='%(name)s')"""
+
+
+confshort = 'stored'
 stor_res_list = list()
 for res in auto_configrules.stored_resources:
@@ -105,13 +106,13 @@
   print 
   #print res_name
-  print """db.define_table('stored_conf__%s',  """ % (res_name)
-  for item in res_items:
-    item.required=False
-    item.printall=True
-    print item2field(item)
-  print """ format='%(name)s')"""
-
-
-
+  print """db.define_table('%s_conf__%s',  """ % (confshort,res_name)
+  for item in res_items:
+    item.required=False
+    item.printall=True
+    print item2field(confshort,item)
+  print """ format='%(name)s')"""
+
+
+confshort = 'filed'
 filed_res_list = list()
 for res in auto_configrules.filed_resources:
@@ -122,35 +123,39 @@
   print 
   #print res_name
-  print """db.define_table('filed_conf__%s',  """ % (res_name)
-  for item in res_items:
-    item.required=False
-    item.printall=True
-    print item2field(item)
-  print """ format='%(name)s')"""
-
-
-
-
-
-
-
-
-
-
-for res in dir_res_list:
-#  print """db.define_table('dird_conf__%s',
-#  Field('name','string'),
-#  format = '%%(name)s')
-#  """ % (res)
-   
+  print """db.define_table('%s_conf__%s',  """ % (confshort,res_name)
+  for item in res_items:
+    item.required=False
+    item.printall=True
+    print item2field(confshort,item)
+  print """ format='%(name)s')"""
+
+confshort = 'cons'
+cons_res_list = list()
+for res in auto_configrules.console_resources:
+  res_name = res[0]
+  res_type = res[1]
+  res_items = res[2]
+  cons_res_list.append(res_name)
+  print 
+  #print res_name
+  print """db.define_table('%s_conf__%s',  """ % (confshort,res_name)
+  for item in res_items:
+    item.required=False
+    item.printall=True
+    print item2field(confshort,item)
+  print """ format='%(name)s')"""
+
+
+
+
+
+for res in dir_res_list:   
   print """db.define_table('dird_conf__%s_link',
   Field('%s','reference dird_conf__%s'),
   format = '%%(id)s')
     """ % (res,res,res)
-
-
-
 print """db.define_table('dird_conf',
   Field('name','string'),"""
+
 for res in dir_res_list:
   print "  Field('dird_conf__%s', 'reference dird_conf__%s_link')," % (res,res )
@@ -160,9 +165,85 @@
 
 
-
-
-#for item in auto_configrules.dird_cat_items:
-#  item.required=False
-#  print """
-#   Field('%s','reference dird_conf_catalog'),
-#  """
+for res in stor_res_list:   
+  print """db.define_table('stord_conf__%s_link',
+  Field('%s','reference stord_conf__%s'),
+  format = '%%(id)s')
+    """ % (res,res,res)
+print """db.define_table('stord_conf',
+  Field('name','string'),"""
+
+for res in stor_res_list:
+  print "  Field('stord_conf__%s', 'reference stord_conf__%s_link')," % (res,res )
+print """  format='%(name)s')
+"""
+
+
+
+for res in filed_res_list:   
+  print """db.define_table('filed_conf__%s_link',
+  Field('%s','reference filed_conf__%s'),
+  format = '%%(id)s')
+    """ % (res,res,res)
+print """db.define_table('filed_conf',
+  Field('name','string'),"""
+
+for res in filed_res_list:
+  print "  Field('filed_conf__%s', 'reference filed_conf__%s_link')," % (res,res )
+print """  format='%(name)s')
+"""
+
+
+
+
+for res in cons_res_list:   
+  print """db.define_table('cons_conf__%s_link',
+  Field('%s','reference cons_conf__%s'),
+  format = '%%(id)s')
+    """ % (res,res,res)
+print """db.define_table('cons_conf',
+  Field('name','string'),"""
+
+for res in cons_res_list:
+  print "  Field('cons_conf__%s', 'reference cons_conf__%s_link')," % (res,res )
+print """  format='%(name)s')
+"""
+
+
+#Abhängikeiten:
+# dird 
+#  job/jobdefs   ->client
+#                -> pool
+#                -> fileset
+#                -> pool
+#                -> messages
+#                -> schedule
+#                -> storage
+#                -> jobdefs
+#                -> job
+# messages   -> catalog
+# counter    -> catalog
+# storage    -> device
+# director   -> messages
+# client     -> catalog
+# pool       -> catalog, storage
+
+
+# Reihenfolge:
+# storage->catalog->fileset->pool->jobdefs->client->
+# counter->messages->job->director
+
+
+
+# stored:
+# autochanger -> device
+# storage  -> messages
+# messages -> catalog
+
+# filed:
+# messages -> catalog
+# client/filedaemon -> messages
+
+
+
+
+
