Commit 4d4491be authored by Hanno Schlichting's avatar Hanno Schlichting

Register OFS as a package and give it an initialize function. Moved...

Register OFS as a package and give it an initialize function. Moved registration of OFS classes there from Products.OFSP.
parent 51feabad
......@@ -22,6 +22,9 @@ Bugs Fixed
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.
......
......@@ -96,8 +96,8 @@ This is large-tx.
</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.
......
......@@ -107,14 +107,6 @@ class APIDoc(Persistent):
# 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=[]
......@@ -132,25 +124,10 @@ class APIDoc(Persistent):
#
# 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=[]
......
......@@ -756,7 +756,7 @@ def install_standards(app):
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 @@ def install_standards(app):
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
......
......@@ -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,),
)
<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>
......@@ -202,7 +202,7 @@ class TestInitialization( unittest.TestCase ):
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)
......
......@@ -36,7 +36,7 @@ Create the test browser we'll be using:
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()
......
......@@ -23,15 +23,11 @@ def manage_addMailHost(id, title='', smtp_host=None,
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):
"""
......
......@@ -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')
......@@ -24,11 +24,6 @@ class DTMLDocument:
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 @@ class DTMLDocument:
Permission -- 'View'
"""
__constructor__=manage_addDocument
......@@ -26,11 +26,8 @@ class DTMLMethod:
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 @@ class DTMLMethod:
Permission -- 'View'
"""
__constructor__ = manage_addDTMLMethod
......@@ -55,13 +55,6 @@ class File:
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'.
......
......@@ -22,17 +22,7 @@ def manage_addFolder(id, title):
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
......@@ -54,13 +54,8 @@ class Image:
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):
"""
......
......@@ -18,11 +18,11 @@ class ObjectManager:
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.
......
......@@ -25,7 +25,3 @@ def manage_addOrderedFolder(id, title='', createPublic=0, createUserF=0,
class OrderedFolder:
""" Extends the default Folder by order support.
"""
__extends__ = ('OFSP.OrderSupport.OrderSupport', 'OFSP.Folder.Folder')
__constructor__ = manage_addOrderedFolder
......@@ -218,7 +218,7 @@ def _installPackage(name, quiet=0):
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
......
......@@ -27,7 +27,7 @@ When the skeleton test is run by typing 'python testSkeleton.py', it
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
......
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