/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/util/simplemapi.py

  • Committer: Robert Collins
  • Date: 2010-05-06 11:08:10 UTC
  • mto: This revision was merged to the branch mainline in revision 5223.
  • Revision ID: robertc@robertcollins.net-20100506110810-h3j07fh5gmw54s25
Cleaner matcher matching revised unlocking protocol.

Show diffs side-by-side

added added

removed removed

Lines of Context:
36
36
software, please contact me at the above email address.
37
37
"""
38
38
 
39
 
from __future__ import absolute_import
40
 
 
41
39
import os
42
40
from ctypes import *
43
41
 
158
156
    pSession = LHANDLE()
159
157
    rc = MAPILogon(0, profileName, password, MAPI_LOGON_UI, 0, byref(pSession))
160
158
    if rc != SUCCESS_SUCCESS:
161
 
        raise MAPIError(rc)
 
159
        raise MAPIError, rc
162
160
    return pSession
163
161
 
164
162
 
165
163
def _logoff(session):
166
164
    rc = MAPILogoff(session, 0, 0, 0)
167
165
    if rc != SUCCESS_SUCCESS:
168
 
        raise MAPIError(rc)
 
166
        raise MAPIError, rc
169
167
 
170
168
 
171
169
def _resolveName(session, name):
172
170
    pRecipDesc = lpMapiRecipDesc()
173
171
    rc = MAPIResolveName(session, 0, name, 0, 0, byref(pRecipDesc))
174
172
    if rc != SUCCESS_SUCCESS:
175
 
        raise MAPIError(rc)
 
173
        raise MAPIError, rc
176
174
    rd = pRecipDesc.contents
177
175
    name, address = rd.lpszName, rd.lpszAddress
178
176
    rc = MAPIFreeBuffer(pRecipDesc)
179
177
    if rc != SUCCESS_SUCCESS:
180
 
        raise MAPIError(rc)
 
178
        raise MAPIError, rc
181
179
    return name, address
182
180
 
183
181
 
219
217
 
220
218
    rc = MAPISendMail(session, 0, byref(msg), MAPI_DIALOG, 0)
221
219
    if rc != SUCCESS_SUCCESS:
222
 
        raise MAPIError(rc)
 
220
        raise MAPIError, rc
223
221
 
224
222
 
225
223
def SendMail(recipient, subject="", body="", attachfiles=""):
233
231
 
234
232
    attach = []
235
233
    AttachWork = attachfiles.split(';')
236
 
    for f in AttachWork:
237
 
        if os.path.exists(f):
238
 
            attach.append(os.path.abspath(f))
 
234
    for file in AttachWork:
 
235
        if os.path.exists(file):
 
236
            attach.append(file)
 
237
    attach = map(os.path.abspath, attach)
239
238
 
240
239
    restore = os.getcwd()
241
240
    try: