Switch to unified view

a/bitergiametrics/main.py b/bitergiametrics/main.py
...
...
134
        
134
        
135
        # TODO: error and config management. Share db connection
135
        # TODO: error and config management. Share db connection
136
        bichodb = None
136
        bichodb = None
137
        tickets_per_week = None
137
        tickets_per_week = None
138
        try:
138
        try:
139
            bichodb = MySQLdb.connect(user="root", db="bicho1")
139
            bichodb = MySQLdb.connect(user="root", db="bicho")
140
            cursor = bichodb.cursor()
140
            cursor = bichodb.cursor()
141
            cursor.execute("SELECT DATE_FORMAT(submitted_on, '%Y%V') AS yearweek, COUNT(*) AS nissues FROM issues GROUP BY yearweek")
141
            cursor.execute("SELECT DATE_FORMAT(submitted_on, '%Y%V') AS yearweek, COUNT(*) AS nissues FROM issues GROUP BY yearweek")
142
            tickets_per_week = cursor.fetchall()
142
            tickets_per_week = cursor.fetchall()
143
            bichodb.close()
144
        except MySQLdb.Error, e:
143
        except MySQLdb.Error, e:
145
            log.error("Error accessing Bicho %d: %s" % (e.args[0], e.args[1]))
144
            log.error("Error accessing Bicho %d: %s" % (e.args[0], e.args[1]))
146
        finally:
145
        finally:
147
            if bichodb:
146
            if bichodb:
148
                bichodb.close()
147
                bichodb.close()