vregistry.py
branchtls-sprint
changeset 631 99f5852f8604
parent 630 66ff0b2f7d03
child 646 8a9551089912
--- a/vregistry.py	Mon Feb 16 16:24:24 2009 +0100
+++ b/vregistry.py	Mon Feb 16 18:26:13 2009 +0100
@@ -513,7 +513,7 @@
 
 # advanced selector building functions ########################################
 
-def chainall(*selectors):
+def chainall(*selectors, **kwargs):
     """return a selector chaining given selectors. If one of
     the selectors fail, selection will fail, else the returned score
     will be the sum of each selector'score
@@ -527,9 +527,11 @@
                 return 0
             score += partscore
         return score
+    if 'name' in kwargs:
+        selector.__name__ = kwargs['name']
     return selector
 
-def chainfirst(*selectors):
+def chainfirst(*selectors, **kwargs):
     """return a selector chaining given selectors. If all
     the selectors fail, selection will fail, else the returned score
     will be the first non-zero selector score
@@ -541,10 +543,13 @@
             if partscore:
                 return partscore
         return 0
+    if 'name' in kwargs:
+        selector.__name__ = kwargs['name']
     return selector
 
 
 # selector base classes and operations ########################################
+
 class Selector(object):
     """base class for selector classes providing implementation
     for operators ``&`` and ``|``