Author: tack
Date: Sun Jan 13 18:19:44 2008
New Revision: 2969

Log:
Handle the case when a function decorated with yield_execution doesn't
actually yield anything.  In this case the function should behave as though
it was't decorated at all.


Modified:
   trunk/base/src/notifier/yieldfunc.py

Modified: trunk/base/src/notifier/yieldfunc.py
==============================================================================
--- trunk/base/src/notifier/yieldfunc.py        (original)
+++ trunk/base/src/notifier/yieldfunc.py        Sun Jan 13 18:19:44 2008
@@ -128,7 +128,15 @@
     def decorator(func):
 
         def newfunc(*args, **kwargs):
-            function = func(*args, **kwargs).next
+            result = func(*args, **kwargs)
+            if not hasattr(result, 'next'):
+                # Decorated function doesn't have a next attribute, which
+                # likyle means it didn't yield anything.  There was no sense
+                # in decorating that function with yield_execution, but on
+                # the other hand it's easy enough just to return the result.
+                return result
+
+            function = result.next
             if lock and func._lock is not None and not func._lock.is_finished:
                 return YieldLock(func, function, interval)
             try:

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
Freevo-cvslog mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog

Reply via email to