~muffinresearch/bzr-email/bzr-email-keychain

« back to all changes in this revision

Viewing changes to smtp_connection.py

  • Committer: Stuart Colville
  • Date: 2007-08-14 22:00:28 UTC
  • Revision ID: scol@yahoo-inc.com-20070814220028-21ta84w3r9lz41gw
removed error messages into one variable

Show diffs side-by-side

added added

removed removed

Lines of Context:
111
111
            raise errors.BzrCommandError(str(e))  
112
112
            
113
113
    def _getKeychainCredentials(self,keychain,item):
114
 
      import commands,re
 
114
      import commands,re                            
 
115
      keychainerror = 'The specified keychain item(s) could not be found.'
115
116
      resp = commands.getoutput("security find-generic-password -g -s '"+item+"' '"+keychain+".keychain'") 
116
117
      if resp.find('The specified item could not be found') != -1:
117
 
        raise errors.BzrCommandError('The specified keychain item(s) could not be found') 
 
118
        raise errors.BzrCommandError(keychainerror) 
118
119
      if resp:
119
120
        password = re.search('password: "(.*?)"', resp, re.DOTALL)
120
121
        account = re.search('"acct"<blob>="(.*?)"', resp, re.DOTALL)
121
122
        if password and account:
122
123
          return {"account":account.group(1),"password":password.group(1)}
123
124
        else:
124
 
          raise errors.BzrCommandError('The specified keychain item(s) could not be found')
 
125
          raise errors.BzrCommandError(keychainerror)
125
126
 
126
127
    @staticmethod
127
128
    def _split_address(address):