Commits

Diego Búrigo Zacarão committed 428d339

bugfix: Fixed encode problem with polib (#292, #297)

- Now Tx requires polib 0.4.2

Comments (0)

Files changed (3)

 django-notification = 0.1.3
 Markdown = 2.0.1
 PIL = 1.1.6
+polib = 0.4.2
 
 [python]
 recipe = zc.recipe.egg

docs/intro/install.txt

 
 .. code-block:: bash
 
-    easy_install Markdown httplib2 pygments polib
+    easy_install Markdown httplib2 pygments polib>=0.4.2
     easy_install django-pagination django-notification django-authority django-piston
     easy_install -f http://transifex.org/files/deps/ contact_form tagging userprofile
     easy_install -f http://effbot.org/downloads/ Imaging==1.1.6

transifex/webtrans/views.py

             if 'msgid_field_' in fieldname:
                 nkey = fieldname.split('msgid_field_')[1]
                 if request.POST.get('changed_field_%s' % nkey, None) == 'True':
-                    entry = po_entries.find(unescape(value.encode('utf-8')))
+                    entry = po_entries.find(unescape(value))
 
                     #TODO: Find out why it's needed to remove it first
                     po_entries.remove(entry)
 
-                    string = request.POST['msgstr_field_%s' % nkey].encode('utf-8')
+                    string = request.POST['msgstr_field_%s' % nkey]
                     entry.msgstr = unescape(string);
 
                     # Taking care of fuzzies flags
 
                     po_entries.append(entry)
 
-        edited_file = SimpleUploadedFile(filename, po_entries.__str__())
+        po_contents = po_entries.__str__().encode('utf-8')
+        edited_file = SimpleUploadedFile(filename, po_contents)
         edited_file.targetfile = filename
         submitted_file = {filename: edited_file}
         msg = settings.DVCS_SUBMIT_MSG % {'message': request.POST['message'],
             if settings.MSGFMT_CHECK and filename.endswith('.po'):
                 logger.debug("Checking %s with msgfmt -c for component %s" % 
                             (filename, component.full_name))
-                component.trans.msgfmt_check(edited_file)
+                component.trans.msgfmt_check(edited_file.read())
 
             logger.debug("Checking out for component %s" % component.full_name)
             component.prepare()