~barry/mailman/alembic

« back to all changes in this revision

Viewing changes to src/mailman/commands/cli_qfile.py

  • Committer: Barry Warsaw
  • Date: 2012-04-28 02:37:25 UTC
  • mfrom: (7151.1.2 3.0)
  • Revision ID: barry@list.org-20120428023725-tn4f1zic0ifs0k3h
Merge trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
 
18
18
"""Getting information out of a qfile."""
19
19
 
20
 
from __future__ import absolute_import, unicode_literals
 
20
from __future__ import absolute_import, print_function, unicode_literals
21
21
 
22
22
__metaclass__ = type
23
23
__all__ = [
28
28
import cPickle
29
29
 
30
30
from pprint import PrettyPrinter
31
 
from zope.interface import implements
 
31
from zope.interface import implementer
32
32
 
33
33
from mailman.core.i18n import _
34
34
from mailman.interfaces.command import ICLISubCommand
39
39
 
40
40
 
41
41
 
 
42
@implementer(ICLISubCommand)
42
43
class QFile:
43
44
    """Get information out of a queue file."""
44
45
 
45
 
    implements(ICLISubCommand)
46
 
 
47
46
    name = 'qfile'
48
47
 
49
48
    def add(self, parser, command_parser):
79
78
                except EOFError:
80
79
                    break
81
80
        if args.doprint:
82
 
            print _('[----- start pickle -----]')
 
81
            print(_('[----- start pickle -----]'))
83
82
            for i, obj in enumerate(m):
84
83
                count = i + 1
85
 
                print _('<----- start object $count ----->')
 
84
                print(_('<----- start object $count ----->'))
86
85
                if isinstance(obj, basestring):
87
 
                    print obj
 
86
                    print(obj)
88
87
                else:
89
88
                    printer.pprint(obj)
90
 
            print _('[----- end pickle -----]')
 
89
            print(_('[----- end pickle -----]'))
91
90
        count = len(m)
92
91
        banner = _("The variable 'm' contains $count objects")
93
92
        if args.interactive: