[PyObjC-svn] r2598 - in branches/pyobjc-2.3.x: . pyobjc-core/Lib/objc
[email protected] Tue, 05 Oct 2010 07:16:18 -0500
| Newsgroups | gmane.comp.python.pyobjc.cvs |
|---|---|
| Message-ID | <[email protected]> |
Author: ronaldoussoren
Date: Tue Oct 5 07:16:18 2010
New Revision: 2598
Log:
Merged revisions 2595 via svnmerge from
https://svn.red-bean.com/pyobjc/trunk/pyobjc
........
r2595 | ronaldoussoren | 2010-10-05 14:09:52 +0200 (Tue, 05 Oct 2010) | 2 lines
Avoid exceptions when doing str(anNSData).
........
Modified:
branches/pyobjc-2.3.x/ (props changed)
branches/pyobjc-2.3.x/pyobjc-core/Lib/objc/_convenience.py
Modified: branches/pyobjc-2.3.x/pyobjc-core/Lib/objc/_convenience.py
==============================================================================
--- branches/pyobjc-2.3.x/pyobjc-core/Lib/objc/_convenience.py (original)
+++ branches/pyobjc-2.3.x/pyobjc-core/Lib/objc/_convenience.py Tue Oct 5 07:16:18 2010
@@ -767,8 +767,22 @@
except TypeError:
return buff[:][item]
+
+if sys.version_info[:2] <= (2,6):
+ def NSData__str__(self):
+ return self.bytes()[:]
+
+elif sys.version_info[0] == 2:
+ def NSData__str__(self):
+ return str(self.bytes().tobytes())
+
+else:
+ def NSData__str__(self):
+ return str(self.bytes().tobytes())
+
+
CLASS_METHODS['NSData'] = (
- ('__str__', lambda self: self.bytes()[:]),
+ ('__str__', NSData__str__),
('__getitem__', NSData__getitem__),
('__getslice__', NSData__getslice__),
)
------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1, ECMAScript5, and DOM L2 & L3.
Spend less time writing and rewriting code and more time creating great
experiences on the web. Be a part of the beta today.
http://p.sf.net/sfu/beautyoftheweb