Allow quoted queue and consumer names.
authorMartin Pihlak <martin.pihlak@gmail.com>
Tue, 14 Apr 2009 14:00:02 +0000 (17:00 +0300)
committerMartin Pihlak <martin.pihlak@gmail.com>
Tue, 14 Apr 2009 14:00:02 +0000 (17:00 +0300)
python/newadm.py

index 01f1e00eeb170bfcd6e7d6f06722ada64ee85a3e..274645961f5c325877a349214a2382029657570f 100755 (executable)
@@ -69,9 +69,9 @@ def unquote_any(self, s):
     if s:
         c = s[0]
         if c == "'":
-            s = skytools.unquote_literal(c, stdstr = True)
+            s = skytools.unquote_literal(s, stdstr = True)
         elif c == '"':
-            s = skytools.unquote_ident(c)
+            s = skytools.unquote_ident(s)
         # extquote?
         else:
             s = s.lower()
@@ -171,10 +171,22 @@ class DynList(Word):
     def __init__(self, next, **kwargs):
         Word.__init__(self, None, next, **kwargs)
 
-class Queue(DynList):
+class DynIdentList(DynList):
+    def get_next(self, typ, word, params):
+        """Allow quoted queue names"""
+        next = DynList.get_next(self, typ, word, params)
+        if next:
+            params[self.name] = unquote_any(self, word)
+        return next
+
+class Queue(DynIdentList):
     def get_wlist(self):
         return script.get_queue_list()
 
+class Consumer(DynIdentList):
+    def get_wlist(self):
+        return script.get_consumer_list()
+
 class DBNode(DynList):
     def get_wlist(self):
         return script.get_node_list()
@@ -191,10 +203,6 @@ class User(DynList):
     def get_wlist(self):
         return script.get_user_list()
 
-class Consumer(DynList):
-    def get_wlist(self):
-        return script.get_consumer_list()
-
 class BatchId(DynList):
     tk_type = ("num",)
     def get_wlist(self):