Author: dmeyer
Date: Wed Feb 13 13:16:30 2008
New Revision: 3064
Log:
move the old parameter handling to the execute_in_timer wrapper
Modified:
trunk/base/API_CHANGES.txt
trunk/base/src/notifier/__init__.py
trunk/base/src/notifier/decorators.py
Modified: trunk/base/API_CHANGES.txt
==============================================================================
--- trunk/base/API_CHANGES.txt (original)
+++ trunk/base/API_CHANGES.txt Wed Feb 13 13:16:30 2008
@@ -57,4 +57,6 @@
@kaa.yield_execution --> @kaa.coroutine
Currently the old names are still functional but a warning will be
- logged if they are used.
+ logged if they are used. @kaa.timed also changed the parameter
+ order and name. It is now interval, timer (default Timer) and
+ policy (default POLICY_RESTART).
Modified: trunk/base/src/notifier/__init__.py
==============================================================================
--- trunk/base/src/notifier/__init__.py (original)
+++ trunk/base/src/notifier/__init__.py Wed Feb 13 13:16:30 2008
@@ -53,12 +53,19 @@
log.warning('Decorator @kaa.execute_in_mainloop deprecated; use
@kaa.threaded(kaa.MAINTHREAD)');
return threaded(MAINTHREAD, async=async)
+def execute_in_timer(timer, interval, type=''):
+ log.warning('Decorator @kaa.execute_in_timer deprecated; use @kaa.timed');
+ if not type:
+ type = POLICY_MANY
+ if type == 'override':
+ type = POLICY_RESTART
+ return timed(interval, timer, type)
+
def wrap(func, old_name, new_name):
def decorator(*args, **kwargs):
log.warning('Decorator @kaa.%s deprecated; use @kaa.%s' % (old_name,
new_name))
return func(*args, **kwargs)
return decorator
-execute_in_timer=wrap(timed, 'execute_in_timer', 'timed')
execute_in_thread=wrap(threaded, 'execute_in_thread', 'threaded')
yield_execution=wrap(coroutine, 'yield_execution', 'coroutine')
Modified: trunk/base/src/notifier/decorators.py
==============================================================================
--- trunk/base/src/notifier/decorators.py (original)
+++ trunk/base/src/notifier/decorators.py Wed Feb 13 13:16:30 2008
@@ -49,7 +49,7 @@
# get logging object
log = logging.getLogger('notifier')
-def timed(interval, timer=Timer, policy=POLICY_MANY, **kwargs):
+def timed(interval, timer=Timer, policy=POLICY_MANY):
"""
Decorator to call the decorated function in a Timer. When calling the
function, a timer will be started with the given interval calling that
@@ -77,14 +77,6 @@
log.warning('Deprecated use of @kaa.timed decorator; arg 1 is
interval, arg 2 is (optional) timer class')
interval, timer = timer, interval
- if 'type' in kwargs:
- log.warning('@kaa.timed kwarg "type" deprecated; use "policy"
instead.')
- policy = kwargs['type']
-
- if policy == 'override':
- log.warning('@kaa.timed policy "override" deprecated; use
POLICY_RESTART instead.')
- policy = POLICY_RESTART
-
if not policy in (POLICY_MANY, POLICY_ONCE, POLICY_RESTART):
raise RunTimeError('Invalid @kaa.timed policy %s' % policy)
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Freevo-cvslog mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog