git-svn-id: https://linkchecker.svn.sourceforge.net/svnroot/linkchecker/trunk/linkchecker@2680 e7d03fd6-7b0d-0410-9947-9c21f3af8025
This commit is contained in:
calvin 2005-06-28 10:03:04 +00:00
parent 555e2dc2a4
commit 506eaa21b5
2 changed files with 18 additions and 6 deletions

View file

@ -229,13 +229,13 @@ class Configuration (dict):
if not cfiles:
# system wide config settings
config_dir = _linkchecker_configdata.config_dir
path = normpath(os.path.join(config_dir, "linkcheckerrc"))
if os.path.exists(path):
cfiles.append(path)
path = normpath(os.path.join(config_dir, "linkcheckerrc"))
if os.path.exists(path):
cfiles.append(path)
# per user config settings
path = normpath("~/.linkchecker/linkcheckerrc")
if os.path.exists(path):
cfiles.append(path)
path = normpath("~/.linkchecker/linkcheckerrc")
if os.path.exists(path):
cfiles.append(path)
self.read_config(cfiles)
# re-init logger
self['logger'] = self.logger_new('text')

View file

@ -12,6 +12,9 @@ def deprecated (func):
It emits a warning when the function is called.
"""
def newfunc (*args, **kwargs):
"""
Print deprecated warning and execute original function.
"""
warnings.warn("Call to deprecated function %s." % func.__name__,
category=DeprecationWarning)
return func(*args, **kwargs)
@ -31,6 +34,9 @@ def signal_handler (signal_number):
"""
# create the 'real' decorator which takes only a function as an argument
def newfunc (function):
"""
Register function as signal handler.
"""
if os.name == 'posix':
signal.signal(signal_number, function)
return function
@ -42,6 +48,9 @@ def _synchronized (lock, func):
Call function with aqcuired lock.
"""
def newfunc (*args, **kwargs):
"""
Execute function synchronized.
"""
lock.acquire(True) # blocking
try:
return func(*args, **kwargs)
@ -58,6 +67,9 @@ def synchronized (lock):
A decorator calling a function with aqcuired lock.
"""
def newfunc (function):
"""
Execute function synchronized.
"""
return _synchronized(lock, function)
return newfunc