~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/gpg.py

  • Committer: Robert Collins
  • Date: 2007-07-04 08:08:13 UTC
  • mfrom: (2572 +trunk)
  • mto: This revision was merged to the branch mainline in revision 2587.
  • Revision ID: robertc@robertcollins.net-20070704080813-wzebx0r88fvwj5rq
Merge bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005 by Canonical Ltd
 
1
# Copyright (C) 2005 Canonical Ltd
2
2
#   Authors: Robert Collins <robert.collins@canonical.com>
3
3
#
4
4
# This program is free software; you can redistribute it and/or modify
17
17
 
18
18
"""GPG signing and checking logic."""
19
19
 
 
20
import os
 
21
import sys
 
22
 
 
23
from bzrlib.lazy_import import lazy_import
 
24
lazy_import(globals(), """
20
25
import errno
21
 
import os
22
26
import subprocess
23
 
import sys
24
27
 
25
28
from bzrlib import (
26
29
    errors,
27
30
    trace,
28
31
    ui,
29
32
    )
 
33
""")
30
34
 
31
35
 
32
36
class DisabledGPGStrategy(object):
46
50
        """Real strategies take a configuration."""
47
51
 
48
52
    def sign(self, content):
49
 
        return content
 
53
        return ("-----BEGIN PSEUDO-SIGNED CONTENT-----\n" + content +
 
54
                "-----END PSEUDO-SIGNED CONTENT-----\n")
50
55
 
51
56
 
52
57
def _set_gpg_tty():
72
77
        self._config = config
73
78
 
74
79
    def sign(self, content):
 
80
        if isinstance(content, unicode):
 
81
            raise errors.BzrBadParameterUnicode('content')
75
82
        ui.ui_factory.clear_term()
76
83
 
77
84
        preexec_fn = _set_gpg_tty