[Zope-Checkins] CVS: Zope3/lib/python/Zope/Server/FTP - CommonFTPActivityLogger.py:1.1.2.5 FTPServerChannel.py:1.1.2.23 OSEmulators.py:1.1.2.2 PublisherFTPServerChannel.py:1.1.2.3 PublisherFilesystemAccess.py:1.1.2.2
Shane Hathaway
shane@cvs.zope.org
Thu, 11 Apr 2002 10:13:17 -0400
Update of /cvs-repository/Zope3/lib/python/Zope/Server/FTP
In directory cvs.zope.org:/tmp/cvs-serv24692/FTP
Modified Files:
Tag: Zope3-Server-Branch
CommonFTPActivityLogger.py FTPServerChannel.py OSEmulators.py
PublisherFTPServerChannel.py PublisherFilesystemAccess.py
Log Message:
Removed CRs
=== Zope3/lib/python/Zope/Server/FTP/CommonFTPActivityLogger.py 1.1.2.4 => 1.1.2.5 ===
task.channel.cwd,
)
-
+
self.output.log('127.0.0.1', message)
=== Zope3/lib/python/Zope/Server/FTP/FTPServerChannel.py 1.1.2.22 => 1.1.2.23 ===
"""Open the filesystem using the current credentials."""
return self.server.fs_access.open(self.credentials)
-
+
############################################################
# Implementation methods for interface
@@ -178,7 +178,7 @@
# We simply do not understand this non-standard extension to MDTM
if len(args.split()) > 1:
self.reply('ERR_ARGS')
- return
+ return
path = self._generatePath(args)
if not self._getFilesystem().isfile(path):
self.reply('ERR_IS_NOT_FILE', path)
=== Zope3/lib/python/Zope/Server/FTP/OSEmulators.py 1.1.2.1 => 1.1.2.2 ===
-#
-# 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$
-"""
-
-import stat
-import time
-import pwd, grp
-
-months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
- 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
-
-mode_table = {
- '0':'---',
- '1':'--x',
- '2':'-w-',
- '3':'-wx',
- '4':'r--',
- '5':'r-x',
- '6':'rw-',
- '7':'rwx'
- }
-
-
-def unix_longify((file, stat_info)):
- # for now, only pay attention to the lower bits
-
- try: username = pwd.getpwuid(int(stat_info[stat.ST_UID]))[0]
- except: username = stat_info[stat.ST_UID]
-
- try: grpname = grp.getgrgid(int(stat_info[stat.ST_GID]))[0]
- except: grpname = stat_info[stat.ST_GID]
-
-
- mode = ('%o' % stat_info[stat.ST_MODE])[-3:]
- mode = ''.join(map (lambda x: mode_table[x], mode))
- if stat.S_ISDIR (stat_info[stat.ST_MODE]):
- dirchar = 'd'
- else:
- dirchar = '-'
- date = ls_date (long(time.time()), stat_info[stat.ST_MTIME])
- return '%s%s %3d %-8s %-8s %8d %s %s' % (
- dirchar,
- mode,
- stat_info[stat.ST_NLINK],
- username,
- grpname,
- stat_info[stat.ST_SIZE],
- date,
- file
- )
-
-
-def ls_date (now, t):
- """Emulate the unix 'ls' command's date field. it has two formats
- - if the date is more than 180 days in the past, then it's like
- this: Oct 19 1995 otherwise, it looks like this: Oct 19 17:33
- """
- try:
- info = time.gmtime(t)
- except:
- info = time.gmtime(0)
-
- # 15,600,000 == 86,400 * 180
- if (now - t) > 15600000:
- return '%s %2d %d' % (
- months[info[1]-1],
- info[2],
- info[0]
- )
- else:
- return '%s %2d %02d:%02d' % (
- months[info[1]-1],
- info[2],
- info[3],
- info[4]
- )
-
-
-def msdos_longify((file, stat_info)):
- """This matches the output of NT's ftp server (when in MSDOS mode)
- exactly.
- """
- if stat.S_ISDIR(stat_info[stat.ST_MODE]):
- dir = '<DIR>'
- else:
- dir = ' '
- date = msdos_date(stat_info[stat.ST_MTIME])
- return '%s %s %8d %s' % (date, dir, stat_info[stat.ST_SIZE], file)
-
-
-def msdos_date(t):
- try:
- info = time.gmtime(t)
- except:
- info = time.gmtime(0)
-
- # year, month, day, hour, minute, second, ...
- if info[3] > 11:
- merid = 'PM'
- info[3] = info[3] - 12
- else:
- merid = 'AM'
-
- return '%02d-%02d-%02d %02d:%02d%s' % (
- info[1], info[2], info[0]%100, info[3], info[4], merid )
+##############################################################################
+#
+# 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$
+"""
+
+import stat
+import time
+import pwd, grp
+
+months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
+ 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
+
+mode_table = {
+ '0':'---',
+ '1':'--x',
+ '2':'-w-',
+ '3':'-wx',
+ '4':'r--',
+ '5':'r-x',
+ '6':'rw-',
+ '7':'rwx'
+ }
+
+
+def unix_longify((file, stat_info)):
+ # for now, only pay attention to the lower bits
+
+ try: username = pwd.getpwuid(int(stat_info[stat.ST_UID]))[0]
+ except: username = stat_info[stat.ST_UID]
+
+ try: grpname = grp.getgrgid(int(stat_info[stat.ST_GID]))[0]
+ except: grpname = stat_info[stat.ST_GID]
+
+
+ mode = ('%o' % stat_info[stat.ST_MODE])[-3:]
+ mode = ''.join(map (lambda x: mode_table[x], mode))
+ if stat.S_ISDIR (stat_info[stat.ST_MODE]):
+ dirchar = 'd'
+ else:
+ dirchar = '-'
+ date = ls_date (long(time.time()), stat_info[stat.ST_MTIME])
+ return '%s%s %3d %-8s %-8s %8d %s %s' % (
+ dirchar,
+ mode,
+ stat_info[stat.ST_NLINK],
+ username,
+ grpname,
+ stat_info[stat.ST_SIZE],
+ date,
+ file
+ )
+
+
+def ls_date (now, t):
+ """Emulate the unix 'ls' command's date field. it has two formats
+ - if the date is more than 180 days in the past, then it's like
+ this: Oct 19 1995 otherwise, it looks like this: Oct 19 17:33
+ """
+ try:
+ info = time.gmtime(t)
+ except:
+ info = time.gmtime(0)
+
+ # 15,600,000 == 86,400 * 180
+ if (now - t) > 15600000:
+ return '%s %2d %d' % (
+ months[info[1]-1],
+ info[2],
+ info[0]
+ )
+ else:
+ return '%s %2d %02d:%02d' % (
+ months[info[1]-1],
+ info[2],
+ info[3],
+ info[4]
+ )
+
+
+def msdos_longify((file, stat_info)):
+ """This matches the output of NT's ftp server (when in MSDOS mode)
+ exactly.
+ """
+ if stat.S_ISDIR(stat_info[stat.ST_MODE]):
+ dir = '<DIR>'
+ else:
+ dir = ' '
+ date = msdos_date(stat_info[stat.ST_MTIME])
+ return '%s %s %8d %s' % (date, dir, stat_info[stat.ST_SIZE], file)
+
+
+def msdos_date(t):
+ try:
+ info = time.gmtime(t)
+ except:
+ info = time.gmtime(0)
+
+ # year, month, day, hour, minute, second, ...
+ if info[3] > 11:
+ merid = 'PM'
+ info[3] = info[3] - 12
+ else:
+ merid = 'AM'
+
+ return '%02d-%02d-%02d %02d:%02d%s' % (
+ info[1], info[2], info[0]%100, info[3], info[4], merid )
=== Zope3/lib/python/Zope/Server/FTP/PublisherFTPServerChannel.py 1.1.2.2 => 1.1.2.3 ===
else:
return 0, 'User could not be authenticated.'
-
-
+
+
=== Zope3/lib/python/Zope/Server/FTP/PublisherFilesystemAccess.py 1.1.2.1 => 1.1.2.2 ===
def open(self, credentials):
- return PublisherFileSystem(credentials, self.request_factory)
+ return PublisherFileSystem(credentials, self.request_factory)