示例#1
0
    def user_id(self):
        ''' Gets the user_id from the config. Returns a ghid.
        '''
        try:
            user_id = self._cfg['user'].user_id

            # May be undefined, in which case return None
            if user_id is None:
                return user_id

            # Convert to a ghid if defined.
            else:
                return Ghid.from_str(user_id)

        except Exception as exc:
            raise ConfigError('Invalid configuration.') from exc
示例#2
0
    def fingerprint(self):
        ''' The fingerprint! Use this for a sharing target.
        '''
        try:
            fingerprint = self._cfg['user'].fingerprint

            # May be undefined, in which case return None
            if fingerprint is None:
                return fingerprint

            # Convert to a ghid if defined.
            else:
                return Ghid.from_str(fingerprint)

        except Exception as exc:
            raise ConfigError('Invalid configuration.') from exc