David Jean Louis avatar David Jean Louis committed e21de3b

* fixed regression that prevented POFile initialization from data to work (fixes issue #17)
* release 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')
         """
         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):
         """
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.