some more Python3 fixes

This commit is contained in:
Helmut Merz 2024-10-03 17:00:16 +02:00
parent 25277a0b65
commit 93a2acf7db
2 changed files with 6 additions and 25 deletions

View file

@ -60,7 +60,7 @@ class FileSystemStorage(object):
data = f.read() data = f.read()
f.close() f.close()
return data return data
except(IOError, e): except IOError as e:
logger.warn(e) logger.warn(e)
#'File %r cannot be read.' % fn) #'File %r cannot be read.' % fn)
return '' return ''
@ -70,7 +70,7 @@ class FileSystemStorage(object):
fn = self.getDir(address, subDir) fn = self.getDir(address, subDir)
try: try:
return os.path.getsize(fn) return os.path.getsize(fn)
except(OSError, e): except OSError as e:
logger.warn(e) logger.warn(e)
return 0 return 0
@ -81,7 +81,7 @@ class FileSystemStorage(object):
ts = os.path.getmtime(fn) ts = os.path.getmtime(fn)
if ts: if ts:
return datetime.fromtimestamp(ts) return datetime.fromtimestamp(ts)
except(OSError, e): except OSError as e:
logger.warn(e) logger.warn(e)
return None return None

View file

@ -1,25 +1,6 @@
# # cybertools.xedit.handler
# Copyright (c) 2007 Helmut Merz helmutm@cy55.de
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
""" """ HTTP method handler.
HTTP method handler.
$Id$
""" """
""" """
@ -66,4 +47,4 @@ class NullLOCK(object):
return '' return ''
def printRequest(self, request): def printRequest(self, request):
print self.request['wsgi.input'].read() print(self.request['wsgi.input'].read())