[Zope-Checkins] SVN: Zope/trunk/ Register OFS as a package and give it an initialize function. Moved registration of OFS classes there from Products.OFSP.
Hanno Schlichting
hannosch at hannosch.eu
Sat Jul 10 13:29:34 EDT 2010
Log message for revision 114523:
Register OFS as a package and give it an initialize function. Moved registration of OFS classes there from Products.OFSP.
Changed:
U Zope/trunk/doc/CHANGES.rst
U Zope/trunk/src/App/dtml/manage_style_test.dtml
U Zope/trunk/src/HelpSys/APIHelpTopic.py
U Zope/trunk/src/OFS/Application.py
A Zope/trunk/src/OFS/File_icon.gif
A Zope/trunk/src/OFS/Folder_icon.gif
A Zope/trunk/src/OFS/Image_icon.gif
A Zope/trunk/src/OFS/UserFolder_icon.gif
U Zope/trunk/src/OFS/__init__.py
U Zope/trunk/src/OFS/configure.zcml
A Zope/trunk/src/OFS/dtmldoc.gif
A Zope/trunk/src/OFS/dtmlmethod.gif
U Zope/trunk/src/OFS/tests/testAppInitializer.py
U Zope/trunk/src/Products/Five/component/makesite.txt
U Zope/trunk/src/Products/MailHost/help/MailHost.py
U Zope/trunk/src/Products/OFSP/__init__.py
U Zope/trunk/src/Products/OFSP/help/DTMLDocument.py
U Zope/trunk/src/Products/OFSP/help/DTMLMethod.py
U Zope/trunk/src/Products/OFSP/help/File.py
U Zope/trunk/src/Products/OFSP/help/Folder.py
U Zope/trunk/src/Products/OFSP/help/Image.py
U Zope/trunk/src/Products/OFSP/help/ObjectManager.py
U Zope/trunk/src/Products/OFSP/help/OrderedFolder.py
U Zope/trunk/src/Testing/ZopeTestCase/ZopeLite.py
U Zope/trunk/src/Testing/ZopeTestCase/doc/TIMELINES.txt
-=-
Modified: Zope/trunk/doc/CHANGES.rst
===================================================================
--- Zope/trunk/doc/CHANGES.rst 2010-07-10 13:49:45 UTC (rev 114522)
+++ Zope/trunk/doc/CHANGES.rst 2010-07-10 17:29:33 UTC (rev 114523)
@@ -22,6 +22,9 @@
Restructuring
+++++++++++++
+- Register OFS as a package and give it an initialize function. Moved
+ registration of OFS classes there from Products.OFSP.
+
- No longer create an `Extensions` folder in the standard instance skeleton.
External methods will become entirely optional in Zope 2.14.
Modified: Zope/trunk/src/App/dtml/manage_style_test.dtml
===================================================================
--- Zope/trunk/src/App/dtml/manage_style_test.dtml 2010-07-10 13:49:45 UTC (rev 114522)
+++ Zope/trunk/src/App/dtml/manage_style_test.dtml 2010-07-10 17:29:33 UTC (rev 114523)
@@ -96,8 +96,8 @@
</p>
<table><tr>
-<td class="infobox" background="/misc_/OFSP/Folder_icon.gif">
-<div background="/misc_/OFSP/Folder_icon.gif">
+<td class="infobox">
+<div>
This is some text. This is some text. This is some text.
This is some text. This is some text. This is some text.
This is some text. This is some text. This is some text.
Modified: Zope/trunk/src/HelpSys/APIHelpTopic.py
===================================================================
--- Zope/trunk/src/HelpSys/APIHelpTopic.py 2010-07-10 13:49:45 UTC (rev 114522)
+++ Zope/trunk/src/HelpSys/APIHelpTopic.py 2010-07-10 17:29:33 UTC (rev 114523)
@@ -107,15 +107,7 @@
# inheritence information
self.extends=[]
-## for base in klass.getBases():
-## names = string.split(base.__name__, '.')
-## url="%s/Help/%s.py#%s" % (names[0], names[1], names[2])
-## self.extends.append((names[2], url))
- # constructor information
-## if hasattr(klass, '__constructor__'):
-## self.constructor=MethodDoc(klass.__constructor__)
-
# Get info on methods and attributes, ignore special items
self.attributes=[]
self.methods=[]
@@ -132,25 +124,10 @@
#
# The name of the API is deduced from the name
# of the class.
- #
- # The base APIs are deduced from the __extends__
- # attribute.
self.name=klass.__name__
self.doc=trim_doc_string(klass.__doc__)
- # inheritence information
- if hasattr(klass,'__extends__'):
- self.extends=[]
- for base in klass.__extends__:
- names=base.split( '.')
- url="%s/Help/%s.py#%s" % (names[0], names[1], names[2])
- self.extends.append((names[2], url))
-
- # constructor information
- if hasattr(klass, '__constructor__'):
- self.constructor=MethodDoc(klass.__constructor__)
-
# Get info on methods and attributes, ignore special items
self.attributes=[]
self.methods=[]
Modified: Zope/trunk/src/OFS/Application.py
===================================================================
--- Zope/trunk/src/OFS/Application.py 2010-07-10 13:49:45 UTC (rev 114522)
+++ Zope/trunk/src/OFS/Application.py 2010-07-10 17:29:33 UTC (rev 114523)
@@ -756,7 +756,7 @@
if hasattr(app, base):
continue
ob = DTMLFile(base, std_dir)
- app.manage_addProduct['OFSP'].manage_addDTMLMethod(
+ app.manage_addProduct['OFS'].manage_addDTMLMethod(
id=base, file=open(ob.raw))
elif ext in ('.pt', '.zpt'):
if hasattr(app, base):
@@ -767,7 +767,7 @@
elif ext in ('.ico', '.gif', '.png'):
if hasattr(app, fn):
continue
- app.manage_addProduct['OFSP'].manage_addImage(
+ app.manage_addProduct['OFS'].manage_addImage(
id=fn, title='', file=open(os.path.join(std_dir, fn)))
else:
continue
Copied: Zope/trunk/src/OFS/File_icon.gif (from rev 114522, Zope/trunk/src/Products/OFSP/images/File_icon.gif)
===================================================================
(Binary files differ)
Copied: Zope/trunk/src/OFS/Folder_icon.gif (from rev 114522, Zope/trunk/src/Products/OFSP/images/Folder_icon.gif)
===================================================================
(Binary files differ)
Copied: Zope/trunk/src/OFS/Image_icon.gif (from rev 114522, Zope/trunk/src/Products/OFSP/images/Image_icon.gif)
===================================================================
(Binary files differ)
Copied: Zope/trunk/src/OFS/UserFolder_icon.gif (from rev 114522, Zope/trunk/src/Products/OFSP/images/UserFolder_icon.gif)
===================================================================
(Binary files differ)
Modified: Zope/trunk/src/OFS/__init__.py
===================================================================
--- Zope/trunk/src/OFS/__init__.py 2010-07-10 13:49:45 UTC (rev 114522)
+++ Zope/trunk/src/OFS/__init__.py 2010-07-10 17:29:33 UTC (rev 114523)
@@ -10,3 +10,73 @@
# FOR A PARTICULAR PURPOSE
#
##############################################################################
+
+
+def initialize(context):
+ from AccessControl.Permissions import add_documents_images_and_files
+ from AccessControl.Permissions import add_folders
+
+ import OFS.Image, OFS.Folder, OFS.userfolder
+ import OFS.DTMLMethod, OFS.DTMLDocument, OFS.PropertySheets
+ import OFS.OrderedFolder
+
+ context.registerClass(
+ OFS.DTMLMethod.DTMLMethod,
+ permission=add_documents_images_and_files,
+ constructors=(OFS.DTMLMethod.addForm, OFS.DTMLMethod.addDTMLMethod,),
+ icon='dtmlmethod.gif',
+ legacy=(
+ ('manage_addDocument', OFS.DTMLMethod.addDTMLMethod),
+ ('manage_addDTMLMethod', OFS.DTMLMethod.addDTMLMethod),
+ ))
+
+ context.registerClass(
+ OFS.DTMLDocument.DTMLDocument,
+ permission=add_documents_images_and_files,
+ constructors=(OFS.DTMLDocument.addForm,
+ OFS.DTMLDocument.addDTMLDocument),
+ icon='dtmldoc.gif',
+ legacy=(('manage_addDTMLDocument', OFS.DTMLDocument.addDTMLDocument),
+ ))
+
+ context.registerClass(
+ OFS.Image.Image,
+ permission=add_documents_images_and_files,
+ constructors=(('imageAdd',OFS.Image.manage_addImageForm),
+ OFS.Image.manage_addImage),
+ icon='Image_icon.gif',
+ legacy=(OFS.Image.manage_addImage,),
+ )
+
+ context.registerClass(
+ OFS.Image.File,
+ permission=add_documents_images_and_files,
+ constructors=(('fileAdd',OFS.Image.manage_addFileForm),
+ OFS.Image.manage_addFile),
+ icon='File_icon.gif',
+ legacy=(OFS.Image.manage_addFile,),
+ )
+
+ context.registerClass(
+ OFS.Folder.Folder,
+ constructors=(OFS.Folder.manage_addFolderForm,
+ OFS.Folder.manage_addFolder),
+ icon='Folder_icon.gif',
+ legacy=(OFS.Folder.manage_addFolder,),
+ )
+
+ context.registerClass(
+ OFS.OrderedFolder.OrderedFolder,
+ permission=add_folders,
+ constructors=(OFS.OrderedFolder.manage_addOrderedFolderForm,
+ OFS.OrderedFolder.manage_addOrderedFolder),
+ icon='Folder_icon.gif',
+ legacy=(OFS.OrderedFolder.manage_addOrderedFolder,),
+ )
+
+ context.registerClass(
+ OFS.userfolder.UserFolder,
+ constructors=(OFS.userfolder.manage_addUserFolder,),
+ icon='UserFolder_icon.gif',
+ legacy=(OFS.userfolder.manage_addUserFolder,),
+ )
Modified: Zope/trunk/src/OFS/configure.zcml
===================================================================
--- Zope/trunk/src/OFS/configure.zcml 2010-07-10 13:49:45 UTC (rev 114522)
+++ Zope/trunk/src/OFS/configure.zcml 2010-07-10 17:29:33 UTC (rev 114523)
@@ -1,6 +1,12 @@
-<configure xmlns="http://namespaces.zope.org/zope">
+<configure
+ xmlns="http://namespaces.zope.org/zope"
+ xmlns:five="http://namespaces.zope.org/five">
<include file="deprecated.zcml"/>
<include file="event.zcml"/>
+ <five:registerPackage
+ package="OFS"
+ initialize="OFS.initialize" />
+
</configure>
Copied: Zope/trunk/src/OFS/dtmldoc.gif (from rev 114522, Zope/trunk/src/Products/OFSP/images/dtmldoc.gif)
===================================================================
(Binary files differ)
Copied: Zope/trunk/src/OFS/dtmlmethod.gif (from rev 114522, Zope/trunk/src/Products/OFSP/images/dtmlmethod.gif)
===================================================================
(Binary files differ)
Modified: Zope/trunk/src/OFS/tests/testAppInitializer.py
===================================================================
--- Zope/trunk/src/OFS/tests/testAppInitializer.py 2010-07-10 13:49:45 UTC (rev 114522)
+++ Zope/trunk/src/OFS/tests/testAppInitializer.py 2010-07-10 17:29:33 UTC (rev 114523)
@@ -202,7 +202,7 @@
self.configure(good_cfg)
i = self.getOne()
i.install_products()
- self.failUnless(Application.misc_.__dict__.has_key('OFSP'))
+ self.failUnless(Application.misc_.__dict__.has_key('OFS'))
def test_install_standards(self):
self.configure(good_cfg)
Modified: Zope/trunk/src/Products/Five/component/makesite.txt
===================================================================
--- Zope/trunk/src/Products/Five/component/makesite.txt 2010-07-10 13:49:45 UTC (rev 114522)
+++ Zope/trunk/src/Products/Five/component/makesite.txt 2010-07-10 17:29:33 UTC (rev 114523)
@@ -36,7 +36,7 @@
Let's add a folder:
- >>> browser.open('http://localhost/manage_addProduct/OFSP/folderAdd')
+ >>> browser.open('http://localhost/manage_addProduct/OFS/folderAdd')
>>> browser.getControl(name='id').value = 'folder'
>>> browser.getControl('Add').click()
>>> browser.getLink('folder').click()
Modified: Zope/trunk/src/Products/MailHost/help/MailHost.py
===================================================================
--- Zope/trunk/src/Products/MailHost/help/MailHost.py 2010-07-10 13:49:45 UTC (rev 114522)
+++ Zope/trunk/src/Products/MailHost/help/MailHost.py 2010-07-10 17:29:33 UTC (rev 114523)
@@ -23,15 +23,11 @@
class MailHost:
"""
-
MailHost objects work as adapters to Simple Mail Transfer Protocol
(SMTP) servers. MailHosts are used by DTML 'sendmail' tags
to find the proper host to deliver mail to.
-
"""
- __constructor__=manage_addMailHost
-
def send(messageText, mto=None, mfrom=None, subject=None,
encode=None):
"""
Modified: Zope/trunk/src/Products/OFSP/__init__.py
===================================================================
--- Zope/trunk/src/Products/OFSP/__init__.py 2010-07-10 13:49:45 UTC (rev 114522)
+++ Zope/trunk/src/Products/OFSP/__init__.py 2010-07-10 17:29:33 UTC (rev 114523)
@@ -10,80 +10,7 @@
# FOR A PARTICULAR PURPOSE
#
##############################################################################
-__doc__='''Object system core
-$Id$'''
-__version__='$Revision: 1.38 $'[11:-2]
-import OFS.Image, OFS.Folder, OFS.userfolder
-import OFS.DTMLMethod, OFS.DTMLDocument, OFS.PropertySheets
-import OFS.OrderedFolder
-
-from AccessControl.Permissions import add_documents_images_and_files
-from AccessControl.Permissions import add_folders
-
def initialize(context):
-
- context.registerClass(
- OFS.DTMLMethod.DTMLMethod,
- permission=add_documents_images_and_files,
- constructors=(OFS.DTMLMethod.addForm, OFS.DTMLMethod.addDTMLMethod,),
- icon='images/dtmlmethod.gif',
- legacy=(
- ('manage_addDocument', OFS.DTMLMethod.addDTMLMethod),
- ('manage_addDTMLMethod', OFS.DTMLMethod.addDTMLMethod),
- )
- )
-
- context.registerClass(
- OFS.DTMLDocument.DTMLDocument,
- permission=add_documents_images_and_files,
- constructors=(OFS.DTMLDocument.addForm,
- OFS.DTMLDocument.addDTMLDocument),
- icon='images/dtmldoc.gif',
- legacy=(('manage_addDTMLDocument', OFS.DTMLDocument.addDTMLDocument),),
- )
-
- context.registerClass(
- OFS.Image.Image,
- permission=add_documents_images_and_files,
- constructors=(('imageAdd',OFS.Image.manage_addImageForm),
- OFS.Image.manage_addImage),
- icon='images/Image_icon.gif',
- legacy=(OFS.Image.manage_addImage,),
- )
-
- context.registerClass(
- OFS.Image.File,
- permission=add_documents_images_and_files,
- constructors=(('fileAdd',OFS.Image.manage_addFileForm),
- OFS.Image.manage_addFile),
- icon='images/File_icon.gif',
- legacy=(OFS.Image.manage_addFile,),
- )
-
- context.registerClass(
- OFS.Folder.Folder,
- constructors=(OFS.Folder.manage_addFolderForm,
- OFS.Folder.manage_addFolder),
- icon='images/Folder_icon.gif',
- legacy=(OFS.Folder.manage_addFolder,),
- )
-
- context.registerClass(
- OFS.OrderedFolder.OrderedFolder,
- permission=add_folders,
- constructors=(OFS.OrderedFolder.manage_addOrderedFolderForm,
- OFS.OrderedFolder.manage_addOrderedFolder),
- icon='images/Folder_icon.gif',
- legacy=(OFS.OrderedFolder.manage_addOrderedFolder,),
- )
-
- context.registerClass(
- OFS.userfolder.UserFolder,
- constructors=(OFS.userfolder.manage_addUserFolder,),
- icon='images/UserFolder_icon.gif',
- legacy=(OFS.userfolder.manage_addUserFolder,),
- )
-
context.registerHelp()
context.registerHelpTitle('Zope Help')
Modified: Zope/trunk/src/Products/OFSP/help/DTMLDocument.py
===================================================================
--- Zope/trunk/src/Products/OFSP/help/DTMLDocument.py 2010-07-10 13:49:45 UTC (rev 114522)
+++ Zope/trunk/src/Products/OFSP/help/DTMLDocument.py 2010-07-10 17:29:33 UTC (rev 114523)
@@ -24,11 +24,6 @@
code. It is useful to represent web pages.
"""
- __extends__=(
- 'OFSP.ObjectManagerItem.ObjectManagerItem',
- 'OFSP.PropertyManager.PropertyManager',
- )
-
def __call__(client=None, REQUEST={}, RESPONSE=None, **kw):
"""
@@ -131,5 +126,3 @@
Permission -- 'View'
"""
-
- __constructor__=manage_addDocument
Modified: Zope/trunk/src/Products/OFSP/help/DTMLMethod.py
===================================================================
--- Zope/trunk/src/Products/OFSP/help/DTMLMethod.py 2010-07-10 13:49:45 UTC (rev 114522)
+++ Zope/trunk/src/Products/OFSP/help/DTMLMethod.py 2010-07-10 17:29:33 UTC (rev 114523)
@@ -26,11 +26,8 @@
The DTML Method's id is available via the 'document_id'
variable and the title is available via the 'document_title'
variable.
-
"""
- __extends__=('OFSP.ObjectManagerItem.ObjectManagerItem',)
-
def __call__(client=None, REQUEST={}, **kw):
"""
@@ -129,5 +126,3 @@
Permission -- 'View'
"""
-
- __constructor__ = manage_addDTMLMethod
Modified: Zope/trunk/src/Products/OFSP/help/File.py
===================================================================
--- Zope/trunk/src/Products/OFSP/help/File.py 2010-07-10 13:49:45 UTC (rev 114522)
+++ Zope/trunk/src/Products/OFSP/help/File.py 2010-07-10 17:29:33 UTC (rev 114523)
@@ -55,13 +55,6 @@
method.
"""
- __constructor__=manage_addFile
-
- __extends__=(
- 'OFSP.ObjectManagerItem.ObjectManagerItem',
- 'OFSP.PropertyManager.PropertyManager',
- )
-
def update_data(data, content_type=None, size=None):
"""
Updates the contents of the File with 'data'.
Modified: Zope/trunk/src/Products/OFSP/help/Folder.py
===================================================================
--- Zope/trunk/src/Products/OFSP/help/Folder.py 2010-07-10 13:49:45 UTC (rev 114522)
+++ Zope/trunk/src/Products/OFSP/help/Folder.py 2010-07-10 17:29:33 UTC (rev 114523)
@@ -22,17 +22,7 @@
class Folder:
"""
-
A Folder is a generic container object in Zope.
Folders are the most common ObjectManager subclass in Zope.
-
"""
-
- __extends__=(
- 'OFSP.ObjectManagerItem.ObjectManagerItem',
- 'OFSP.ObjectManager.ObjectManager',
- 'OFSP.PropertyManager.PropertyManager',
- )
-
- __constructor__ = manage_addFolder
Modified: Zope/trunk/src/Products/OFSP/help/Image.py
===================================================================
--- Zope/trunk/src/Products/OFSP/help/Image.py 2010-07-10 13:49:45 UTC (rev 114522)
+++ Zope/trunk/src/Products/OFSP/help/Image.py 2010-07-10 17:29:33 UTC (rev 114523)
@@ -54,13 +54,8 @@
method. For example::
<dtml-var "ImageObject.tag(border='5', align='left')">
-
"""
- __constructor__=manage_addImage
-
- __extends__=('OFSP.File.File',)
-
def tag(height=None, width=None, alt=None,
scale=0, xscale=0, yscale=0, **args):
"""
Modified: Zope/trunk/src/Products/OFSP/help/ObjectManager.py
===================================================================
--- Zope/trunk/src/Products/OFSP/help/ObjectManager.py 2010-07-10 13:49:45 UTC (rev 114522)
+++ Zope/trunk/src/Products/OFSP/help/ObjectManager.py 2010-07-10 17:29:33 UTC (rev 114523)
@@ -18,11 +18,11 @@
To create an object inside an object manager use 'manage_addProduct'::
- self.manage_addProduct['OFSP'].manage_addFolder(id, title)
+ self.manage_addProduct['OFS'].manage_addFolder(id, title)
In DTML this would be::
- <dtml-call "manage_addProduct['OFSP'].manage_addFolder(id, title)">
+ <dtml-call "manage_addProduct['OFS'].manage_addFolder(id, title)">
These examples create a new Folder inside the current
ObjectManager.
Modified: Zope/trunk/src/Products/OFSP/help/OrderedFolder.py
===================================================================
--- Zope/trunk/src/Products/OFSP/help/OrderedFolder.py 2010-07-10 13:49:45 UTC (rev 114522)
+++ Zope/trunk/src/Products/OFSP/help/OrderedFolder.py 2010-07-10 17:29:33 UTC (rev 114523)
@@ -25,7 +25,3 @@
class OrderedFolder:
""" Extends the default Folder by order support.
"""
-
- __extends__ = ('OFSP.OrderSupport.OrderSupport', 'OFSP.Folder.Folder')
-
- __constructor__ = manage_addOrderedFolder
Modified: Zope/trunk/src/Testing/ZopeTestCase/ZopeLite.py
===================================================================
--- Zope/trunk/src/Testing/ZopeTestCase/ZopeLite.py 2010-07-10 13:49:45 UTC (rev 114522)
+++ Zope/trunk/src/Testing/ZopeTestCase/ZopeLite.py 2010-07-10 17:29:33 UTC (rev 114523)
@@ -218,7 +218,7 @@
if not quiet: _print('Installing %s ... NOT FOUND\n' % name)
installProduct('PluginIndexes', 1) # Must install first
-installProduct('OFSP', 1)
+installPackage('OFS', 1)
# So people can use ZopeLite.app()
app = Zope2.app
Modified: Zope/trunk/src/Testing/ZopeTestCase/doc/TIMELINES.txt
===================================================================
--- Zope/trunk/src/Testing/ZopeTestCase/doc/TIMELINES.txt 2010-07-10 13:49:45 UTC (rev 114522)
+++ Zope/trunk/src/Testing/ZopeTestCase/doc/TIMELINES.txt 2010-07-10 17:29:33 UTC (rev 114523)
@@ -27,7 +27,7 @@
2.1.5 imports module Zope
2.1.6 starts Zope
2.1.7 installs product PluginIndexes
- 2.1.8 installs product OFSP
+ 2.1.8 installs package OFS
2.2 imports module Testing.ZopeTestCase.ZopeTestCase
More information about the Zope-Checkins
mailing list