On 20/01/16 18:48, Rahul Amaram wrote: > On Wednesday 20 January 2016 10:43 PM, Ximin Luo wrote: >> On 20/01/16 17:26, Ximin Luo wrote: >>> On 20/01/16 15:23, Ximin Luo wrote: >>>> Hey, I just tested 7.0+dfsg from git and it seems to work fine. Thanks for >>>> the work, and looking forward to the eventual upload! Just a few notes: >>>> >>>> (a) [..] >>>> >>>> (b) [..] >>>> >>>> (c) [..] >>>> >>>> (d) [..] >>>> >>> (e) [..] >>> >>> (f) [..] >>> >>> (g) [..] >>> >>> (h) [..] >> >> (j) [..] >>
(k) Another bug that hit me with 7.0: I couldn't save events with unicode characters such as "ß" in them. Looking at the error log got me this: 2016-01-23 22:40:03+0100 [-] [caldav-0] [-] [twistedcaldav.storebridge#error] Error while handling (calendar) PUT: 'ascii' codec can't decode byte 0xc3 in position 355: ordinal not in range(128) Adding some "import traceback; traceback.print_exc()" to storebridge.py told me that the error was from pg8000/core.py: 2016-01-23 22:46:11+0100 [-] [caldav-1] [-] Traceback (most recent call last): 2016-01-23 22:46:11+0100 [-] [caldav-1] [-] File "/usr/lib/python2.7/dist-packages/twistedcaldav/storebridge.py", line 2869, in http_PUT 2016-01-23 22:46:11+0100 [-] [caldav-1] [-] response = (yield self.storeComponent(component, options=options)) [..] many many lines omitted, omg [..] 2016-01-23 22:46:11+0100 [-] [caldav-1] [-] File "/usr/lib/python2.7/dist-packages/txdav/base/datastore/dbapiclient.py", line 83, in execute 2016-01-23 22:46:11+0100 [-] [caldav-1] [-] self.realCursor.execute(sql, args) 2016-01-23 22:46:11+0100 [-] [caldav-1] [-] File "/usr/lib/python2.7/dist-packages/pg8000/core.py", line 910, in execute 2016-01-23 22:46:11+0100 [-] [caldav-1] [-] self._c.execute(self, operation, args) 2016-01-23 22:46:11+0100 [-] [caldav-1] [-] File "/usr/lib/python2.7/dist-packages/pg8000/core.py", line 2031, in execute 2016-01-23 22:46:11+0100 [-] [caldav-1] [-] val = send_func(value) 2016-01-23 22:46:11+0100 [-] [caldav-1] [-] File "/usr/lib/python2.7/dist-packages/pg8000/core.py", line 1353, in text_out 2016-01-23 22:46:11+0100 [-] [caldav-1] [-] return v.encode(self._client_encoding) 2016-01-23 22:46:11+0100 [-] [caldav-1] [-] UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 322: ordinal not in range(128) 2016-01-23 22:46:11+0100 [-] [caldav-1] [-] [twistedcaldav.storebridge#error] Error while handling (calendar) PUT: 'ascii' codec can't decode byte 0xc3 in position 322: ordinal not in range(128) Adding some debugging code reveals that text_out() is called with both unicode() and str() objects. When I do PUT, the event object is serialised into a str "BEGIN:VCALENDER..." and eventually makes its way to text_out(), causing an exception. Experimenting a bit, the errors go away and I can save the event again, if I patch pg8000 like this: ~~~~ diff --git a/pg8000/core.py b/pg8000/core.py index 246e0b6..14093cc 100644 --- a/pg8000/core.py +++ b/pg8000/core.py @@ -1350,6 +1350,7 @@ class Connection(object): self.ParameterStatusReceived += self.handle_PARAMETER_STATUS def text_out(v): + if not isinstance(v, text_type): return v return v.encode(self._client_encoding) def time_out(v): ~~~~ I will forward this bug upstream to pg8000. It may *also* be a bug on the calendarserver side, but I'm pretty sure pg8000 should be fixed as well - since text_out() is an internal function, if pg8000 has any requirements on the input it receives from calendarserver, it should raise a better error message *before* it gets to text_out(). X -- GPG: ed25519/56034877E1F87C35 GPG: rsa4096/1318EFAC5FBBDBCE git://github.com/infinity0/pubkeys.git