While installing Pootle 1.0 on Windows XP SP2, I encountered two problems.

First one was trivial. Some newly uncommented language settings in
Pootle/pootle.prefs had 3 spaces for indentation rather than 4. So I got
these error messages when I first started Pootle server.

  2007-06-06 22:14:20: Traceback (most recent call last):
    File "C:\Python24\Lib\site-packages\jToolkit\web\simplewebserver.py",
line 613, in getserver
      server = getserverwithprefs(options.prefsfile, options.instance,
httpd)
    File "C:\Python24\Lib\site-packages\jToolkit\web\__init__.py", line
160, in getserverwithprefs
      serverprefs.parsefile(prefsfile)
    File "C:\Python24\Lib\site-packages\jToolkit\prefs.py", line 428, in
parsefile
      self.parse(contents)
    File "C:\Python24\Lib\site-packages\jToolkit\prefs.py", line 418, in
parse
      self.handleindents()
    File "C:\Python24\Lib\site-packages\jToolkit\prefs.py", line 312, in
handleindents
      self.raiseerror("invalid indentation", tokennum)
    File "C:\Python24\Lib\site-packages\jToolkit\sparse.py", line 225, in
raiseerror
      raise ParserError(self, message, tokennum)
  ParserError: invalid indentation at line 441, char 9 (token '\n   ')
 
 2007-06-06 22:14:20: Error initializing server, exiting: invalid
indentation at line 441, char 9 (token '\n   ')

Adding few spaces resolved the problem.


Second one was a little bit more complicated. Whenever I commited a
translation, I got UnicodeDecodeError.

  2007-06-06 22:32:39: Traceback (most recent call last):
    File "C:\Python24\lib\site-packages\Pootle\users.py", line 235, in
handle
      page = self.getpage(pathwords, session, argdict)
    File "C:\Python24\lib\site-packages\Pootle\pootle.py", line 445, in
getpage
      return translatepage.TranslatePage(project, session, argdict,
dirfilter=pofilename)
    File "C:\Python24\lib\site-packages\Pootle\translatepage.py", line 62,
in __init__
      self.receivetranslations()
    File "C:\Python24\lib\site-packages\Pootle\translatepage.py", line 319,
in receivetranslations
      self.project.updatetranslation(self.pofilename, item, newvalues, self.
session)
    File "C:\Python24\lib\site-packages\Pootle\projects.py", line 1145, in
updatetranslation
      pofile.updateunit(item, newvalues, session.prefs, languageprefs)
    File "C:\Python24\lib\site-packages\Pootle\pootlefile.py", line 508, in
updateunit
      self.updateheader(add=True, **headerupdates)
    File "C:\Python24\lib\site-packages\Pootle\pootlefile.py", line 328, in
updateheader
      self.__innerobj__.updateheader(**kwargs)
    File "C:\Python24\lib\site-packages\translate\storage\poheader.py",
line 172,in updateheader
      headerString += "%s: %s\n" % (key, value)
  UnicodeDecodeError: 'ascii' codec can't decode byte 0xb4 in position 24:
ordinal not in range(128)

The black sheep was time.strftime("%z") used in
translate/storage/poheader.py. Author originally meant '+/-HHMM' format
string but python for Windows returns same value(localized time zone name)
for both "%z" and "%Z".

  Python 2.4.1 (#65, Mar 30 2005, 09:13:57) [MSC v.1310 32 bit (Intel)] on
win32
  Type "help", "copyright", "credits" or "license" for more information.
  >>> import time
  >>> time.strftime("%z")
  '\xb4\xeb\xc7\xd1\xb9\xce\xb1\xb9 \xc7\xa5\xc1\xd8\xbd\xc3'
  >>> time.strftime("%Z")
  '\xb4\xeb\xc7\xd1\xb9\xce\xb1\xb9 \xc7\xa5\xc1\xd8\xbd\xc3'

[Returned value is '대한민국 표준시' which means 'Korean Standard
Time(KST)'.]

This is not python's fault, because time.strftime() method just uses
strftime() of C library and Win32 version strftime() behaves just like
that. ANSI C(89) does not define "%z" as a format string ,and so Win32's
strftime() is still a conforming implementation.

Anyway, we need to modify string generation code for 'PO-Revision-Date' and
'POT-Creation-Date' in order to keep platform independance. I recommend use
of time.timezone value for calculation.


I used software packages of the following versions for testing.

  C:\Python24>python.exe Scripts\PootleServer --version
  PootleServer 1.0
  jToolkit 0.7.8
  Translate Toolkit 1.0
  Kid 0.9.5
  ElementTree 1.2.6
  Python 2.4.1 (#65, Mar 30 2005, 09:13:57) [MSC v.1310 32 bit (Intel)] (on
win32/nt)


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Translate-pootle mailing list
Translate-pootle@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/translate-pootle

Reply via email to