Package PyFoam :: Package Infrastructure :: Package RunHooks :: Module WriteToSqliteDatabase
[hide private]
[frames] | no frames]

Source Code for Module PyFoam.Infrastructure.RunHooks.WriteToSqliteDatabase

 1  """Write the data to a sqlite database""" 
 2   
 3  from PyFoam.Infrastructure.RunHook import RunHook 
 4   
 5  from PyFoam.Error import error 
 6   
 7  from PyFoam.Basics.RunDatabase import RunDatabase 
 8   
 9  from os import path 
10   
11 -class WriteToSqliteDatabase(RunHook):
12 """Write the run information to a sqlite database"""
13 - def __init__(self,runner,name):
14 RunHook.__init__(self,runner,name) 15 16 self.create=self.conf().getboolean("createDatabase") 17 self.database=path.expanduser(self.conf().get("database")) 18 19 if not self.create and not path.exists(self.database): 20 error("The database",self.database,"does not exists")
21
22 - def __call__(self):
23 print "Adding run information to database",self.database 24 db=RunDatabase(self.database,create=self.create) 25 db.add(self.runner.getData())
26