[Zope-Checkins] CVS: Zope2 - Image.py:1.128.6.2

Martijn Pieters mj@digicool.com
Wed, 18 Apr 2001 19:57:46 -0400 (EDT)


Update of /cvs-repository/Zope2/lib/python/OFS
In directory korak:/tmp/cvs-serv19456

Modified Files:
      Tag: mj-http_range_support-branch
	Image.py 
Log Message:
- Add a few end-overflow tests.

- Fix bugs exposed by tests.



--- Updated File Image.py in package Zope2 --
--- Image.py	2001/04/18 23:08:44	1.128.6.1
+++ Image.py	2001/04/18 23:57:45	1.128.6.2
@@ -183,6 +183,7 @@
         if start < 0:
             start = size + start
         end = end or size
+        if end > size: end = size
         # Only use satisfiable ranges
         if start < size:
             add((start, end))
@@ -400,6 +401,8 @@
                     if start < 0:
                         start = self.size + start
                     end = end or self.size
+                    if end > self.size:
+                        end = self.size
 
                     size = end - start