Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
Zope
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
Zope
Commits
b46e4902
Commit
b46e4902
authored
Apr 09, 2001
by
Andreas Jung
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
merged FTP globbing/recursive patch
parent
1ca0eb84
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
66 additions
and
4 deletions
+66
-4
ZServer/FTPRequest.py
ZServer/FTPRequest.py
+14
-1
ZServer/FTPServer.py
ZServer/FTPServer.py
+19
-1
lib/python/ZServer/FTPRequest.py
lib/python/ZServer/FTPRequest.py
+14
-1
lib/python/ZServer/FTPServer.py
lib/python/ZServer/FTPServer.py
+19
-1
No files found.
ZServer/FTPRequest.py
View file @
b46e4902
...
...
@@ -100,10 +100,18 @@ import string
class
FTPRequest
(
HTTPRequest
):
def
__init__
(
self
,
path
,
command
,
channel
,
response
,
stdin
=
None
,
environ
=
None
):
environ
=
None
,
globbing
=
None
,
recursive
=
0
):
# we need to store the globbing information to pass it
# to the ZPublisher and the manage_FTPlist function
# (ajung)
self
.
globbing
=
globbing
self
.
recursive
=
recursive
if
stdin
is
None
:
stdin
=
StringIO
()
if
environ
is
None
:
environ
=
self
.
_get_env
(
path
,
command
,
channel
,
stdin
)
self
.
_orig_env
=
environ
HTTPRequest
.
__init__
(
self
,
stdin
,
environ
,
response
,
clean
=
1
)
...
...
@@ -174,6 +182,11 @@ class FTPRequest(HTTPRequest):
env
[
'CONTENT_LENGTH'
]
=
len
(
stdin
.
getvalue
())
else
:
env
[
'PATH_INFO'
]
=
self
.
_join_paths
(
channel
.
path
,
path
,
command
)
# Fake in globbing information
env
[
'GLOBBING'
]
=
self
.
globbing
env
[
'FTP_RECURSIVE'
]
=
self
.
recursive
return
env
def
_join_paths
(
self
,
*
args
):
...
...
ZServer/FTPServer.py
View file @
b46e4902
...
...
@@ -140,6 +140,7 @@ from PubCore import handle
from
medusa.ftp_server
import
ftp_channel
,
ftp_server
,
recv_channel
import
asyncore
,
asynchat
from
medusa
import
filesys
from
FTPResponse
import
make_response
from
FTPRequest
import
FTPRequest
...
...
@@ -203,28 +204,45 @@ class zope_ftp_channel(ftp_channel):
self
.
get_dir_list
(
line
,
1
)
def
get_dir_list
(
self
,
line
,
long
=
0
):
self
.
globbing
=
None
self
.
recursive
=
0
# we need to scan the command line for arguments to '/bin/ls'...
# XXX clean this up, maybe with getopts
if
len
(
line
)
>
1
:
args
=
string
.
split
(
line
[
1
])
else
:
args
=
[]
path_args
=
[]
# Extract globbing information
for
i
in
range
(
len
(
args
)):
x
=
args
[
i
]
if
string
.
find
(
x
,
'*'
)
!=-
1
or
string
.
find
(
x
,
'?'
)
!=-
1
:
self
.
globbing
=
x
args
[
i
]
=
'.'
for
arg
in
args
:
if
arg
[
0
]
!=
'-'
:
path_args
.
append
(
arg
)
else
:
if
'l'
in
arg
:
long
=
1
if
'R'
in
arg
:
self
.
recursive
=
1
if
len
(
path_args
)
<
1
:
dir
=
'.'
else
:
dir
=
path_args
[
0
]
self
.
listdir
(
dir
,
long
)
def
listdir
(
self
,
path
,
long
=
0
):
response
=
make_response
(
self
,
self
.
listdir_completion
,
long
)
request
=
FTPRequest
(
path
,
'LST'
,
self
,
response
)
request
=
FTPRequest
(
path
,
'LST'
,
self
,
response
,
globbing
=
self
.
globbing
,
recursive
=
self
.
recursive
)
handle
(
self
.
module
,
request
,
response
)
def
listdir_completion
(
self
,
long
,
response
):
...
...
lib/python/ZServer/FTPRequest.py
View file @
b46e4902
...
...
@@ -100,10 +100,18 @@ import string
class
FTPRequest
(
HTTPRequest
):
def
__init__
(
self
,
path
,
command
,
channel
,
response
,
stdin
=
None
,
environ
=
None
):
environ
=
None
,
globbing
=
None
,
recursive
=
0
):
# we need to store the globbing information to pass it
# to the ZPublisher and the manage_FTPlist function
# (ajung)
self
.
globbing
=
globbing
self
.
recursive
=
recursive
if
stdin
is
None
:
stdin
=
StringIO
()
if
environ
is
None
:
environ
=
self
.
_get_env
(
path
,
command
,
channel
,
stdin
)
self
.
_orig_env
=
environ
HTTPRequest
.
__init__
(
self
,
stdin
,
environ
,
response
,
clean
=
1
)
...
...
@@ -174,6 +182,11 @@ class FTPRequest(HTTPRequest):
env
[
'CONTENT_LENGTH'
]
=
len
(
stdin
.
getvalue
())
else
:
env
[
'PATH_INFO'
]
=
self
.
_join_paths
(
channel
.
path
,
path
,
command
)
# Fake in globbing information
env
[
'GLOBBING'
]
=
self
.
globbing
env
[
'FTP_RECURSIVE'
]
=
self
.
recursive
return
env
def
_join_paths
(
self
,
*
args
):
...
...
lib/python/ZServer/FTPServer.py
View file @
b46e4902
...
...
@@ -140,6 +140,7 @@ from PubCore import handle
from
medusa.ftp_server
import
ftp_channel
,
ftp_server
,
recv_channel
import
asyncore
,
asynchat
from
medusa
import
filesys
from
FTPResponse
import
make_response
from
FTPRequest
import
FTPRequest
...
...
@@ -203,28 +204,45 @@ class zope_ftp_channel(ftp_channel):
self
.
get_dir_list
(
line
,
1
)
def
get_dir_list
(
self
,
line
,
long
=
0
):
self
.
globbing
=
None
self
.
recursive
=
0
# we need to scan the command line for arguments to '/bin/ls'...
# XXX clean this up, maybe with getopts
if
len
(
line
)
>
1
:
args
=
string
.
split
(
line
[
1
])
else
:
args
=
[]
path_args
=
[]
# Extract globbing information
for
i
in
range
(
len
(
args
)):
x
=
args
[
i
]
if
string
.
find
(
x
,
'*'
)
!=-
1
or
string
.
find
(
x
,
'?'
)
!=-
1
:
self
.
globbing
=
x
args
[
i
]
=
'.'
for
arg
in
args
:
if
arg
[
0
]
!=
'-'
:
path_args
.
append
(
arg
)
else
:
if
'l'
in
arg
:
long
=
1
if
'R'
in
arg
:
self
.
recursive
=
1
if
len
(
path_args
)
<
1
:
dir
=
'.'
else
:
dir
=
path_args
[
0
]
self
.
listdir
(
dir
,
long
)
def
listdir
(
self
,
path
,
long
=
0
):
response
=
make_response
(
self
,
self
.
listdir_completion
,
long
)
request
=
FTPRequest
(
path
,
'LST'
,
self
,
response
)
request
=
FTPRequest
(
path
,
'LST'
,
self
,
response
,
globbing
=
self
.
globbing
,
recursive
=
self
.
recursive
)
handle
(
self
.
module
,
request
,
response
)
def
listdir_completion
(
self
,
long
,
response
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment