r13643 - in Products.Archetypes/trunk: . Products/Archetypes

"Hanno Schlichting" <[email protected]> Sat, 21 May 2011 18:37:56 +0000
Newsgroups gmane.comp.web.zope.plone.archetypes.cvs
Message-ID <[email protected]>
Author: hannosch
Date: Sat May 21 18:37:56 2011
New Revision: 13643

Modified:
   Products.Archetypes/trunk/CHANGES.txt
   Products.Archetypes/trunk/Products/Archetypes/utils.py
Log:
Fixed DisplayList slices to work on Windows 64bit. This closes #11232


Modified: Products.Archetypes/trunk/CHANGES.txt
==============================================================================
--- Products.Archetypes/trunk/CHANGES.txt	(original)
+++ Products.Archetypes/trunk/CHANGES.txt	Sat May 21 18:37:56 2011
@@ -4,6 +4,9 @@
 1.7.6 - unreleased
 ------------------
 
+- Fixed DisplayList slices to work on Windows 64bit. This closes
+  http://dev.plone.org/plone/ticket/11232.
+  [hannosch]
 
 1.7.5 - 2011-05-12
 ------------------

Modified: Products.Archetypes/trunk/Products/Archetypes/utils.py
==============================================================================
--- Products.Archetypes/trunk/Products/Archetypes/utils.py	(original)
+++ Products.Archetypes/trunk/Products/Archetypes/utils.py	Sat May 21 18:37:56 2011
@@ -2,6 +2,7 @@
 import os
 import sys
 from inspect import getargs, getmro
+from itertools import islice, count
 from types import ClassType, MethodType
 from UserDict import UserDict as BaseDict
 
@@ -400,14 +401,17 @@
         #itor/generators
         return self._itor[key]
 
-    def __getslice__(self,i1,i2):
-        r=[]
-        for i in xrange(i1,i2):
-            try: r.append((self._itor[i], self.getValue(self._itor[i]),))
-            except IndexError: return r
+    def __getslice__(self, i1, i2):
+        r = []
+        for i in islice(count(i1), i2-i1):
+            try:
+                r.append((self._itor[i], self.getValue(self._itor[i]), ))
+            except IndexError:
+                return r
         return DisplayList(r)
 
-    slice=__getslice__
+    slice = __getslice__
+
 
 InitializeClass(DisplayList)
 

------------------------------------------------------------------------------
What Every C/C++ and Fortran developer Should Know!
Read this article and learn how Intel has extended the reach of its 
next-generation tools to help Windows* and Linux* C/C++ and Fortran 
developers boost performance applications - including clusters. 
http://p.sf.net/sfu/intel-dev2devmay