Skip to content

Commit 606c2bd

Browse files
author
Richard Jones
committed
merge from HEAD
1 parent a8e6870 commit 606c2bd

File tree

11 files changed

+75
-151
lines changed

11 files changed

+75
-151
lines changed

CHANGES.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ Fixed:
2020
- consistent text searching behaviour (AND everywhere) (sf bug 1101036)
2121
- fix handling of invalid date input (sf bug 1102165)
2222
- retain Boolean selections in edit error handling (sf bug 1101492)
23+
- fix initialisation of logging module from config file (sf bug 1108577)
24+
- removed rlog module (py 2.3 is minimum version now)
2325

2426

2527
2005-01-13 0.8.0b2

roundup/backends/back_anydbm.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
1616
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
1717
#
18-
#$Id: back_anydbm.py,v 1.179.2.4 2005-02-13 22:40:53 richard Exp $
18+
#$Id: back_anydbm.py,v 1.179.2.5 2005-02-14 02:55:30 richard Exp $
1919
'''This module defines a backend that saves the hyperdatabase in a
2020
database chosen by anydbm. It is guaranteed to always be available in python
2121
versions >2.1.1 (the dumbdbm fallback in 2.1.1 and earlier has several
@@ -33,7 +33,7 @@
3333
except AssertionError:
3434
print "WARNING: you should upgrade to python 2.1.3"
3535

36-
import whichdb, os, marshal, re, weakref, string, copy, time, shutil
36+
import whichdb, os, marshal, re, weakref, string, copy, time, shutil, logging
3737

3838
from roundup import hyperdb, date, password, roundupdb, security
3939
from roundup.backends import locking
@@ -177,7 +177,7 @@ def getclass(self, classname):
177177
def clear(self):
178178
'''Delete all database contents
179179
'''
180-
self.config.logging.getLogger('hyperdb').info('clear')
180+
logging.getLogger('hyperdb').info('clear')
181181
for cn in self.classes.keys():
182182
for dummy in 'nodes', 'journals':
183183
path = os.path.join(self.dir, 'journals.%s'%cn)
@@ -223,7 +223,7 @@ def opendb(self, name, mode):
223223
# new database? let anydbm pick the best dbm
224224
if not db_type:
225225
if __debug__:
226-
self.config.logging.getLogger('hyperdb').debug("opendb anydbm.open(%r, 'c')"%path)
226+
logging.getLogger('hyperdb').debug("opendb anydbm.open(%r, 'c')"%path)
227227
return anydbm.open(path, 'c')
228228

229229
# open the database with the correct module
@@ -234,7 +234,7 @@ def opendb(self, name, mode):
234234
"Couldn't open database - the required module '%s'"\
235235
" is not available"%db_type
236236
if __debug__:
237-
self.config.logging.getLogger('hyperdb').debug("opendb %r.open(%r, %r)"%(db_type, path,
237+
logging.getLogger('hyperdb').debug("opendb %r.open(%r, %r)"%(db_type, path,
238238
mode))
239239
return dbm.open(path, mode)
240240

@@ -295,7 +295,7 @@ def savenode(self, classname, nodeid, node):
295295
''' perform the saving of data specified by the set/addnode
296296
'''
297297
if __debug__:
298-
self.config.logging.getLogger('hyperdb').debug('save %s%s %r'%(classname, nodeid, node))
298+
logging.getLogger('hyperdb').debug('save %s%s %r'%(classname, nodeid, node))
299299
self.transactions.append((self.doSaveNode, (classname, nodeid, node)))
300300

301301
def getnode(self, classname, nodeid, db=None, cache=1):
@@ -308,14 +308,14 @@ def getnode(self, classname, nodeid, db=None, cache=1):
308308
cache_dict = self.cache.setdefault(classname, {})
309309
if cache_dict.has_key(nodeid):
310310
if __debug__:
311-
self.config.logging.getLogger('hyperdb').debug('get %s%s cached'%(classname, nodeid))
311+
logging.getLogger('hyperdb').debug('get %s%s cached'%(classname, nodeid))
312312
self.stats['cache_hits'] += 1
313313
return cache_dict[nodeid]
314314

315315
if __debug__:
316316
self.stats['cache_misses'] += 1
317317
start_t = time.time()
318-
self.config.logging.getLogger('hyperdb').debug('get %s%s'%(classname, nodeid))
318+
logging.getLogger('hyperdb').debug('get %s%s'%(classname, nodeid))
319319

320320
# get from the database and save in the cache
321321
if db is None:
@@ -347,7 +347,7 @@ def destroynode(self, classname, nodeid):
347347
'''Remove a node from the database. Called exclusively by the
348348
destroy() method on Class.
349349
'''
350-
self.config.logging.getLogger('hyperdb').info('destroy %s%s'%(classname, nodeid))
350+
logging.getLogger('hyperdb').info('destroy %s%s'%(classname, nodeid))
351351

352352
# remove from cache and newnodes if it's there
353353
if (self.cache.has_key(classname) and
@@ -473,7 +473,7 @@ def addjournal(self, classname, nodeid, action, params, creator=None,
473473
the current user.
474474
'''
475475
if __debug__:
476-
self.config.logging.getLogger('hyperdb').debug('addjournal %s%s %s %r %s %r'%(classname,
476+
logging.getLogger('hyperdb').debug('addjournal %s%s %s %r %s %r'%(classname,
477477
nodeid, action, params, creator, creation))
478478
if creator is None:
479479
creator = self.getuid()
@@ -483,7 +483,7 @@ def addjournal(self, classname, nodeid, action, params, creator=None,
483483
def setjournal(self, classname, nodeid, journal):
484484
'''Set the journal to the "journal" list.'''
485485
if __debug__:
486-
self.config.logging.getLogger('hyperdb').debug('setjournal %s%s %r'%(classname,
486+
logging.getLogger('hyperdb').debug('setjournal %s%s %r'%(classname,
487487
nodeid, journal))
488488
self.transactions.append((self.doSetJournal, (classname, nodeid,
489489
journal)))
@@ -570,7 +570,7 @@ def pack(self, pack_before):
570570
packed += 1
571571
db[key] = marshal.dumps(l)
572572

573-
self.config.logging.getLogger('hyperdb').info('packed %d %s items'%(packed,
573+
logging.getLogger('hyperdb').info('packed %d %s items'%(packed,
574574
classname))
575575

576576
if db_type == 'gdbm':
@@ -584,7 +584,7 @@ def pack(self, pack_before):
584584
def commit(self):
585585
''' Commit the current transactions.
586586
'''
587-
self.config.logging.getLogger('hyperdb').info('commit %s transactions'%(
587+
logging.getLogger('hyperdb').info('commit %s transactions'%(
588588
len(self.transactions)))
589589

590590
# keep a handle to all the database files opened
@@ -705,7 +705,7 @@ def doDestroyNode(self, classname, nodeid):
705705
def rollback(self):
706706
''' Reverse all actions from the current transaction.
707707
'''
708-
self.config.logging.getLogger('hyperdb').info('rollback %s transactions'%(
708+
logging.getLogger('hyperdb').info('rollback %s transactions'%(
709709
len(self.transactions)))
710710

711711
for method, args in self.transactions:

roundup/backends/back_metakit.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# $Id: back_metakit.py,v 1.88.2.2 2005-02-14 01:26:14 richard Exp $
1+
# $Id: back_metakit.py,v 1.88.2.3 2005-02-14 02:55:31 richard Exp $
22
'''Metakit backend for Roundup, originally by Gordon McMillan.
33
44
Known Current Bugs:
@@ -42,6 +42,7 @@
4242
BACKWARDS_COMPATIBLE = 1
4343

4444
from roundup import hyperdb, date, password, roundupdb, security
45+
import logging
4546
import metakit
4647
from sessions_dbm import Sessions, OneTimeKeys
4748
import re, marshal, os, sys, time, calendar, shutil
@@ -259,7 +260,7 @@ def getjournal(self, tablenm, nodeid):
259260
try:
260261
params = marshal.loads(row.params)
261262
except ValueError:
262-
self.config.logging.getLogger("hyperdb").error(
263+
logging.getLogger("hyperdb").error(
263264
"history couldn't unmarshal %r" % row.params)
264265
params = {}
265266
#usernm = userclass.get(str(row.user), 'username')
@@ -1374,14 +1375,14 @@ def ff(row, r=regexes):
13741375
try:
13751376
prop = getattr(v, propname)
13761377
except AttributeError:
1377-
self.config.logging.getLogger("hyperdb").error(
1378+
logging.getLogger("hyperdb").error(
13781379
"MK has no property %s" % propname)
13791380
continue
13801381
propclass = self.ruprops.get(propname, None)
13811382
if propclass is None:
13821383
propclass = self.privateprops.get(propname, None)
13831384
if propclass is None:
1384-
self.config.logging.getLogger("hyperdb").error(
1385+
logging.getLogger("hyperdb").error(
13851386
"Schema has no property %s" % propname)
13861387
continue
13871388
if isinstance(propclass, hyperdb.Link):

roundup/backends/back_mysql.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
import MySQLdb
3939
import os, shutil
4040
from MySQLdb.constants import ER
41+
import logging
4142

4243
def connection_dict(config, dbnamestr=None):
4344
d = rdbms_common.connection_dict(config, dbnamestr)
@@ -66,10 +67,10 @@ def db_nuke(config):
6667
for table in tables:
6768
command = 'DROP TABLE %s'%table[0]
6869
if __debug__:
69-
config.logging.getLogger('hyperdb').debug(command)
70+
logging.getLogger('hyperdb').debug(command)
7071
cursor.execute(command)
7172
command = "DROP DATABASE %s"%config.RDBMS_NAME
72-
config.logging.getLogger('hyperdb').info(command)
73+
logging.getLogger('hyperdb').info(command)
7374
cursor.execute(command)
7475
conn.commit()
7576
conn.close()
@@ -83,7 +84,7 @@ def db_create(config):
8384
conn = MySQLdb.connect(**kwargs)
8485
cursor = conn.cursor()
8586
command = "CREATE DATABASE %s"%config.RDBMS_NAME
86-
config.logging.getLogger('hyperdb').info(command)
87+
logging.getLogger('hyperdb').info(command)
8788
cursor.execute(command)
8889
conn.commit()
8990
conn.close()
@@ -138,8 +139,7 @@ class Database(Database):
138139

139140
def sql_open_connection(self):
140141
kwargs = connection_dict(self.config, 'db')
141-
self.config.logging.getLogger('hyperdb').info('open database %r'%(
142-
kwargs['db'],))
142+
logging.getLogger('hyperdb').info('open database %r'%(kwargs['db'],))
143143
try:
144144
conn = MySQLdb.connect(**kwargs)
145145
except MySQLdb.OperationalError, message:
@@ -474,7 +474,7 @@ def create_class(self, spec):
474474
def sql_commit(self):
475475
''' Actually commit to the database.
476476
'''
477-
self.config.logging.getLogger('hyperdb').info('commit')
477+
logging.getLogger('hyperdb').info('commit')
478478
self.conn.commit()
479479

480480
# open a new cursor for subsequent work

roundup/backends/back_postgresql.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
import os, shutil, popen2, time
1212
import psycopg
13+
import logging
1314

1415
from roundup import hyperdb, date
1516
from roundup.backends import rdbms_common
@@ -26,13 +27,13 @@ def connection_dict(config, dbnamestr=None):
2627
def db_create(config):
2728
"""Clear all database contents and drop database itself"""
2829
command = 'CREATE DATABASE %s'%config.RDBMS_NAME
29-
config.logging.getLogger('hyperdb').info(command)
30+
logging.getLogger('hyperdb').info(command)
3031
db_command(config, command)
3132

3233
def db_nuke(config, fail_ok=0):
3334
"""Clear all database contents and drop database itself"""
3435
command = 'DROP DATABASE %s'% config.RDBMS_NAME
35-
config.logging.getLogger('hyperdb').info(command)
36+
logging.getLogger('hyperdb').info(command)
3637
db_command(config, command)
3738

3839
if os.path.exists(config.DATABASE):
@@ -95,8 +96,7 @@ class Database(rdbms_common.Database):
9596

9697
def sql_open_connection(self):
9798
db = connection_dict(self.config, 'database')
98-
self.config.logging.getLogger('hyperdb').info('open database %r'%(
99-
db['database'],))
99+
logging.getLogger('hyperdb').info('open database %r'%db['database'])
100100
try:
101101
conn = psycopg.connect(**db)
102102
except psycopg.OperationalError, message:

roundup/backends/back_sqlite.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# $Id: back_sqlite.py,v 1.36.2.2 2005-01-04 01:33:03 richard Exp $
1+
# $Id: back_sqlite.py,v 1.36.2.3 2005-02-14 02:55:31 richard Exp $
22
'''Implements a backend for SQLite.
33
44
See https://pysqlite.sourceforge.net/ for pysqlite info
@@ -9,7 +9,7 @@
99
'''
1010
__docformat__ = 'restructuredtext'
1111

12-
import os, base64, marshal, shutil, time
12+
import os, base64, marshal, shutil, time, logging
1313

1414
from roundup import hyperdb, date, password
1515
from roundup.backends import locking
@@ -85,7 +85,7 @@ def sql_open_connection(self):
8585
os.makedirs(self.config.DATABASE)
8686

8787
db = os.path.join(self.config.DATABASE, 'db')
88-
self.config.logging.getLogger('hyperdb').info('open database %r'%db)
88+
logging.getLogger('hyperdb').info('open database %r'%db)
8989
conn = sqlite.connect(db=db)
9090
# set a 30 second timeout (extraordinarily generous) for handling
9191
# locked database
@@ -159,7 +159,7 @@ def update_class(self, spec, old_spec, force=0, adding_v2=0):
159159
# no changes
160160
return 0
161161

162-
self.config.logging.getLogger('hyperdb').info('update_class %s'%spec.classname)
162+
logging.getLogger('hyperdb').info('update_class %s'%spec.classname)
163163

164164
# detect multilinks that have been removed, and drop their table
165165
old_has = {}

0 commit comments

Comments
 (0)