[Zope] FW: [Zope] FTP for ZClass hierarchies
M. Adam Kendall
mak@kha0s.org
Thu, 7 Dec 2000 15:46:32 -0500
This is a multi-part message in MIME format.
------=_NextPart_000_0003_01C06064.DF149CC0
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: 7bit
ARGH.. Spoke too soon.. just figured out how to override it
so it actually WILL let you get to methods of inner Zclasses.
And yes, I have tried to save back to the methods and they
save fine.. The next thing to try to tackle is how to make
FTP create a DTML Method instead of DTML Document as the
default when creating new files.
Hope this helps.
> In the past few days I have been working on a patch that will
> let you edit ZClasses via FTP without the need for typing in
> actual pathnames to get to the methods (mainly so I can edit
> ZClasses with HTML-Kit). Strangely enough, even with the
> modifications, I see this same thing.
------=_NextPart_000_0003_01C06064.DF149CC0
Content-Type: application/octet-stream;
name="ZClassFTP.patch"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
filename="ZClassFTP.patch"
diff -ur /root/Zope-2.2.4-linux2-x86/lib/python/ZClasses/Method.py =
Zope/lib/python/ZClasses/Method.py=0A=
--- /root/Zope-2.2.4-linux2-x86/lib/python/ZClasses/Method.py Mon Aug 14 =
10:47:51 2000=0A=
+++ Zope/lib/python/ZClasses/Method.py Thu Dec 7 14:13:20 2000=0A=
@@ -92,6 +92,8 @@=0A=
import ZClassOwner=0A=
from AccessControl.PermissionMapping import aqwrap, PermissionMapper=0A=
=0A=
+import marshal=0A=
+=0A=
_marker=3D[]=0A=
class ZClassMethodsSheet(=0A=
OFS.PropertySheets.PropertySheet,=0A=
@@ -104,6 +106,28 @@=0A=
icon=3D'p_/Methods_icon'=0A=
=0A=
def tpURL(self): return 'propertysheets/methods'=0A=
+=0A=
+ def manage_FTPstat(self,REQUEST):=0A=
+ "Psuedo stat used for FTP listings"=0A=
+ mode=3D0040000|0770=0A=
+ mtime=3Dself.bobobase_modification_time().timeTime()=0A=
+ owner=3Dgroup=3D'Zope'=0A=
+ return =
marshal.dumps((mode,0,0,1,owner,group,0,mtime,mtime,mtime))=0A=
+=0A=
+ def manage_FTPlist(self,REQUEST):=0A=
+ "Directory listing for FTP"=0A=
+ out=3D()=0A=
+ files=3Dself.objectItems()=0A=
+ if not (hasattr(self,'isTopLevelPrincipiaApplicationObject') and=0A=
+ self.isTopLevelPrincipiaApplicationObject):=0A=
+ files.insert(0,('..',self.aq_parent))=0A=
+ for k,v in files:=0A=
+ try: stat=3Dmarshal.loads(v.manage_FTPstat(REQUEST))=0A=
+ except:=0A=
+ stat=3DNone=0A=
+ if stat is not None:=0A=
+ out=3Dout+((k,stat),)=0A=
+ return marshal.dumps(out)=0A=
=0A=
=
######################################################################=0A=
# Hijinks to let us create factories and classes within classes.=0A=
diff -ur /root/Zope-2.2.4-linux2-x86/lib/python/ZClasses/ZClass.py =
Zope/lib/python/ZClasses/ZClass.py=0A=
--- /root/Zope-2.2.4-linux2-x86/lib/python/ZClasses/ZClass.py Wed Nov 1 =
15:11:24 2000=0A=
+++ Zope/lib/python/ZClasses/ZClass.py Thu Dec 7 13:31:59 2000=0A=
@@ -91,7 +91,8 @@=0A=
from ExtensionClass import Base=0A=
from App.FactoryDispatcher import FactoryDispatcher=0A=
from ComputedAttribute import ComputedAttribute=0A=
-import OFS.PropertySheets=0A=
+=0A=
+import marshal=0A=
=0A=
if not hasattr(Products, 'meta_types'):=0A=
Products.meta_types=3D()=0A=
@@ -281,6 +282,28 @@=0A=
('', '__call__', 'index_html', 'createInObjectManager')),=0A=
)=0A=
=0A=
+ def manage_FTPlist(self,REQUEST):=0A=
+ "Directory listing for FTP"=0A=
+ out=3D()=0A=
+ files=3Dself.__dict__.items()=0A=
+ if not (hasattr(self,'isTopLevelPrincipiaApplicationObject') and=0A=
+ self.isTopLevelPrincipiaApplicationObject):=0A=
+ files.insert(0,('..',self.aq_parent))=0A=
+ for k,v in files:=0A=
+ try: stat=3Dmarshal.loads(v.manage_FTPstat(REQUEST))=0A=
+ except:=0A=
+ stat=3DNone=0A=
+ if stat is not None:=0A=
+ out=3Dout+((k,stat),)=0A=
+ return marshal.dumps(out)=0A=
+=0A=
+ def manage_FTPstat(self,REQUEST):=0A=
+ "Psuedo stat used for FTP listings"=0A=
+ mode=3D0040000|0770=0A=
+ mtime=3Dself.bobobase_modification_time().timeTime()=0A=
+ owner=3Dgroup=3D'Zope'=0A=
+ return =
marshal.dumps((mode,0,0,1,owner,group,0,mtime,mtime,mtime))=0A=
+=0A=
def __init__(self, id, title, bases, zope_object=3D1):=0A=
"""Build a Zope class=0A=
=0A=
@@ -640,6 +663,28 @@=0A=
views =3D Basic.ZClassViewsSheet('views')=0A=
basic =3D Basic.ZClassBasicSheet('basic')=0A=
permissions =3D Basic.ZClassPermissionsSheet('permissions')=0A=
+=0A=
+ def manage_FTPlist(self,REQUEST):=0A=
+ "Directory listing for FTP"=0A=
+ out=3D()=0A=
+ files=3Dself.__dict__.items()=0A=
+ if not (hasattr(self,'isTopLevelPrincipiaApplicationObject') and=0A=
+ self.isTopLevelPrincipiaApplicationObject):=0A=
+ files.insert(0,('..',self.aq_parent))=0A=
+ for k,v in files:=0A=
+ try: stat=3Dmarshal.loads(v.manage_FTPstat(REQUEST))=0A=
+ except:=0A=
+ stat=3DNone=0A=
+ if stat is not None:=0A=
+ out=3Dout+((k,stat),)=0A=
+ return marshal.dumps(out)=0A=
+=0A=
+ def manage_FTPstat(self,REQUEST):=0A=
+ "Psuedo stat used for FTP listings"=0A=
+ mode=3D0040000|0770=0A=
+ mtime=3Dself.bobobase_modification_time().timeTime()=0A=
+ owner=3Dgroup=3D'Zope'=0A=
+ return =
marshal.dumps((mode,0,0,1,owner,group,0,mtime,mtime,mtime))=0A=
=0A=
def __init__(self):=0A=
self.methods=3DMethod.ZClassMethodsSheet('methods')=0A=
------=_NextPart_000_0003_01C06064.DF149CC0--