Commit 3e611ec2 authored by Amos Latteier's avatar Amos Latteier

Fixed FTP listing so that you cannot list or cd to an acquired directory or object.

parent ff86bd9b
...@@ -84,9 +84,9 @@ ...@@ -84,9 +84,9 @@
############################################################################## ##############################################################################
__doc__="""Object Manager __doc__="""Object Manager
$Id: ObjectManager.py,v 1.77 1999/07/15 16:49:02 jim Exp $""" $Id: ObjectManager.py,v 1.78 1999/07/19 05:58:34 amos Exp $"""
__version__='$Revision: 1.77 $'[11:-2] __version__='$Revision: 1.78 $'[11:-2]
import App.Management, Acquisition, App.Undo, Globals, CopySupport import App.Management, Acquisition, App.Undo, Globals, CopySupport
import os, App.FactoryDispatcher, ts_regex, Products import os, App.FactoryDispatcher, ts_regex, Products
...@@ -97,6 +97,7 @@ from webdav.Collection import Collection ...@@ -97,6 +97,7 @@ from webdav.Collection import Collection
from urllib import quote from urllib import quote
from cStringIO import StringIO from cStringIO import StringIO
import marshal import marshal
import App.Common
bad_id=ts_regex.compile('[^a-zA-Z0-9-_~\,\. ]').match #TS bad_id=ts_regex.compile('[^a-zA-Z0-9-_~\,\. ]').match #TS
...@@ -475,11 +476,16 @@ class ObjectManager( ...@@ -475,11 +476,16 @@ class ObjectManager(
def manage_FTPlist(self,REQUEST): def manage_FTPlist(self,REQUEST):
"Directory listing for FTP" "Directory listing for FTP"
out=() out=()
# check to see if we are acquiring our objectValues or not
if len(REQUEST.PARENTS) > 1 and \ # check to see if we are being acquiring or not
self.objectValues()==REQUEST.PARENTS[1].objectValues(): ob=self
raise ValueError, 'FTP List not supported on acquired objects' while 1:
# XXX what type of error to raise? if App.Common.is_acquired(ob):
raise ValueError('FTP List not supported on acquired objects')
if not hasattr(ob,'aq_parent'):
break
ob=ob.aq_parent
files=self.objectItems() files=self.objectItems()
if not (hasattr(self,'isTopLevelPrincipiaApplicationObject') and if not (hasattr(self,'isTopLevelPrincipiaApplicationObject') and
self.isTopLevelPrincipiaApplicationObject): self.isTopLevelPrincipiaApplicationObject):
......
...@@ -89,8 +89,8 @@ Aqueduct database adapters, etc. ...@@ -89,8 +89,8 @@ Aqueduct database adapters, etc.
This module can also be used as a simple template for implementing new This module can also be used as a simple template for implementing new
item types. item types.
$Id: SimpleItem.py,v 1.59 1999/06/24 19:27:25 jim Exp $''' $Id: SimpleItem.py,v 1.60 1999/07/19 05:58:34 amos Exp $'''
__version__='$Revision: 1.59 $'[11:-2] __version__='$Revision: 1.60 $'[11:-2]
import regex, sys, Globals, App.Management, Acquisition import regex, sys, Globals, App.Management, Acquisition
from webdav.Resource import Resource from webdav.Resource import Resource
...@@ -101,6 +101,7 @@ from string import join, lower, find, split ...@@ -101,6 +101,7 @@ from string import join, lower, find, split
from types import InstanceType, StringType from types import InstanceType, StringType
from ComputedAttribute import ComputedAttribute from ComputedAttribute import ComputedAttribute
from urllib import quote from urllib import quote
import App.Common
import marshal import marshal
...@@ -286,6 +287,15 @@ class Item(Base, Resource, CopySource, App.Management.Tabs): ...@@ -286,6 +287,15 @@ class Item(Base, Resource, CopySource, App.Management.Tabs):
def manage_FTPlist(self,REQUEST): def manage_FTPlist(self,REQUEST):
"""Directory listing for FTP. In the case of non-Foldoid objects, """Directory listing for FTP. In the case of non-Foldoid objects,
the listing should contain one object, the object itself.""" the listing should contain one object, the object itself."""
# check to see if we are being acquiring or not
ob=self
while 1:
if App.Common.is_acquired(ob):
raise ValueError('FTP List not supported on acquired objects')
if not hasattr(ob,'aq_parent'):
break
ob=ob.aq_parent
stat=marshal.loads(self.manage_FTPstat(REQUEST)) stat=marshal.loads(self.manage_FTPstat(REQUEST))
if callable(self.id): id=self.id() if callable(self.id): id=self.id()
else: id=self.id else: id=self.id
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment