[Zope3-checkins] CVS: Zope3/src/zope/app/content - file.py:1.1.2.4 i18nfile.py:1.1.2.2 i18nimage.py:1.1.2.5 image.py:1.1.2.3
Tim Peters
tim.one@comcast.net
Tue, 24 Dec 2002 21:21:25 -0500
Update of /cvs-repository/Zope3/src/zope/app/content
In directory cvs.zope.org:/tmp/cvs-serv19240/src/zope/app/content
Modified Files:
Tag: NameGeddon-branch
file.py i18nfile.py i18nimage.py image.py
Log Message:
Whitespace normalization, via Python's Tools/scripts/reindent.py. The
files are fixed-points of that script now. Fixed a few cases where
code relied on significant trailing whitespace (ouch).
=== Zope3/src/zope/app/content/file.py 1.1.2.3 => 1.1.2.4 ===
--- Zope3/src/zope/app/content/file.py:1.1.2.3 Tue Dec 24 07:51:00 2002
+++ Zope3/src/zope/app/content/file.py Tue Dec 24 21:20:24 2002
@@ -2,14 +2,14 @@
#
# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
-#
+#
##############################################################################
"""
@@ -48,22 +48,22 @@
'''See interface IFile'''
self._contentType = contentType
-
+
def getContentType(self):
'''See interface Zope.App.OFS.Content.File.IFile.IFile'''
return self._contentType
-
+
def edit(self, data, contentType=None):
'''See interface IFile'''
# XXX This seems broken to me, as setData can override the
# content type explicitly passed in.
-
+
if contentType is not None:
self._contentType = contentType
if hasattr(data, '__class__') and data.__class__ is FileUpload \
and not data.filename:
- data = None # Ignore empty files
+ data = None # Ignore empty files
if data is not None:
self.data = data
@@ -105,7 +105,7 @@
# Handle case when data is a file object
seek = data.seek
read = data.read
-
+
seek(0, 2)
size = end = data.tell()
@@ -120,9 +120,9 @@
# Make sure we have an _p_jar, even if we are a new object, by
# doing a sub-transaction commit.
get_transaction().savepoint()
-
+
jar = self._p_jar
-
+
if jar is None:
# Ugh
seek(0)
@@ -140,7 +140,7 @@
pos = 0 # we always want at least MAXCHUNKSIZE bytes
seek(pos)
data = FileChunk(read(end - pos))
-
+
# Woooop Woooop Woooop! This is a trick.
# We stuff the data directly into our jar to reduce the
# number of updates necessary.
@@ -149,17 +149,17 @@
# This is needed and has side benefit of getting
# the thing registered:
data.next = next
-
+
# Now make it get saved in a sub-transaction!
get_transaction().savepoint()
# Now make it a ghost to free the memory. We
# don't need it anymore!
data._p_changed = None
-
+
next = data
end = pos
-
+
self._data, self._size = next, size
return None
@@ -201,7 +201,7 @@
# Wrapper for possibly large data
next = None
-
+
def __init__(self, data):
self._data = data
@@ -225,5 +225,5 @@
self = next
result.append(self._data)
next = self.next
-
+
return ''.join(result)
=== Zope3/src/zope/app/content/i18nfile.py 1.1.2.1 => 1.1.2.2 ===
--- Zope3/src/zope/app/content/i18nfile.py:1.1.2.1 Tue Dec 24 11:25:58 2002
+++ Zope3/src/zope/app/content/i18nfile.py Tue Dec 24 21:20:24 2002
@@ -2,14 +2,14 @@
#
# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
-#
+#
##############################################################################
"""
@@ -100,7 +100,7 @@
self.setContentType(contentType)
if hasattr(data, '__class__') and data.__class__ is FileUpload \
and not data.filename:
- data = None # Ignore empty files
+ data = None # Ignore empty files
if data is not None:
self.setData(data, language)
@@ -143,5 +143,3 @@
if self._data.has_key(language):
del self._data[language]
self._p_changed = 1
-
-
=== Zope3/src/zope/app/content/i18nimage.py 1.1.2.4 => 1.1.2.5 ===
--- Zope3/src/zope/app/content/i18nimage.py:1.1.2.4 Tue Dec 24 11:25:58 2002
+++ Zope3/src/zope/app/content/i18nimage.py Tue Dec 24 21:20:24 2002
@@ -2,14 +2,14 @@
#
# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
-#
+#
##############################################################################
"""
Revision Information:
=== Zope3/src/zope/app/content/image.py 1.1.2.2 => 1.1.2.3 ===
--- Zope3/src/zope/app/content/image.py:1.1.2.2 Tue Dec 24 07:51:00 2002
+++ Zope3/src/zope/app/content/image.py Tue Dec 24 21:20:24 2002
@@ -2,14 +2,14 @@
#
# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
-#
+#
##############################################################################
"""
$Id$
@@ -39,7 +39,7 @@
def setData(self, data):
-
+
super(Image, self).setData(data)
if data is not None:
@@ -64,7 +64,7 @@
width = -1
content_type = ''
- # handle GIFs
+ # handle GIFs
if (size >= 10) and data[:6] in ('GIF87a', 'GIF89a'):
# Check to see if content_type is correct
content_type = 'image/gif'
@@ -81,7 +81,7 @@
w, h = struct.unpack(">LL", data[16:24])
width = int(w)
height = int(h)
-
+
# Maybe this is for an older PNG version.
elif (size >= 16) and data.startswith('\211PNG\r\n\032\n'):
# Check to see if we have the right content type