Example #1
0
 def format(self, indent=0, indent_first=True):
     """Format routing table into string for log dumps."""
     info = [QUEUE_FORMAT.strip() % dict(
                 name=(name + ":").ljust(12), **config)
                         for name, config in self.items()]
     if indent_first:
         return textindent("\n".join(info), indent)
     return info[0] + "\n" + textindent("\n".join(info[1:]), indent)
Example #2
0
 def format(self, indent=0, indent_first=True):
     """Format routing table into string for log dumps."""
     active = self.consume_from
     info = [
         QUEUE_FORMAT.strip() % dict(name=(name + ":").ljust(12), **config)
         for name, config in sorted(active.iteritems())
     ]
     if indent_first:
         return textindent("\n".join(info), indent)
     return info[0] + "\n" + textindent("\n".join(info[1:]), indent)
Example #3
0
File: amqp.py Project: frac/celery
 def format(self, indent=0, indent_first=True):
     """Format routing table into string for log dumps."""
     queues = self
     if self._consume_from is not None:
         queues = self._consume_from
     info = [QUEUE_FORMAT.strip() % dict(
                 name=(name + ":").ljust(12), **config)
                     for name, config in sorted(queues.items())]
     if indent_first:
         return textindent("\n".join(info), indent)
     return info[0] + "\n" + textindent("\n".join(info[1:]), indent)
Example #4
0
 def test_textindent(self):
     self.assertEqual(textindent(RANDTEXT, 4), RANDTEXT_RES)
Example #5
0
 def test_textindent(self):
     self.assertEqual(textindent(RANDTEXT, 4), RANDTEXT_RES)
Example #6
0
 def format(self, indent=0):
     """Format routing table into string for log dumps."""
     format = lambda **queue: QUEUE_FORMAT.strip() % queue
     info = "\n".join(format(name=name, **config)
                             for name, config in self.items())
     return textindent(info, indent=indent)