コード例 #1
0
        def edit_callback(status, args, fd):
            if status in (gpgme.STATUS_EOF, gpgme.STATUS_GOT_IT,
                          gpgme.STATUS_NEED_PASSPHRASE,
                          gpgme.STATUS_GOOD_PASSPHRASE,
                          gpgme.STATUS_BAD_PASSPHRASE,
                          gpgme.STATUS_USERID_HINT, gpgme.STATUS_SIGEXPIRED,
                          gpgme.STATUS_KEYEXPIRED, gpgme.STATUS_PROGRESS,
                          gpgme.STATUS_KEY_CREATED,
                          gpgme.STATUS_ALREADY_SIGNED):
                return
            try:
                data = gen.send((status, args))
            except StopIteration:
                raise gpgme.error(gpgme.ERR_SOURCE_UNKNOWN, gpgme.ERR_GENERAL)

            if data is not None:
                os.write(fd, data.encode('ASCII'))
コード例 #2
0
    def callback(self, status, args, fd):
        if status in (gpgme.STATUS_EOF, gpgme.STATUS_GOT_IT,
                      gpgme.STATUS_NEED_PASSPHRASE,
                      gpgme.STATUS_GOOD_PASSPHRASE,
                      gpgme.STATUS_BAD_PASSPHRASE, gpgme.STATUS_USERID_HINT,
                      gpgme.STATUS_SIGEXPIRED, gpgme.STATUS_KEYEXPIRED,
                      gpgme.STATUS_PROGRESS, gpgme.STATUS_KEY_CREATED,
                      gpgme.STATUS_ALREADY_SIGNED):
            return

        #print 'S: %s (%d)' % (args, status)

        if (self.state, status, args) in self.transitions:
            self.state, data = self.transitions[self.state, status, args]
            #print 'C: %r' % data
            if data is not None:
                os.write(fd, data)
        else:
            self.state = STATE_ERROR
            raise gpgme.error(gpgme.ERR_SOURCE_UNKNOWN, gpgme.ERR_GENERAL)
コード例 #3
0
ファイル: editutil.py プロジェクト: andreimacavei/pygpgme
        def edit_callback(status, args, fd):
            if status in (gpgme.STATUS_EOF,
                          gpgme.STATUS_GOT_IT,
                          gpgme.STATUS_NEED_PASSPHRASE,
                          gpgme.STATUS_GOOD_PASSPHRASE,
                          gpgme.STATUS_BAD_PASSPHRASE,
                          gpgme.STATUS_USERID_HINT,
                          gpgme.STATUS_SIGEXPIRED,
                          gpgme.STATUS_KEYEXPIRED,
                          gpgme.STATUS_PROGRESS,
                          gpgme.STATUS_KEY_CREATED,
                          gpgme.STATUS_ALREADY_SIGNED):
                return
            try:
                data = gen.send((status, args))
            except StopIteration:
                raise gpgme.error(gpgme.ERR_SOURCE_UNKNOWN, gpgme.ERR_GENERAL)

            if data is not None:
                os.write(fd, data.encode('ASCII'))
コード例 #4
0
ファイル: editutil.py プロジェクト: 274914765/python
    def callback(self, status, args, fd):
        if status in (gpgme.STATUS_EOF,
                      gpgme.STATUS_GOT_IT,
                      gpgme.STATUS_NEED_PASSPHRASE,
                      gpgme.STATUS_GOOD_PASSPHRASE,
                      gpgme.STATUS_BAD_PASSPHRASE,
                      gpgme.STATUS_USERID_HINT,
                      gpgme.STATUS_SIGEXPIRED,
                      gpgme.STATUS_KEYEXPIRED,
                      gpgme.STATUS_PROGRESS,
                      gpgme.STATUS_KEY_CREATED,
                      gpgme.STATUS_ALREADY_SIGNED):
            return

        #print 'S: %s (%d)' % (args, status)

        if (self.state, status, args) in self.transitions:
            self.state, data = self.transitions[self.state, status, args]
            #print 'C: %r' % data
            if data is not None:
                os.write(fd, data)
        else:
            self.state = STATE_ERROR
            raise gpgme.error(gpgme.ERR_SOURCE_UNKNOWN, gpgme.ERR_GENERAL)