(self, directory)
Set the directory for storing generated keys.

        If unspecified, use
        :meth:`~gnupg._meta.GPGBase.homedir`/generated-keys. If specified,
        ensure that the ``directory`` does not contain various shell escape
        characters. If ``directory`` isn't found, it will be automatically
        created. Lastly, the ``directory`` will be checked to ensure that the
        current EUID has read and write permissions for it.

        :param str directory: A relative or absolute path to the directory to
             use for storing/accessing GnuPG's files, including keyrings and
             the trustdb.
        :raises: :exc:`~exceptions.RuntimeError` if unable to find a suitable
             directory to use.
Set the directory for storing generated keys.
Set the directory for storing generated keys .
def _generated_keys_setter(self, directory):
        """Set the directory for storing generated keys.

        If unspecified, use
        :meth:`~gnupg._meta.GPGBase.homedir`/generated-keys. If specified,
        ensure that the ``directory`` does not contain various shell escape
        characters. If ``directory`` isn't found, it will be automatically
        created. Lastly, the ``directory`` will be checked to ensure that the
        current EUID has read and write permissions for it.

        :param str directory: A relative or absolute path to the directory to
             use for storing/accessing GnuPG's files, including keyrings and
             the trustdb.
        :raises: :exc:`~exceptions.RuntimeError` if unable to find a suitable
             directory to use.
        """
        if not directory:
            directory = os.path.join(self.homedir, 'generated-keys')
            log.debug("GPGBase._generated_keys_setter(): Using '%s'"
                      % directory)

        hd = _parsers._fix_unsafe(directory)
        log.debug("GPGBase._generated_keys_setter(): got directory '%s'" % hd)

        if hd:
            log.debug("GPGBase._generated_keys_setter(): Check exists '%s'"
                      % hd)
            _util._create_if_necessary(hd)

        try:
            log.debug("GPGBase._generated_keys_setter(): check permissions")
            assert _util._has_readwrite(hd), \
                "Keys dir '%s' needs read/write permissions" % hd
        except AssertionError as ae:
            msg = ("Unable to set '%s' as generated keys dir" % directory)
            log.debug("GPGBase._generated_keys_setter(): %s" % msg)
            log.debug(str(ae))
            raise RuntimeError(str(ae))
        else:
            log.info("Setting homedir to '%s'" % hd)
            self.__generated_keys = hd
def _generated_keys_setter ( self , directory ) : if not directory : directory = os . path . join ( self . homedir , 'generated-keys' ) log . debug ( "GPGBase._generated_keys_setter(): Using '%s'" % directory ) hd = _parsers . _fix_unsafe ( directory ) log . debug ( "GPGBase._generated_keys_setter(): got directory '%s'" % hd ) if hd : log . debug ( "GPGBase._generated_keys_setter(): Check exists '%s'" % hd ) _util . _create_if_necessary ( hd ) try : log . debug ( "GPGBase._generated_keys_setter(): check permissions" ) assert _util . _has_readwrite ( hd ) , "Keys dir '%s' needs read/write permissions" % hd except AssertionError as ae : msg = ( "Unable to set '%s' as generated keys dir" % directory ) log . debug ( "GPGBase._generated_keys_setter(): %s" % msg ) log . debug ( str ( ae ) ) raise RuntimeError ( str ( ae ) ) else : log . info ( "Setting homedir to '%s'" % hd ) self . __generated_keys = hd