~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/config.py

  • Committer: Robert Collins
  • Date: 2005-10-17 21:20:18 UTC
  • mfrom: (1461)
  • mto: This revision was merged to the branch mainline in revision 1462.
  • Revision ID: robertc@robertcollins.net-20051017212018-5e2a78c67f36a026
merge from integration

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
Currently this configuration resides in ~/.bazaar/bazaar.conf
21
21
and ~/.bazaar/branches.conf, which is written to by bzr.
22
22
 
23
 
In bazaar.config the following options may be set:
 
23
In bazaar.conf the following options may be set:
24
24
[DEFAULT]
25
25
editor=name-of-program
26
26
email=Your Name <your@email.address>
381
381
    return realname, (username + '@' + socket.gethostname())
382
382
 
383
383
 
 
384
def extract_email_address(e):
 
385
    """Return just the address part of an email string.
 
386
    
 
387
    That is just the user@domain part, nothing else. 
 
388
    This part is required to contain only ascii characters.
 
389
    If it can't be extracted, raises an error.
 
390
    
 
391
    >>> extract_email_address('Jane Tester <jane@test.com>')
 
392
    "jane@test.com"
 
393
    """
 
394
    m = re.search(r'[\w+.-]+@[\w+.-]+', e)
 
395
    if not m:
 
396
        raise BzrError("%r doesn't seem to contain "
 
397
                       "a reasonable email address" % e)
 
398
    return m.group(0)