Tools for getting, setting, creating, and parsing the user’s ID.
IDs will look like ‘John Doe <jdoe@example.com>’. Note that the libbe.storage.vcs.arch enforces IDs with this format.
Do not confuse the user IDs discussed in this module, which refer to humans, with the “user IDs” discussed in libbe.util.id, which are human-readable tags refering to objects.
Create a user ID string from given name and email strings.
See also
Examples
>>> create_user_id("John Doe", "jdoe@example.com")
'John Doe <jdoe@example.com>'
>>> create_user_id("John Doe")
'John Doe'
Return an email address extracted from environmental variables.
Return a full name extracted from environmental variables.
Return a username extracted from environmental variables.
Return a user ID, checking a list of possible sources.
The source order is:
[1] | See libbe.storage.util.config. |
Notes
Sometimes the storage will keep track of the user ID (e.g. most VCSs, see libbe.storage.vcs.base.VCS.get_user_id()). If so, we prefer that ID to the fallback, since the user has likely configured it directly.
Parse a user ID string into name and email strings.
See also
Examples
>>> parse_user_id("John Doe <jdoe@example.com>")
('John Doe', 'jdoe@example.com')
>>> parse_user_id("John Doe")
('John Doe', None)
>>> parse_user_id("John Doe <jdoe@example.com><what?>")
('John Doe', 'jdoe@example.com')
Set the user ID in a user’s BE configuration.
See also