diff util.py @ 119:04a730f9d07d backend

move all sqlalchemy related classes to the respective sub-package. use a backend to abstract from access to the data
author Dirk Olmes <dirk@xanthippe.ping.de>
date Sun, 21 Aug 2011 03:55:16 +0200
parents 254d5b89a6ca
children c923e4c57a81
line wrap: on
line diff
--- a/util.py	Sun Aug 21 02:47:25 2011 +0200
+++ b/util.py	Sun Aug 21 03:55:16 2011 +0200
@@ -1,27 +1,28 @@
 
-from datetime import datetime, timedelta
 from Feed import Feed
+from datetime import datetime, timedelta
 import logging
-import sys
 
 logger = logging.getLogger("database")
 
-def databaseLoggingEnabled():
-    loggingEnabled = False
-    for arg in sys.argv:
-        if arg == "--databaseLogging":
-            loggingEnabled = True
-    return loggingEnabled
+# TODO remove this
+#def databaseLoggingEnabled():
+#    loggingEnabled = False
+#    for arg in sys.argv:
+#        if arg == "--databaseLogging":
+#            loggingEnabled = True
+#    return loggingEnabled
 
-def configureLogging():
-    logging.basicConfig(level=logging.DEBUG)
-    
-    sqlalchemyLogLevel = logging.ERROR
-    if databaseLoggingEnabled():
-        sqlalchemyLogLevel = logging.INFO
-    logging.getLogger("sqlalchemy").setLevel(sqlalchemyLogLevel)
-    
-    logging.getLogger("sqlalchemy.orm").setLevel(logging.WARN)
+# TODO remove this
+#def configureLogging():
+#    logging.basicConfig(level=logging.DEBUG)
+#
+#    sqlalchemyLogLevel = logging.ERROR
+#    if databaseLoggingEnabled():
+#        sqlalchemyLogLevel = logging.INFO
+#    logging.getLogger("sqlalchemy").setLevel(sqlalchemyLogLevel)
+#
+#    logging.getLogger("sqlalchemy.orm").setLevel(logging.WARN)
 
 def loadFeeds(session=None, filename="feeds.txt"):
     file = open(filename)
@@ -39,11 +40,3 @@
         feed.next_update = datetime.now() - timedelta(minutes=1)
     session.commit()
 
-def str2bool(string):
-    return string.lower() in ["yes", "true", "t", "1"]
-
-def bool2str(bool):
-    if bool:
-        return "True"
-    else:
-        return "False"