RE: [Zope] FTP for ZClass hierarchies

2000-12-07 Thread M. Adam Kendall

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.

I've included this patch in case anyone wants to play around
with it.  It's not the greatest, and definitely needs to be
modified (some of the security mechanisms are bound to be 
broken).  But it is a start anyway. ;)  

 Interestingly, but perhaps merely coincidental, I notice that the URLs
 of contained ZClasses as generated by the Zope management interface
 have a "%20" immediately following the name of each contained ZClass
 (but not the top-level ZClasss) - e.g, 
 ZClassFTP.patch


Re: [Zope] FTP for ZClass hierarchies

2000-12-07 Thread Robin Becker

In article [EMAIL PROTECTED], M. Adam Kendall
[EMAIL PROTECTED] writes
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.

I've included this patch in case anyone wants to play around
with it.  It's not the greatest, and definitely needs to be
modified (some of the security mechanisms are bound to be 
broken).  But it is a start anyway. ;)  

 Interestingly, but perhaps merely coincidental, I notice that the URLs
 of contained ZClasses as generated by the Zope management interface
 have a "%20" immediately following the name of each contained ZClass
 (but not the top-level ZClasss) - e.g, 
[ A MIME application / octet-stream part was included here. ]

Does this let you write the methods back?
-- 
Robin Becker

___
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )




Re: [Zope] FTP for ZClass hierarchies

2000-12-07 Thread Tres Seaver

Robin Becker [EMAIL PROTECTED] wrote:
 
 M. Adam Kendall [EMAIL PROTECTED] writes
 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.
 
 I've included this patch in case anyone wants to play around
 with it.  It's not the greatest, and definitely needs to be
 modified (some of the security mechanisms are bound to be 
 broken).  But it is a start anyway. ;)  

 Does this let you write the methods back?

I was just able to change a DTML method in a ZClass (after patching
a single indentation error).  Adam, you rock!

I am attaching my emended patch.

Tres.
-- 
===
Tres Seaver[EMAIL PROTECTED]
Digital Creations "Zope Dealers"   http://www.zope.org

Index: Method.py
===
RCS file: /cvs-repository/Zope2/lib/python/ZClasses/Method.py,v
retrieving revision 1.18
diff -u -r1.18 Method.py
--- Method.py   2000/08/14 14:34:23 1.18
+++ Method.py   2000/12/08 03:43:29
@@ -92,6 +92,8 @@
 import ZClassOwner
 from AccessControl.PermissionMapping import aqwrap, PermissionMapper
 
+import marshal
+
 _marker=[]
 class ZClassMethodsSheet(
 OFS.PropertySheets.PropertySheet,
@@ -104,6 +106,13 @@
 icon='p_/Methods_icon'
 
 def tpURL(self): return 'propertysheets/methods'
+
+def manage_FTPstat(self,REQUEST):
+"Psuedo stat used for FTP listings"
+mode=004|0770
+mtime=self.bobobase_modification_time().timeTime()
+owner=group='Zope'
+return marshal.dumps((mode,0,0,1,owner,group,0,mtime,mtime,mtime))
 
 ##
 # Hijinks to let us create factories and classes within classes.
Index: ZClass.py
===
RCS file: /cvs-repository/Zope2/lib/python/ZClasses/ZClass.py,v
retrieving revision 1.50
diff -u -r1.50 ZClass.py
--- ZClass.py   2000/11/01 22:59:34 1.50
+++ ZClass.py   2000/12/08 03:43:31
@@ -91,8 +91,9 @@
 from ExtensionClass import Base
 from App.FactoryDispatcher import FactoryDispatcher
 from ComputedAttribute import ComputedAttribute
-import OFS.PropertySheets
 
+import marshal
+
 if not hasattr(Products, 'meta_types'):
 Products.meta_types=()
 
@@ -281,6 +282,28 @@
  ('', '__call__', 'index_html', 'createInObjectManager')),
 )
 
+def manage_FTPlist(self,REQUEST):
+"Directory listing for FTP"
+out=()
+files=self.__dict__.items()
+if not (hasattr(self,'isTopLevelPrincipiaApplicationObject') and
+self.isTopLevelPrincipiaApplicationObject):
+ files.insert(0,('..',self.aq_parent))
+for k,v in files:
+try:stat=marshal.loads(v.manage_FTPstat(REQUEST))
+except:
+stat=None
+if stat is not None:
+out=out+((k,stat),)
+return marshal.dumps(out)
+
+def manage_FTPstat(self,REQUEST):
+"Psuedo stat used for FTP listings"
+mode=004|0770
+mtime=self.bobobase_modification_time().timeTime()
+owner=group='Zope'
+return marshal.dumps((mode,0,0,1,owner,group,0,mtime,mtime,mtime))
+
 def __init__(self, id, title, bases, zope_object=1):
 """Build a Zope class
 
@@ -640,6 +663,28 @@
 views   = Basic.ZClassViewsSheet('views')
 basic   = Basic.ZClassBasicSheet('basic')
 permissions = Basic.ZClassPermissionsSheet('permissions')
+
+def manage_FTPlist(self,REQUEST):
+"Directory listing for FTP"
+out=()
+files=self.__dict__.items()
+if not (hasattr(self,'isTopLevelPrincipiaApplicationObject') and
+self.isTopLevelPrincipiaApplicationObject):
+ files.insert(0,('..',self.aq_parent))
+for k,v in files:
+try:stat=marshal.loads(v.manage_FTPstat(REQUEST))
+except:
+stat=None
+if stat is not None:
+out=out+((k,stat),)
+return marshal.dumps(out)
+
+def manage_FTPstat(self,REQUEST):
+"Psuedo stat used for FTP listings"
+mode=004|0770
+mtime=self.bobobase_modification_time().timeTime()
+owner=group='Zope'
+return marshal.dumps((mode,0,0,1,owner,group,0,mtime,mtime,mtime))
 
 def __init__(self):
 self.methods=Method.ZClassMethodsSheet('methods')



RE: [Zope] FTP for ZClass hierarchies

2000-12-07 Thread M. Adam Kendall

  Does this let you write the methods back?
 
 I was just able to change a DTML method in a ZClass (after patching
 a single indentation error).  Adam, you rock!

Yeah, I know ;)
Only took me two days of playing around and figuring out
what objects got called where and realizing that I had to
override manage_FTPstat for most of the objects involved.

The latest and greatest patches can be found here:
 http://www.zope.org/Members/akendall/zclassftp

This has most of my updates since posting the original
patch earlier today including some of the security settings
I was missing earlier.  Hope everyone can test the hell out
of this and make sure I didn't really hose something.

Maybe this could be looked at by the DC folks and included
in the next test version release of Zope?  Just a thought ;)

Adam


___
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )




Re: [Zope] FTP for ZClass hierarchies

2000-12-06 Thread Stephane Bortzmeyer

On Tuesday 5 December 2000, at 9 h 4, the keyboard of Jim Welch 
[EMAIL PROTECTED] wrote:

 have been disappointed to discover that while I can access, via FTP,
 the methods of a top-level ZClass, I can't access any methods of
 ZClasses defined inside of a top-level ZClass. 

Many objects are not editable that way :-( And this is a big problem with Zope 
for me (I will certainly not use the browser form). A friendly Zopatista sent 
me a patch on Zope (which I will submit to the Collector) to be able to edit 
ZQSL methods. May be you can patch the patch for your purpose?




___
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )