Commits

David Jean Louis  committed e21de3b

* fixed regression that prevented POFile initialization from data to work (fixes issue #17)
* release 0.6.1

  • Participants
  • Parent commits 632d3b8
  • Tags 0.6.1

Comments (0)

Files changed (3)

 Changelog
 =========
 
+Version 0.6.1 (2011/02/09)
+--------------------------
+ - fixed regression that prevented POFile initialization from data to work (issue #17).
+
 Version 0.6.0 (2011/02/07)
 --------------------------
  - polib is now `fully documented <http://polib.readthedocs.org>`_,
 """
 
 __author__    = 'David Jean Louis <izimobil@gmail.com>'
-__version__   = '0.6.0'
+__version__   = '0.6.1'
 __all__       = ['pofile', 'POFile', 'POEntry', 'mofile', 'MOFile', 'MOEntry',
                  'detect_encoding', 'escape', 'unescape', 'detect_encoding',]
 
     Internal function used by :func:`polib.pofile` and :func:`polib.mofile` to
     honor the DRY concept.
     """
-    if not os.path.exists(f):
-        raise OSError("No such file or directory: '%s'" % f)
-
     # get the file encoding
     if kwargs.get('autodetect_encoding', True):
         enc = detect_encoding(f, type == 'mofile')

File tests/tests.py

         """
         Test bad usage of pofile/mofile. 
         """
-        def bad_call():
-            polib.pofile('not_a_file.txt')
-        self.assertRaises(OSError, bad_call)
+        data = u'''# test for pofile/mofile with string buffer
+msgid ""
+msgstr ""
+"Project-Id-Version: django\n"
+
+msgid "foo"
+msgstr "bar"
+'''
+        po = polib.pofile(data)
+        self.assertTrue(isinstance(po, polib.POFile))
+        self.assertEqual(po.encoding, 'utf-8')
+        self.assertEqual(po[0].msgstr, u"bar")
 
     def test_pofile_and_mofile2(self):
         """