Commit 14bc8871 authored by Tres Seaver's avatar Tres Seaver

* Merge fix for Collector #998 (Adds FTP/WebDAV editing to ZClasses)

parent f9f0ddd0
......@@ -11,6 +11,14 @@ Zope changes
and standard_error_message in Data.fs.in to use "new" DTML syntax
(as opposed to SSI-style syntax).
Zope 2.3.0 beta 3
Features Added
- Make ZClasses navigable to FTP/WebDAV; implement 'PUT_factory'
hook to create PythonScripts (for MIMEtype 'text/x-python')
and DTMLMethods (for other 'text' MIMEtypes) (Collector #998).
Zope 2.3.0 beta 1
Features Added
......@@ -31,13 +39,13 @@ Zope changes
- The logout function has been implemented in a fairly minimal
way. We may try to make this nicer by final if we get time.
- The ZCatalog interface is now cleaned up and matches the new
interface look and feel better. In addition some logical
reorganization was made to move things onto an Advanced tab.
- The ZCatalog interface is now cleaned up and matches the new
interface look and feel better. In addition some logical
reorganization was made to move things onto an Advanced tab.
- Result sets from the Catalog are now much Lazier, and will
do concatenation with eachother in a lazy fashion. This was
suggested by Casey Duncan in Collector #1712.
- Result sets from the Catalog are now much Lazier, and will
do concatenation with eachother in a lazy fashion. This was
suggested by Casey Duncan in Collector #1712.
Bugs Fixed
......@@ -66,9 +74,9 @@ Zope changes
Objects view would be incorrect and list everything as a
'ZCatalog'. Now it simply lists it as 'Unknown'.
- (Collector #1844) On the brains returned from ZCatalog
queries, 'getObject()' now tries to resolve URLs as well as
paths. This should catch more cases.
- (Collector #1844) On the brains returned from ZCatalog
queries, 'getObject()' now tries to resolve URLs as well as
paths. This should catch more cases.
- Tags generated for ImageFile objects attempted to use
title_or_id(), which is not defined for those objects.
......
......@@ -92,6 +92,12 @@ import App.Dialogs, ZClasses, App.Factory, App.Product, App.ProductRegistry
import ZClassOwner
from AccessControl.PermissionMapping import aqwrap, PermissionMapper
import OFS.content_types
from OFS.DTMLMethod import DTMLMethod
from Products.PythonScripts.PythonScript import PythonScript
import marshal
_marker=[]
class ZClassMethodsSheet(
OFS.PropertySheets.PropertySheet,
......@@ -240,6 +246,30 @@ class ZClassMethodsSheet(
def possible_permissions(self):
return self.classDefinedAndInheritedPermissions()
#
# FTP support
#
def manage_FTPstat(self,REQUEST):
"Psuedo stat used for FTP listings"
mode=0040000|0770
mtime=self.bobobase_modification_time().timeTime()
owner=group='Zope'
return marshal.dumps((mode,0,0,1,owner,group,0,mtime,mtime,mtime))
def PUT_factory( self, name, typ, body ):
"""
Hook PUT creation to make objects of the right type when
new item uploaded via FTP/WebDAV.
"""
if typ is None:
typ, enc = OFS.content_types.guess_content_type()
if typ == 'text/x-python':
return PythonScript( name )
if typ[ :4 ] == 'text':
return DTMLMethod( '', __name__=name )
return None # take the default, then
default_dm_html='''<html>
<head><title><dtml-var document_title></title></head>
<body bgcolor="#FFFFFF" LINK="#000099" VLINK="#555555">
......
......@@ -91,7 +91,9 @@ from ZPublisher.mapply import mapply
from ExtensionClass import Base
from App.FactoryDispatcher import FactoryDispatcher
from ComputedAttribute import ComputedAttribute
import OFS.PropertySheets
import webdav.Collection
import marshal
if not hasattr(Products, 'meta_types'):
Products.meta_types=()
......@@ -158,7 +160,7 @@ from OFS.misc_ import p_
p_.ZClass_Icon=Globals.ImageFile('class.gif', globals())
class PersistentClass(Base):
class PersistentClass(Base, webdav.Collection.Collection ):
def __class_init__(self): pass
manage_addZClassForm=Globals.DTMLFile(
......@@ -267,7 +269,10 @@ def PersistentClassDict(doc=None, meta_type=None):
return dict
_marker=[]
class ZClass(OFS.SimpleItem.SimpleItem):
class ZClass( Base
, webdav.Collection.Collection
, OFS.SimpleItem.SimpleItem
):
"""Zope Class
"""
meta_type="Z Class"
......@@ -319,10 +324,11 @@ class ZClass(OFS.SimpleItem.SimpleItem):
isheets_base_classes.append(Property.ZInstanceSheets)
# Create the meta-class property sheet
sheet_id = id+'_ZPropertySheetsClass'
zsheets_class=type(PersistentClass)(
id+'_ZPropertySheetsClass',
sheet_id,
tuple(zsheets_base_classes)+(Globals.Persistent,),
PersistentClassDict(id+'_ZPropertySheetsClass'))
PersistentClassDict(sheet_id, sheet_id))
self.propertysheets=sheets=zsheets_class()
# Create the class
......@@ -627,6 +633,47 @@ class ZClass(OFS.SimpleItem.SimpleItem):
return r
def _getZClass(self): return self
#
# FTP support
#
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=0040000|0770
mtime=self.bobobase_modification_time().timeTime()
owner=group='Zope'
return marshal.dumps((mode,0,0,1,owner,group,0,mtime,mtime,mtime))
#
# WebDAV support
#
isAnObjectManager=1
def objectValues( self, filter=None ):
"""
"""
values = [ self.propertysheets ]
if filter is not None:
if type( filter ) == type( '' ):
filter = [ filter ]
for value in values:
if not self.propertysheets.meta_type in filter:
values.remove( value )
return values
class ZClassSheets(OFS.PropertySheets.PropertySheets):
"Manage a collection of property sheets that provide ZClass management"
......@@ -646,6 +693,39 @@ class ZClassSheets(OFS.PropertySheets.PropertySheets):
self.methods=Method.ZClassMethodsSheet('methods')
self.common=Property.ZInstanceSheetsSheet('common')
#
# FTP support
#
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=0040000|0770
mtime=self.bobobase_modification_time().timeTime()
owner=group='Zope'
return marshal.dumps((mode,0,0,1,owner,group,0,mtime,mtime,mtime))
#
# WebDAV support
#
isAnObjectManager=1
def objectValues( self, filter=None ):
return [ self.methods, self.common ]
class ZObject:
......
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