Module: deluge
Branch: master
Commit: 78f9f22a4081615c0ab3f55f692bbf6aa3da6cd9

Author: Andrew Resch <[email protected]>
Date:   Wed Mar 24 22:52:03 2010 -0700

Raise a KeyError exception if trying to stop a component that hasn't
isn't registered

---

 deluge/component.py |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/deluge/component.py b/deluge/component.py
index 2b12de5..c5c38fb 100644
--- a/deluge/component.py
+++ b/deluge/component.py
@@ -252,11 +252,20 @@ class ComponentRegistry(object):
         sucessfully stopped
         :rtype: twisted.internet.defer.Deferred
 
+        :raises KeyError: if a component name is not registered
+
         """
         if not names:
             names = self.components.keys()
         elif isinstance(names, str):
-            names = [names]
+            if names in self.components:
+                names = [names]
+            else:
+                raise KeyError("%s is not a registered component!" % names)
+
+        for name in names:
+            if name is not in self.components:
+                raise KeyError("%s is not a registered component!" % name)
 
         deferreds = []
 

-- 
You received this message because you are subscribed to the Google Groups 
"deluge-commit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/deluge-commit?hl=en.

Reply via email to