diff options
| author | Aurélien Bompard | 2015-03-16 11:22:04 +0100 |
|---|---|---|
| committer | Aurélien Bompard | 2015-03-16 11:22:04 +0100 |
| commit | a75be4230498933792e6ed02504ab4ab3e600f90 (patch) | |
| tree | d51697f2d0009d8d159bcebce868e7864753b6fc /src/mailman/commands/cli_import.py | |
| parent | 6280c5ffcd2fdebf80f170f7c9a4e47adf0c6c4a (diff) | |
| parent | 16ab6ac0cc2653f6123ba0781cd3270b4eedc776 (diff) | |
| download | mailman-a75be4230498933792e6ed02504ab4ab3e600f90.tar.gz mailman-a75be4230498933792e6ed02504ab4ab3e600f90.tar.zst mailman-a75be4230498933792e6ed02504ab4ab3e600f90.zip | |
Diffstat (limited to 'src/mailman/commands/cli_import.py')
| -rw-r--r-- | src/mailman/commands/cli_import.py | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/mailman/commands/cli_import.py b/src/mailman/commands/cli_import.py index 30aeb7894..50d4f1864 100644 --- a/src/mailman/commands/cli_import.py +++ b/src/mailman/commands/cli_import.py @@ -35,6 +35,14 @@ from zope.interface import implementer +# Mock the Bouncer class from Mailman 2.1, we don't use it but there are +# instances in the pickled config files +class Bouncer: + class _BounceInfo: + pass + + + @implementer(ICLISubCommand) class Import21: """Import Mailman 2.1 list data.""" @@ -74,10 +82,11 @@ class Import21: assert len(args.pickle_file) == 1, ( 'Unexpected positional arguments: %s' % args.pickle_file) filename = args.pickle_file[0] + sys.modules["Mailman.Bouncer"] = Bouncer with open(filename, 'rb') as fp: while True: try: - config_dict = pickle.load(fp) + config_dict = pickle.load(fp, encoding="utf-8", errors="ignore") except EOFError: break except pickle.UnpicklingError: @@ -94,3 +103,4 @@ class Import21: except Import21Error as error: print(error, file=sys.stderr) sys.exit(1) + del sys.modules["Mailman.Bouncer"] |
