IRC log of #zope for Friday, 2016-10-14

*** [Arfrever] has quit IRC00:50
*** [Arfrever] has joined #zope00:52
*** Arfrever has quit IRC00:59
*** J1m has quit IRC01:16
*** freedom01 has quit IRC03:22
*** MatthewWilkes has quit IRC03:35
*** MatthewWilkes has joined #zope03:39
*** freedom01 has joined #zope04:08
*** freedom01 has quit IRC05:13
*** freedom01 has joined #zope05:41
*** freedom01 has quit IRC09:26
*** alecm has quit IRC09:28
*** alecm has joined #zope09:32
*** alecm has joined #zope09:32
*** freedom01 has joined #zope10:02
*** El_Rolando has joined #zope10:08
*** freedom01 has quit IRC10:16
*** rp has joined #zope10:35
*** rp has left #zope10:35
*** freedom01 has joined #zope10:49
*** alecm has quit IRC11:29
*** alecm has joined #zope11:35
*** srichter has quit IRC12:20
*** Pumukel has joined #zope12:27
*** srichter has joined #zope12:52
*** srichter has joined #zope12:53
*** srichter_ has joined #zope12:55
*** srichter has quit IRC12:58
*** srichter has joined #zope13:24
*** srichter_ has quit IRC13:24
*** El_Rolando has quit IRC14:04
*** projekt01 has joined #zope14:16
*** mejo has joined #zope14:19
mejohello14:19
mejosince this morning, we have very strange encoding issues in Zope2.10. I know, zope2.10 is very very old, but it's an old application that will not be migrated anymore. Therefore I installed a Debian Lenny Chroot with python2.4 and Zope2.1014:21
mejoon an up-to-date server and the zope instances run inside the chroot.14:21
mejountil now (since several years) everything works as expected. Last night I did a reboot of the server (due to a kernel upgrade) and since then, several encoding related things are broken: string functions on data from the database throw an error: UnicodeEncodeError: 'ascii' codec can't encode character u'\xfc' in position 59: ordinal not in range(128)14:24
mejoadditionally, files like css are not delivered as type text/css anymore but as type text/plain.14:25
mejodo you have any idea, what change (probably on the host system) could have caused this? to me, both problems seem totally unrelated14:26
mgedminlocale?14:42
mgedminwhen you ssh in and run 'sudo service myzope start', it inherits your LC_CTYPE and everything14:42
mgedminwhen you reboot, /sbin/init runs the service scripts without any locale set, which means C and ASCII instead of UTF-814:43
*** El_Rolando has joined #zope14:43
*** J1m has joined #zope15:06
*** ChanServ sets mode: +v J1m15:06
mejomgedmin: thanks, I suspected locale related issues as well.15:07
mejomgedmin: still, even if I manually restart the zope application server, nothing changes.15:07
mgedminanother time I had unicode problems from zope was when different browsers sent different Accept-Encoding headers15:08
mgedminchrome/firefox would mention UTF-8 explicitly, MSIE would send Accept-Encoding: *15:08
mgedminand zope was looking for an explicit mention on UTF-815:08
mejobut I realized that 'python -c import sys; sys.getdefaultencoding();' gives 'utf-8' on my host system but 'ascii' inside the chroot.15:09
mgedminbut it doesn't sound like something that you have, if you could see a working site a few days ago using the same browser15:09
mgedminsys.getdefaultencoding() should always return 'ascii'15:09
mgedminif you get utf-8, that implies you have a custom site.py or something15:09
mejomgedmin: definately not related to the browser here. We tested with five different browsers on three systems (with different operating systemds)15:09
mgedmin(that accept-encoding parsing bug was the final staw; I realized I don't want to debug zope 2 any more, wrote https://github.com/ProgrammersOfVilnius/zope-export-tools and converted my zope sites to blogofile-generated static HTML)15:11
mejomgedmin: unfortunately no an option here as the zope applications have a lot of dynamic content and are still used very actively.15:13
mejomgedmin: also, the server was rebooted several times before, but stil we never had this problem before.15:14
mgedmincuriouser and curiouser15:14
mejoI suspect that some security update of the host system (Debian Jessie) has a strange side effect.15:15
mgedminbut how could that possibly work?15:15
mejogood question15:16
mejomy first guess was something like a security update of mysql back in september that might have changed something in how mysql handles character encoding. but the mysql service was restarted during the upgrade back then, so this is unlikely as well.15:17
mejoto be honest, I don't have a good explanation of what happened until now15:17
mgedminhmm... do those string values that give you trouble come from a database?15:17
mejoyes, they do.15:17
mgedminmaybe someone inserted something non-ascii that wasn't there before?15:18
mgedminok, sys.setdefaultencoding('utf-8') is a big wrong hammer, but it may be worth a try15:18
mejothe database values were utf-8 since a long time and they already contain german umlauts since the beginning.15:18
mgedmin(I've no idea how you're supposed to do it, but I'm sure google has recipes)15:19
mejomgedmin: I even tried that in /usr/lib/zope2.10/lib/python/Zope2/Startup/zopectl.py15:19
mejoeven that didn't help15:19
mgedminsite.py does 'del sys.setdefaultencoding', so you have to do it from a sitecustomize.py (IIRC)15:19
mgedminor do the reload(sys) hack to make setdefaultencoding reappear15:19
mgedmin(why I suggested googling)15:19
mgedmin(because it's not trivial)15:19
mejoI did the reload(sys) ;)15:19
mgedminah :/15:19
mgedminwell, a part of me is relieved that the wrong solution didn't help15:20
mejo:)15:20
mgedminand another part of me is commiserating with your pain15:20
mgedminI suppose "rewrite the site in django" would not fit the budget/time constraints?15:20
mejothat's very kind of you :)15:20
mgedminin the past I was in a similar situation a few times15:21
mejoalso, I don't see how all this is related to the second problem that magically appeared over night: suddenly zope delivers CSS files with content type 'text/plain' instead of 'text/css'.15:21
mgedminin the "just effing make it work mode" I generally kept adding .encode('utf-8')/.decode('utf-8') in all the places that were failing15:21
mejoyeah, that would be a solution.15:22
mgedmin(my TTW Python Methods mostly)15:22
mejowe already found out that using 'unicode(u'string').replace() instead of 'string'.replace() works15:22
mgedminhow are you serving CSS files?  do the live in the ZODB or in the filesystem?15:22
mejoin the ZODB15:22
mgedminfwiw unicode(u'string') is same as u'string'15:22
mgedminwhat class of object are these CSS files?15:23
mgedminis there anything resembling Content-Type in manage_propertiesForm?15:23
mejothe CSS file in question is a DTML method.15:23
mgedminis it calling RESPONSE.setHeader('Content-Type') anywhere?15:24
mejoup till now, it didn't. it was delivered as 'type/css' automatically. probably because Zope set the content-type automatically, probably because apache (as reverse proxy) did it. since last night, we have to set the Content-Type with RESPONSE.setHeader() manually.15:24
*** Pumukel has quit IRC15:50
*** freedom01 has quit IRC16:21
*** freedom01 has joined #zope16:28
*** projekt01 has quit IRC16:54
*** El_Rolando has quit IRC18:29
*** freedom01 has quit IRC19:20
*** freedom01 has joined #zope20:13
*** avoinea has quit IRC20:53
*** povbot_ has joined #zope21:43
*** jham has joined #zope21:45
*** jham has joined #zope21:45
*** [Arfreve1] has joined #zope21:46
*** aclark has joined #zope21:47
*** ChanServ sets mode: +v aclark21:47
*** MatzeWilkes has joined #zope21:51
*** MatthewWilkes has quit IRC21:51
*** [Arfrever] has quit IRC21:51
*** povbot has quit IRC21:51
*** harrow` has quit IRC21:51
*** jham_ has quit IRC21:51
*** MatzeWilkes is now known as MatthewWilkes21:51
*** aclark has quit IRC22:04
*** [Arfreve1] has quit IRC22:48
*** [Arfrever] has joined #zope22:49
*** aclark has joined #zope23:41
*** ChanServ sets mode: +v aclark23:41

Generated by irclog2html.py 2.15.1 by Marius Gedminas - find it at mg.pov.lt!