-
Notifications
You must be signed in to change notification settings - Fork 11
/
README
126 lines (111 loc) · 3.75 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
'''
/* EWSWrapper_py README file
* ====================================================
* @author Michal Korzeniowski <mko_san@lafiel.net>
* @version 0.2
* @date 04-2012
* @website http://ewswrapper.lafiel.net/
* ==================================================*/
'''
EWSWrapper provides wrapper functions for easy usage of
Microsoft Exchange Web Services. EWSWrapper utilzes some
code written by Erik Cederstrand <erik@cederstrand.dk>
Currently EWSWrapper provides following functionality:
- Operations on Calendar Events:
- add,
- update,
- delete,
- list
- synch
- Operations on Tasks:
- add,
- update,
- delete,
- list
- Operations of Folders:
- list
- synch
Documentaion can be found @ http://ewswrapper.lafiel.net/
Please see test.py for example usages of EWSWrapper.
Note:
For suds to work with EWS you may need to patch file caching system in SUDS.
Big thanks go to Sean DiZazzo <half.italian@gmail.com> for providing the
necessary changes:
--- suds/cache.py 2011-05-31 09:57:26.000000000 -0700
***************
*** 191,197 ****
try:
fn = self.__fn(id)
f = self.open(fn, 'w')
! f.write(bfr)
f.close()
return bfr
except:
--- 191,197 ----
try:
fn = self.__fn(id)
f = self.open(fn, 'w')
! f.write(str(bfr)) # Cast the bfr object to a string
f.close()
return bfr
except:
--- suds/reader.py 2011-05-31 09:57:26.000000000 -0700
***************
*** 78,83 ****
--- 78,86 ----
if d is None:
d = self.download(url)
cache.put(id, d)
+ else: # add these three lines.
+ sax = Parser()
+ d = sax.parse(string=d)
self.plugins.document.parsed(url=url, document=d.root())
return d
***************
Another patch needed for SUDS has to do with UTF8 encoding. If soap is
returning proper UTF8 suds will most likely fail, so here’s another fix
that we came up with after some hours of debbuging:
*** parser.py 2011-11-08 11:44:35.951341300 +0100
***************
*** 132,138 ****
return handler.nodes[0]
if string is not None:
source = InputSource(None)
! source.setByteStream(StringIO(string.encode('utf8')))
#set the encoding if known
pos = string.find('encoding="')
if(pos>0):
--- 132,141 ----
return handler.nodes[0]
if string is not None:
source = InputSource(None)
! try:
! source.setByteStream(StringIO(string.encode(‘utf8’)))
! except UnicodeDecodeError:
! source.setByteStream(StringIO(string))
#set the encoding if known
pos = string.find('encoding="')
if(pos>0):
Here's yet another fix for suds, this time when you are getting wring DST
offset. MSEx will return dates in UTC, and while SUDS will use your
local timezone on date conversion it WON'T respect DST offset. Here's a
fix for that pesky problem:
***\suds\sax\date.py 2011-10-04 07:31:39.000000000 +0200
***************
*** 302,313 ****
--- 302,316 ----
"""
Adjust for TZ offset.
"""
if not hasattr(self, 'offset'):
return
delta = self.tz.adjustment(self.offset)
+ #check for DST
+ ltime = time.localtime(int(time.mktime(self.datetime.timetuple())))
+ delta += dt.timedelta(hours=ltime.tm_isdst)
try:
d = ( self.datetime + delta )
self.datetime = d
self.date = d.date()
self.time = d.time()
except OverflowError: