--- a/iro/install.py Fri Mar 30 02:25:20 2012 +0200
+++ b/iro/install.py Fri Mar 30 11:23:22 2012 +0200
@@ -17,6 +17,11 @@
from . import config
def checkConfig():
+ """check configuration file syntax.
+
+ :return: boolena value.
+ """
+
try:
l = configParser.read(confFiles)
if len(l) > 0:
@@ -27,6 +32,10 @@
return False
def checkDatabase():
+ """Checks, if all tables are created.
+
+ :return: boolean value
+ """
engine = create_engine(config.main.dburl)
for t in Base.metadata.sorted_tables:
if not t.exists(engine):
@@ -34,6 +43,10 @@
return True
def checkDatabaseConnection():
+ """Checks, if database can be connected.
+
+ :return: boolean value
+ """
try:
engine = create_engine(config.main.dburl)
con = engine.connect()
@@ -44,10 +57,12 @@
return False
def createDatabase():
+ """Create all database tables or only missing."""
engine = create_engine(config.main.dburl)
Base.metadata.create_all(engine)
def createSampleConfig():
+ """create a sample configuration file 'iro.conf' with all possible provider sections."""
if not os.path.exists("iro.conf"):
with open("iro.conf",'w') as fp:
fp.write("\n".join(main.sampleConf()))
@@ -61,6 +76,14 @@
log.msg("iro.conf exists and will not be overwritten.")
def getAllRoutes(providers,write=False):
+ """Checks and update offer list.
+
+ :param boolean write: check or update list
+ :return dict:
+ - **"orphand"** (Set) -- a set of orphand offers
+ - **"added"** (Set) -- a set of new offers. The new name have a schema provider_typ_route
+
+ """
engine = create_engine(config.main.dburl)
ret={"orphand":Set(),"added":Set()}
with WithSession(engine,write) as session: