[CMF-checkins] SVN: CMF/branches/yuppie-setup_cleanup/CMF - removed
PortalGenerator, manage_addCMFSite and factory_type_information data
Yvo Schubbe
y.2005- at wcm-solutions.de
Thu Oct 20 08:33:09 EDT 2005
Log message for revision 39526:
- removed PortalGenerator, manage_addCMFSite and factory_type_information data
- utils.ContentInit now ignores the 'fti' argument
- removed obsolete TypesTool.listDefaultTypeInformation method
- TypesTool.manage_addTypeInformation now ignores the 'typeinfo_name' argument
- updated DEPENDENCIES.txt (CMFDefault no longer depends on CMFTopic!)
Changed:
U CMF/branches/yuppie-setup_cleanup/CMFActionIcons/DEPENDENCIES.txt
U CMF/branches/yuppie-setup_cleanup/CMFCalendar/Event.py
U CMF/branches/yuppie-setup_cleanup/CMFCalendar/__init__.py
U CMF/branches/yuppie-setup_cleanup/CMFCore/CMFBTreeFolder.py
U CMF/branches/yuppie-setup_cleanup/CMFCore/PortalFolder.py
U CMF/branches/yuppie-setup_cleanup/CMFCore/TypesTool.py
U CMF/branches/yuppie-setup_cleanup/CMFCore/__init__.py
U CMF/branches/yuppie-setup_cleanup/CMFCore/tests/test_TypesTool.py
U CMF/branches/yuppie-setup_cleanup/CMFCore/utils.py
U CMF/branches/yuppie-setup_cleanup/CMFDefault/DEPENDENCIES.txt
U CMF/branches/yuppie-setup_cleanup/CMFDefault/DiscussionItem.py
U CMF/branches/yuppie-setup_cleanup/CMFDefault/Document.py
U CMF/branches/yuppie-setup_cleanup/CMFDefault/Favorite.py
U CMF/branches/yuppie-setup_cleanup/CMFDefault/File.py
U CMF/branches/yuppie-setup_cleanup/CMFDefault/Image.py
U CMF/branches/yuppie-setup_cleanup/CMFDefault/Link.py
U CMF/branches/yuppie-setup_cleanup/CMFDefault/NewsItem.py
U CMF/branches/yuppie-setup_cleanup/CMFDefault/Portal.py
U CMF/branches/yuppie-setup_cleanup/CMFDefault/SkinnedFolder.py
U CMF/branches/yuppie-setup_cleanup/CMFDefault/__init__.py
U CMF/branches/yuppie-setup_cleanup/CMFDefault/setuphandlers.py
U CMF/branches/yuppie-setup_cleanup/CMFTopic/Topic.py
U CMF/branches/yuppie-setup_cleanup/CMFTopic/__init__.py
U CMF/branches/yuppie-setup_cleanup/CMFTopic/tests/test_Topic.py
-=-
Modified: CMF/branches/yuppie-setup_cleanup/CMFActionIcons/DEPENDENCIES.txt
===================================================================
--- CMF/branches/yuppie-setup_cleanup/CMFActionIcons/DEPENDENCIES.txt 2005-10-20 12:28:29 UTC (rev 39525)
+++ CMF/branches/yuppie-setup_cleanup/CMFActionIcons/DEPENDENCIES.txt 2005-10-20 12:33:09 UTC (rev 39526)
@@ -1,3 +1,4 @@
Zope >= 2.8.2
Five >= 1.2
CMFCore
+GenericSetup
Modified: CMF/branches/yuppie-setup_cleanup/CMFCalendar/Event.py
===================================================================
--- CMF/branches/yuppie-setup_cleanup/CMFCalendar/Event.py 2005-10-20 12:28:29 UTC (rev 39525)
+++ CMF/branches/yuppie-setup_cleanup/CMFCalendar/Event.py 2005-10-20 12:33:09 UTC (rev 39526)
@@ -36,28 +36,6 @@
from permissions import ModifyPortalContent
from permissions import View
-# Factory type information -- makes Events objects play nicely
-# with the Types Tool (portal_types)
-factory_type_information = (
- {'id': 'Event',
- 'icon': 'event_icon.gif',
- 'meta_type': 'CMF Event',
- 'description': ('Events are objects for use in Calendar topical '
- 'queries on the catalog.'),
- 'product': 'CMFCalendar',
- 'factory': 'addEvent',
- 'immediate_view': 'event_edit_form',
- 'actions': ({'id': 'view',
- 'name': 'View',
- 'action': 'string:${object_url}/event_view',
- 'permissions': (View,)},
- {'id': 'edit',
- 'name': 'Edit',
- 'action': 'string:${object_url}/event_edit_form',
- 'permissions': (ChangeEvents,)},
- ), # End Actions
- },
- )
def addEvent(self
, id
@@ -73,9 +51,8 @@
, contact_phone=''
, event_url=''
, REQUEST=None):
+ """Create an empty event.
"""
- Create an empty event.
- """
event = Event(id
, title
, description
@@ -106,10 +83,12 @@
return strings
+
class Event(PortalContent, DefaultDublinCoreImpl):
+
+ """Events are objects for the Calendar topical query.
"""
- Events are objects for the Calendar topical query.
- """
+
meta_type='CMF Event'
# Declarative security
@@ -428,5 +407,4 @@
""" Used for FTP and apparently the ZMI now too """
return len(self.manage_FTPget())
-# Intialize the Event class, setting up security.
InitializeClass(Event)
Modified: CMF/branches/yuppie-setup_cleanup/CMFCalendar/__init__.py
===================================================================
--- CMF/branches/yuppie-setup_cleanup/CMFCalendar/__init__.py 2005-10-20 12:28:29 UTC (rev 39525)
+++ CMF/branches/yuppie-setup_cleanup/CMFCalendar/__init__.py 2005-10-20 12:33:09 UTC (rev 39526)
@@ -55,7 +55,6 @@
, content_types = contentClasses
, permission = AddPortalContent
, extra_constructors = contentConstructors
- , fti = Event.factory_type_information
).initialize( context )
profile_registry.registerProfile('default',
Modified: CMF/branches/yuppie-setup_cleanup/CMFCore/CMFBTreeFolder.py
===================================================================
--- CMF/branches/yuppie-setup_cleanup/CMFCore/CMFBTreeFolder.py 2005-10-20 12:28:29 UTC (rev 39525)
+++ CMF/branches/yuppie-setup_cleanup/CMFCore/CMFBTreeFolder.py 2005-10-20 12:33:09 UTC (rev 39526)
@@ -21,24 +21,8 @@
from Products.BTreeFolder2.BTreeFolder2 import BTreeFolder2Base
from PortalFolder import PortalFolderBase
-from PortalFolder import factory_type_information as PortalFolder_FTI
-_actions = PortalFolder_FTI[0]['actions']
-factory_type_information = ( { 'id' : 'CMF BTree Folder',
- 'meta_type' : 'CMF BTree Folder',
- 'description' : """\
-CMF folder designed to hold a lot of objects.""",
- 'icon' : 'folder_icon.gif',
- 'product' : 'CMFCore',
- 'factory' : 'manage_addCMFBTreeFolder',
- 'filter_content_types' : 0,
- 'immediate_view' : 'folder_edit_form',
- 'actions' : _actions,
- },
- )
-
-
def manage_addCMFBTreeFolder(dispatcher, id, title='', REQUEST=None):
"""Adds a new BTreeFolder object with id *id*.
"""
@@ -52,8 +36,10 @@
class CMFBTreeFolder(BTreeFolder2Base, PortalFolderBase):
+
"""BTree folder for CMF sites.
"""
+
meta_type = 'CMF BTree Folder'
security = ClassSecurityInfo()
@@ -65,5 +51,4 @@
PortalFolderBase._checkId(self, id, allow_dup)
BTreeFolder2Base._checkId(self, id, allow_dup)
-
InitializeClass(CMFBTreeFolder)
Modified: CMF/branches/yuppie-setup_cleanup/CMFCore/PortalFolder.py
===================================================================
--- CMF/branches/yuppie-setup_cleanup/CMFCore/PortalFolder.py 2005-10-20 12:28:29 UTC (rev 39525)
+++ CMF/branches/yuppie-setup_cleanup/CMFCore/PortalFolder.py 2005-10-20 12:33:09 UTC (rev 39526)
@@ -37,7 +37,6 @@
from interfaces.Folderish import Folderish as z2IFolderish
from permissions import AddPortalContent
from permissions import AddPortalFolders
-from permissions import ChangeLocalRoles
from permissions import DeleteObjects
from permissions import ListFolderContents
from permissions import ManagePortal
@@ -47,61 +46,11 @@
from utils import getToolByName
-factory_type_information = (
- { 'id' : 'Folder'
- , 'meta_type' : 'Portal Folder'
- , 'description' : """ Use folders to put content in categories."""
- , 'icon' : 'folder_icon.gif'
- , 'product' : 'CMFCore'
- , 'factory' : 'manage_addPortalFolder'
- , 'filter_content_types' : 0
- , 'immediate_view' : 'folder_edit_form'
- , 'aliases' : {'(Default)': 'index_html',
- 'view': 'index_html',
- 'index.html':'index_html'}
- , 'actions' : ( { 'id' : 'view'
- , 'name' : 'View'
- , 'action': 'string:${object_url}'
- , 'permissions' : (View,)
- }
- , { 'id' : 'edit'
- , 'name' : 'Edit'
- , 'action': 'string:${object_url}/folder_edit_form'
- , 'permissions' : (ManageProperties,)
- }
- , { 'id' : 'localroles'
- , 'name' : 'Local Roles'
- , 'action':
- 'string:${object_url}/folder_localrole_form'
- , 'permissions' : (ChangeLocalRoles,)
- }
- , { 'id' : 'folderContents'
- , 'name' : 'Folder contents'
- , 'action': 'string:${object_url}/folder_contents'
- , 'permissions' : (ListFolderContents,)
- }
- , { 'id' : 'new'
- , 'name' : 'New...'
- , 'action': 'string:${object_url}/folder_factories'
- , 'permissions' : (AddPortalContent,)
- , 'visible' : 0
- }
- , { 'id' : 'rename_items'
- , 'name' : 'Rename items'
- , 'action': 'string:${object_url}/folder_rename_form'
- , 'permissions' : (AddPortalContent,)
- , 'visible' : 0
- }
- )
- }
-,
-)
-
-
class PortalFolderBase(DynamicType, CMFCatalogAware, Folder):
"""Base class for portal folder
"""
+
meta_type = 'Portal Folder Base'
implements(IFolderish)
Modified: CMF/branches/yuppie-setup_cleanup/CMFCore/TypesTool.py
===================================================================
--- CMF/branches/yuppie-setup_cleanup/CMFCore/TypesTool.py 2005-10-20 12:28:29 UTC (rev 39525)
+++ CMF/branches/yuppie-setup_cleanup/CMFCore/TypesTool.py 2005-10-20 12:33:09 UTC (rev 39526)
@@ -754,76 +754,12 @@
#
# other methods
#
- security.declareProtected(ManagePortal, 'listDefaultTypeInformation')
- def listDefaultTypeInformation(self):
- # Scans for factory_type_information attributes
- # of all products and factory dispatchers within products.
- res = []
- products = self.aq_acquire('_getProducts')()
- for product in products.objectValues():
- product_id = product.getId()
-
- if hasattr(aq_base(product), 'factory_type_information'):
- ftis = product.factory_type_information
- else:
- package = getattr(Products, product_id, None)
- dispatcher = getattr(package, '__FactoryDispatcher__', None)
- ftis = getattr(dispatcher, 'factory_type_information', None)
-
- if ftis is not None:
- if callable(ftis):
- ftis = ftis()
-
- for fti in ftis:
- mt = fti.get('meta_type', None)
- id = fti.get('id', '')
-
- if mt:
- p_id = '%s: %s (%s)' % (product_id, id, mt)
- res.append( (p_id, fti) )
-
- return res
-
security.declareProtected(ManagePortal, 'manage_addTypeInformation')
def manage_addTypeInformation(self, add_meta_type, id=None,
typeinfo_name=None, RESPONSE=None):
+ """Create a TypeInformation in self.
"""
- Create a TypeInformation in self.
- """
- fti = None
- if typeinfo_name:
- info = self.listDefaultTypeInformation()
-
- # Nasty orkaround to stay backwards-compatible
- # This workaround will disappear in CMF 1.7
- if typeinfo_name.endswith(')'):
- # This is a new-style name. Proceed normally.
- for (name, ft) in info:
- if name == typeinfo_name:
- fti = ft
- break
- else:
- # Attempt to work around the old way
- # This attempt harbors the problem that the first match on
- # meta_type will be used. There could potentially be more
- # than one TypeInformation sharing the same meta_type.
- warn('Please switch to the new format for typeinfo names '
- '\"product_id: type_id (meta_type)\", the old '
- 'spelling will disappear in CMF 1.7', DeprecationWarning,
- stacklevel=2)
-
- ti_prod, ti_mt = [x.strip() for x in typeinfo_name.split(':')]
-
- for name, ft in info:
- if ( name.startswith(ti_prod) and
- name.endswith('(%s)' % ti_mt) ):
- fti = ft
- break
-
- if fti is None:
- raise BadRequest('%s not found.' % typeinfo_name)
- if not id:
- id = fti.get('id', None)
+ # BBB: typeinfo_name is ignored
if not id:
raise BadRequest('An id is required.')
for mt in Products.meta_types:
@@ -834,13 +770,7 @@
raise ValueError, (
'Meta type %s is not a type class.' % add_meta_type)
id = str(id)
- if fti is not None:
- fti = fti.copy()
- if fti.has_key('id'):
- del fti['id']
- ob = klass(id, **fti)
- else:
- ob = klass(id)
+ ob = klass(id)
self._setObject(id, ob)
if RESPONSE is not None:
RESPONSE.redirect('%s/manage_main' % self.absolute_url())
Modified: CMF/branches/yuppie-setup_cleanup/CMFCore/__init__.py
===================================================================
--- CMF/branches/yuppie-setup_cleanup/CMFCore/__init__.py 2005-10-20 12:28:29 UTC (rev 39525)
+++ CMF/branches/yuppie-setup_cleanup/CMFCore/__init__.py 2005-10-20 12:33:09 UTC (rev 39526)
@@ -81,11 +81,7 @@
, CMFBTreeFolder.manage_addCMFBTreeFolder
)
-_FTI = ( PortalFolder.factory_type_information
- + CMFBTreeFolder.factory_type_information
- )
-
# Because persistent objects may be out there which were
# created when the module was in that product, we need
# __module_aliases__ .
@@ -189,7 +185,6 @@
, content_types=_CONTENT_TYPES
, permission=AddPortalFolders
, extra_constructors=_EXTRA_CONSTRUCTORS
- , fti=_FTI
).initialize( context )
# make registerHelp work with 2 directories
Modified: CMF/branches/yuppie-setup_cleanup/CMFCore/tests/test_TypesTool.py
===================================================================
--- CMF/branches/yuppie-setup_cleanup/CMFCore/tests/test_TypesTool.py 2005-10-20 12:28:29 UTC (rev 39525)
+++ CMF/branches/yuppie-setup_cleanup/CMFCore/tests/test_TypesTool.py 2005-10-20 12:33:09 UTC (rev 39526)
@@ -144,56 +144,7 @@
self.fail('CMF Collector issue #165 (Ownership bug): '
'Unauthorized raised' )
- def test_CMFCollector_49(self):
- #http://www.zope.org/Collectors/CMF/49
- #If you have two FTIs on the file system, both with the same meta_type
- #but with different id values, the way listDefaultTypeInformation
- #listed them in the dropdown list made it impossible to distinguish
- #the two because the identifier string only contained the CMF package
- #name and the meta_type
-
- # Extreme nastiness: Fake out a /Control_Panel/Products registry
- # inside the fake site by putting dummy objects with a
- # factory_type_information attribute on them...
- import copy
- fti1 = copy.deepcopy(FTIDATA_DUMMY)
- fti2 = copy.deepcopy(FTIDATA_DUMMY)
- fti2[0]['id'] = 'Other Content'
- product1 = DummyObject('product1')
- product1.factory_type_information = fti1 + fti2
- self.site._setObject('product1', product1)
- def fakeGetProducts(*ign, **igntoo):
- return self.site
- def fakeObjectValues(*ign, **igntoo):
- return (self.site.product1,)
- self.ttool._getProducts = fakeGetProducts
- self.site.objectValues = fakeObjectValues
-
- types = self.ttool.listDefaultTypeInformation()
- dropdown_representation = [x[0] for x in types]
- self.failIf(dropdown_representation[0]==dropdown_representation[1])
-
- # Backwards-compatibility tests
- # Make sure the old representation still works, for now
- ti_factory = self.ttool.manage_addTypeInformation
- ti_type = 'Factory-based Type Information'
- new_repr = 'product1: Dummy Content (Dummy)'
- old_repr = 'product1: Dummy'
-
- # This one uses the new representation. We do not expect an Exception
- ti_factory(ti_type, id='NewType1', typeinfo_name=new_repr)
- self.failUnless('NewType1' in self.ttool.objectIds())
-
- # Now try with the old representation, which will throw a BadRequest
- # unless the workaround in the code is used
- self._trap_warning_output()
- ti_factory(ti_type, id='NewType2', typeinfo_name=old_repr)
- self.failUnless('NewType2' in self.ttool.objectIds())
- self.failUnless('DeprecationWarning' in
- self._our_stderr_stream.getvalue())
-
-
class TypeInfoTests(TestCase):
def _makeTypesTool(self):
Modified: CMF/branches/yuppie-setup_cleanup/CMFCore/utils.py
===================================================================
--- CMF/branches/yuppie-setup_cleanup/CMFCore/utils.py 2005-10-20 12:28:29 UTC (rev 39525)
+++ CMF/branches/yuppie-setup_cleanup/CMFCore/utils.py 2005-10-20 12:33:09 UTC (rev 39526)
@@ -594,11 +594,11 @@
, extra_constructors=()
, fti=()
):
+ # BBB: fti argument is ignored
self.meta_type = meta_type
self.content_types = content_types
self.permission = permission
self.extra_constructors = extra_constructors
- self.fti = fti
def initialize(self, context):
# Add only one meta type to the folder add list.
@@ -609,9 +609,7 @@
# manage_addContentType() can then grab it.
, constructors = ( manage_addContentForm
, manage_addContent
- , self
- , ('factory_type_information', self.fti)
- ) + self.extra_constructors
+ , self ) + self.extra_constructors
, permission = self.permission
)
Modified: CMF/branches/yuppie-setup_cleanup/CMFDefault/DEPENDENCIES.txt
===================================================================
--- CMF/branches/yuppie-setup_cleanup/CMFDefault/DEPENDENCIES.txt 2005-10-20 12:28:29 UTC (rev 39525)
+++ CMF/branches/yuppie-setup_cleanup/CMFDefault/DEPENDENCIES.txt 2005-10-20 12:33:09 UTC (rev 39526)
@@ -1,5 +1,4 @@
Zope >= 2.8.2
Five >= 1.2
CMFCore
-CMFTopic
GenericSetup
Modified: CMF/branches/yuppie-setup_cleanup/CMFDefault/DiscussionItem.py
===================================================================
--- CMF/branches/yuppie-setup_cleanup/CMFDefault/DiscussionItem.py 2005-10-20 12:28:29 UTC (rev 39525)
+++ CMF/branches/yuppie-setup_cleanup/CMFDefault/DiscussionItem.py 2005-10-20 12:33:09 UTC (rev 39526)
@@ -40,34 +40,8 @@
from utils import scrubHTML
-factory_type_information = (
- { 'id' : 'Discussion Item'
- , 'meta_type' : 'Discussion Item'
- , 'description' : """\
-Discussion Items are documents which reply to other content.
-They should *not* be addable through the standard 'folder_factories' interface.
-"""
- , 'icon' : 'discussionitem_icon.gif'
- , 'product' : '' # leave blank to suppress
- , 'factory' : ''
- , 'immediate_view' : ''
- , 'aliases' : {'(Default)':'discussionitem_view',
- 'view':'discussionitem_view'}
- , 'actions' : ( { 'id' : 'view'
- , 'name' : 'View'
- , 'action': 'string:${object_url}/discussionitem_view'
- , 'permissions' : (View,)
- }
- ,
- )
- }
-,
-)
-
-
def addDiscussionItem(self, id, title, description, text_format, text,
reply_to, RESPONSE=None):
-
""" Add a discussion item
'title' is also used as the subject header
@@ -442,4 +416,4 @@
return [ x[0] for x in result ]
-InitializeClass( DiscussionItemContainer )
+InitializeClass(DiscussionItemContainer)
Modified: CMF/branches/yuppie-setup_cleanup/CMFDefault/Document.py
===================================================================
--- CMF/branches/yuppie-setup_cleanup/CMFDefault/Document.py 2005-10-20 12:28:29 UTC (rev 39525)
+++ CMF/branches/yuppie-setup_cleanup/CMFDefault/Document.py 2005-10-20 12:33:09 UTC (rev 39526)
@@ -45,50 +45,18 @@
from utils import parseHeadersBody
from utils import SimpleHTMLParser
-factory_type_information = (
- { 'id' : 'Document'
- , 'meta_type' : 'Document'
- , 'description' : """\
-Documents contain text that can be formatted using 'Structured Text.'
-They may also contain HTML, or "plain" text.
-"""
- , 'icon' : 'document_icon.gif'
- , 'product' : 'CMFDefault'
- , 'factory' : 'addDocument'
- , 'immediate_view' : 'metadata_edit_form'
- , 'aliases' : {'(Default)':'document_view',
- 'view':'document_view',
- 'gethtml':'source_html'}
- , 'actions' : ( { 'id' : 'view'
- , 'name' : 'View'
- , 'action': 'string:${object_url}/document_view'
- , 'permissions' : (View,)
- }
- , { 'id' : 'edit'
- , 'name' : 'Edit'
- , 'action': 'string:${object_url}/document_edit_form'
- , 'permissions' : (ModifyPortalContent,)
- }
- , { 'id' : 'metadata'
- , 'name' : 'Metadata'
- , 'action': 'string:${object_url}/metadata_edit_form'
- , 'permissions' : (ModifyPortalContent,)
- }
- )
- }
-,
-)
-def addDocument(self, id, title='', description='', text_format='',
- text=''):
- """ Add a Document """
+def addDocument(self, id, title='', description='', text_format='', text=''):
+ """Add a Document.
+ """
o = Document(id, title, description, text_format, text)
self._setObject(id,o)
class Document(PortalContent, DefaultDublinCoreImpl):
- """ A Document - Handles both StructuredText and HTML """
+ """A Document - Handles both StructuredText and HTML.
+ """
implements(IDocument, IMutableDocument)
__implements__ = (z2IDocument, z2IMutableDocument,
Modified: CMF/branches/yuppie-setup_cleanup/CMFDefault/Favorite.py
===================================================================
--- CMF/branches/yuppie-setup_cleanup/CMFDefault/Favorite.py 2005-10-20 12:28:29 UTC (rev 39525)
+++ CMF/branches/yuppie-setup_cleanup/CMFDefault/Favorite.py 2005-10-20 12:33:09 UTC (rev 39526)
@@ -23,47 +23,14 @@
from Products.CMFCore.utils import getToolByName
-from permissions import View
-from permissions import ModifyPortalContent
from DublinCore import DefaultDublinCoreImpl
from Link import Link
+from permissions import View
-factory_type_information = (
- { 'id' : 'Favorite'
- , 'meta_type' : 'Favorite'
- , 'description' : """\
-A Favorite is a Link to an intra-portal resource.
-"""
- , 'icon' : 'link_icon.gif'
- , 'product' : 'CMFDefault'
- , 'factory' : 'addFavorite'
- , 'immediate_view' : 'metadata_edit_form'
- , 'aliases' : {'(Default)':'favorite_view',
- 'view':'favorite_view'}
- , 'actions' : ( { 'id' : 'view'
- , 'name' : 'View'
- , 'action': 'string:${object_url}/favorite_view'
- , 'permissions' : ( View, )
- }
- , { 'id' : 'edit'
- , 'name' : 'Edit'
- , 'action': 'string:${object_url}/link_edit_form'
- , 'permissions' : ( ModifyPortalContent, )
- }
- , { 'id' : 'metadata'
- , 'name' : 'Metadata'
- , 'action': 'string:${object_url}/metadata_edit_form'
- , 'permissions' : ( ModifyPortalContent, )
- }
- )
- }
-,
-)
def addFavorite(self, id, title='', remote_url='', description=''):
+ """Add a Favorite.
"""
- Add a Favorite
- """
portal_url = getToolByName(self, 'portal_url')
portal_obj = portal_url.getPortalObject()
content_obj = portal_obj.restrictedTraverse( remote_url )
@@ -73,10 +40,10 @@
self._setObject(id,o)
-class Favorite( Link ):
+class Favorite(Link):
+
+ """A Favorite (special kind of Link).
"""
- A Favorite (special kind of Link)
- """
__implements__ = Link.__implements__ # redundant, but explicit
@@ -215,5 +182,4 @@
# save unique id of favorite
self.remote_uid = self._getUidByUrl()
-
InitializeClass(Favorite)
Modified: CMF/branches/yuppie-setup_cleanup/CMFDefault/File.py
===================================================================
--- CMF/branches/yuppie-setup_cleanup/CMFDefault/File.py 2005-10-20 12:28:29 UTC (rev 39525)
+++ CMF/branches/yuppie-setup_cleanup/CMFDefault/File.py 2005-10-20 12:33:09 UTC (rev 39526)
@@ -17,55 +17,17 @@
$Id$
"""
+import OFS.Image
from Globals import InitializeClass
from AccessControl import ClassSecurityInfo
from Products.CMFCore.PortalContent import PortalContent
from DublinCore import DefaultDublinCoreImpl
-from permissions import View
from permissions import ModifyPortalContent
+from permissions import View
-factory_type_information = (
- { 'id' : 'File'
- , 'meta_type' : 'Portal File'
- , 'description' : """\
-File objects can contain arbitrary downloadable files.
-"""
- , 'icon' : 'file_icon.gif'
- , 'product' : 'CMFDefault'
- , 'factory' : 'addFile'
- , 'immediate_view' : 'metadata_edit_form'
- , 'aliases' : {'(Default)':'index_html',
- 'view':'file_view'}
- , 'actions' : ( { 'id' : 'view'
- , 'name' : 'View'
- , 'action': 'string:${object_url}/file_view'
- , 'permissions' : (View,)
- }
- , { 'id' : 'download'
- , 'name' : 'Download'
- , 'action': 'string:${object_url}'
- , 'permissions' : (View,)
- }
- , { 'id' : 'edit'
- , 'name' : 'Edit'
- , 'action': 'string:${object_url}/file_edit_form'
- , 'permissions' : (ModifyPortalContent,)
- }
- , { 'id' : 'metadata'
- , 'name' : 'Metadata'
- , 'action': 'string:${object_url}/metadata_edit_form'
- , 'permissions' : (ModifyPortalContent,)
- }
- )
- }
-,
-)
-
-import OFS.Image
-
def addFile( self
, id
, title=''
@@ -109,9 +71,9 @@
, PortalContent
, DefaultDublinCoreImpl
):
+
+ """A Portal-managed File.
"""
- A Portal-managed File
- """
# The order of base classes is very significant in this case.
# Image.File does not store it's id in it's 'id' attribute.
@@ -259,6 +221,4 @@
OFS.Image.File.PUT( self, REQUEST, RESPONSE )
self.reindexObject()
-
InitializeClass(File)
-
Modified: CMF/branches/yuppie-setup_cleanup/CMFDefault/Image.py
===================================================================
--- CMF/branches/yuppie-setup_cleanup/CMFDefault/Image.py 2005-10-20 12:28:29 UTC (rev 39525)
+++ CMF/branches/yuppie-setup_cleanup/CMFDefault/Image.py 2005-10-20 12:33:09 UTC (rev 39526)
@@ -16,49 +16,17 @@
$Id$
"""
+import OFS.Image
from Globals import InitializeClass
from AccessControl import ClassSecurityInfo
from Products.CMFCore.PortalContent import PortalContent
from DublinCore import DefaultDublinCoreImpl
-from permissions import View
from permissions import ModifyPortalContent
+from permissions import View
-factory_type_information = (
- { 'id' : 'Image'
- , 'meta_type' : 'Portal Image'
- , 'description' : """\
-Image objects can be embedded in Portal documents.
-"""
- , 'icon' : 'image_icon.gif'
- , 'product' : 'CMFDefault'
- , 'factory' : 'addImage'
- , 'immediate_view' : 'metadata_edit_form'
- , 'aliases' : {'(Default)':'index_html',
- 'view':'image_view'}
- , 'actions' : ( { 'id' : 'view'
- , 'name' : 'View'
- , 'action': 'string:${object_url}/image_view'
- , 'permissions' : (View,)
- }
- , { 'id' : 'edit'
- , 'name' : 'Edit'
- , 'action': 'string:${object_url}/image_edit_form'
- , 'permissions' : (ModifyPortalContent,)
- }
- , { 'id' : 'metadata'
- , 'name' : 'Metadata'
- , 'action': 'string:${object_url}/metadata_edit_form'
- , 'permissions' : (ModifyPortalContent,)
- }
- )
- }
-,
-)
-import OFS.Image
-
def addImage( self
, id
, title=''
@@ -242,5 +210,3 @@
self.reindexObject()
InitializeClass(Image)
-
-
Modified: CMF/branches/yuppie-setup_cleanup/CMFDefault/Link.py
===================================================================
--- CMF/branches/yuppie-setup_cleanup/CMFDefault/Link.py 2005-10-20 12:28:29 UTC (rev 39525)
+++ CMF/branches/yuppie-setup_cleanup/CMFDefault/Link.py 2005-10-20 12:33:09 UTC (rev 39526)
@@ -17,10 +17,10 @@
import urlparse
+import transaction
from AccessControl import ClassSecurityInfo
from Globals import DTMLFile
from Globals import InitializeClass
-import transaction
from Products.CMFCore.PortalContent import PortalContent
from Products.CMFCore.utils import contributorsplitter
@@ -34,37 +34,6 @@
from utils import formatRFC822Headers
from utils import parseHeadersBody
-factory_type_information = (
- { 'id' : 'Link'
- , 'meta_type' : 'Link'
- , 'description' : """\
-Link items are annotated URLs.
-"""
- , 'icon' : 'link_icon.gif'
- , 'product' : 'CMFDefault'
- , 'factory' : 'addLink'
- , 'immediate_view' : 'metadata_edit_form'
- , 'aliases' : {'(Default)':'link_view',
- 'view':'link_view'}
- , 'actions' : ( { 'id' : 'view'
- , 'name' : 'View'
- , 'action': 'string:${object_url}/link_view'
- , 'permissions' : (View,)
- }
- , { 'id' : 'edit'
- , 'name' : 'Edit'
- , 'action': 'string:${object_url}/link_edit_form'
- , 'permissions' : (ModifyPortalContent,)
- }
- , { 'id' : 'metadata'
- , 'name' : 'Metadata'
- , 'action': 'string:${object_url}/metadata_edit_form'
- , 'permissions' : (ModifyPortalContent,)
- }
- )
- }
-,
-)
def addLink( self
, id
@@ -72,19 +41,16 @@
, remote_url=''
, description=''
):
+ """Add a Link instance to 'self'.
"""
- Add a Link instance to 'self'.
- """
o=Link( id, title, remote_url, description )
self._setObject(id,o)
-class Link( PortalContent
- , DefaultDublinCoreImpl
- ):
+class Link(PortalContent, DefaultDublinCoreImpl):
+
+ """A Link.
"""
- A Link
- """
__implements__ = ( PortalContent.__implements__
, DefaultDublinCoreImpl.__implements__
@@ -229,4 +195,4 @@
"""
return len(self.manage_FTPget())
-InitializeClass( Link )
+InitializeClass(Link)
Modified: CMF/branches/yuppie-setup_cleanup/CMFDefault/NewsItem.py
===================================================================
--- CMF/branches/yuppie-setup_cleanup/CMFDefault/NewsItem.py 2005-10-20 12:28:29 UTC (rev 39525)
+++ CMF/branches/yuppie-setup_cleanup/CMFDefault/NewsItem.py 2005-10-20 12:33:09 UTC (rev 39526)
@@ -22,39 +22,6 @@
from permissions import ModifyPortalContent
from permissions import View
-factory_type_information = (
- { 'id' : 'News Item'
- , 'meta_type' : 'News Item'
- , 'description' : """\
-News Items contain short text articles and carry a title as well as
-an optional description.
-"""
- , 'icon' : 'newsitem_icon.gif'
- , 'product' : 'CMFDefault'
- , 'factory' : 'addNewsItem'
- , 'immediate_view' : 'metadata_edit_form'
- , 'aliases' : {'(Default)':'newsitem_view',
- 'view':'newsitem_view',
- 'gethtml':'source_html'}
- , 'actions' : ( { 'id' : 'view'
- , 'name' : 'View'
- , 'action': 'string:${object_url}/newsitem_view'
- , 'permissions' : (View,)
- }
- , { 'id' : 'edit'
- , 'name' : 'Edit'
- , 'action': 'string:${object_url}/newsitem_edit_form'
- , 'permissions' : (ModifyPortalContent,)
- }
- , { 'id' : 'metadata'
- , 'name' : 'Metadata'
- , 'action': 'string:${object_url}/metadata_edit_form'
- , 'permissions' : (ModifyPortalContent,)
- }
- )
- }
-,
-)
def addNewsItem( self
, id
@@ -63,9 +30,8 @@
, text=''
, text_format=''
):
+ """Add a NewsItem.
"""
- Add a NewsItem
- """
o=NewsItem( id=id
, title=title
, description=description
@@ -75,10 +41,10 @@
self._setObject(id, o)
-class NewsItem( Document ):
+class NewsItem(Document):
+
+ """A News Item.
"""
- A News Item
- """
__implements__ = Document.__implements__ # redundant, but explicit
@@ -98,4 +64,4 @@
self.setDescription( description )
Document.edit( self, text_format, text )
-InitializeClass( NewsItem )
+InitializeClass(NewsItem)
Modified: CMF/branches/yuppie-setup_cleanup/CMFDefault/Portal.py
===================================================================
--- CMF/branches/yuppie-setup_cleanup/CMFDefault/Portal.py 2005-10-20 12:28:29 UTC (rev 39525)
+++ CMF/branches/yuppie-setup_cleanup/CMFDefault/Portal.py 2005-10-20 12:33:09 UTC (rev 39526)
@@ -15,57 +15,18 @@
$Id$
"""
-from warnings import warn
-
from Globals import InitializeClass
from Products.CMFCore.PortalObject import PortalObjectBase
-from Products.CMFCore import PortalFolder
-from Products.CMFCore.TypesTool import FactoryTypeInformation
-from Products.CMFCore.utils import getToolByName
-# This SkinnedFolder import is a workaround for circular imports in CMFTopic
-import Products.CMFDefault.SkinnedFolder
-from Products.CMFTopic import Topic
-from Products.CMFTopic import topic_globals
-
from DublinCore import DefaultDublinCoreImpl
from permissions import AddPortalContent
from permissions import AddPortalFolders
-from permissions import DeleteObjects
-from permissions import FTPAccess
from permissions import ListPortalMembers
-from permissions import ListUndoableChanges
-from permissions import ManagePortal
-from permissions import ManageProperties
from permissions import ReplyToItem
-from permissions import ReviewPortalContent
-from permissions import SetOwnPassword
-from permissions import SetOwnProperties
-from permissions import UndoChanges
from permissions import View
-from permissions import ViewManagementScreens
-import Document
-import Image
-import File
-import Link
-import NewsItem
-import Favorite
-import DiscussionItem
-import SkinnedFolder
-factory_type_information = ( Document.factory_type_information
- + Image.factory_type_information
- + File.factory_type_information
- + Link.factory_type_information
- + NewsItem.factory_type_information
- + Favorite.factory_type_information
- + DiscussionItem.factory_type_information
- + SkinnedFolder.factory_type_information
- )
-
-
class CMFSite(PortalObjectBase, DefaultDublinCoreImpl):
"""
@@ -106,201 +67,3 @@
pass
InitializeClass(CMFSite)
-
-
-class PortalGenerator:
-
- klass = CMFSite
-
- def setupTools(self, p):
- """Set up initial tools"""
-
- addCMFCoreTool = p.manage_addProduct['CMFCore'].manage_addTool
- addCMFCoreTool('CMF Actions Tool', None)
- addCMFCoreTool('CMF Catalog', None)
- addCMFCoreTool('CMF Member Data Tool', None)
- addCMFCoreTool('CMF Skins Tool', None)
- addCMFCoreTool('CMF Types Tool', None)
- addCMFCoreTool('CMF Undo Tool', None)
- addCMFCoreTool('CMF URL Tool', None)
- addCMFCoreTool('CMF Workflow Tool', None)
-
- addCMFDefaultTool = p.manage_addProduct['CMFDefault'].manage_addTool
- addCMFDefaultTool('Default Discussion Tool', None)
- addCMFDefaultTool('Default Membership Tool', None)
- addCMFDefaultTool('Default Registration Tool', None)
- addCMFDefaultTool('Default Properties Tool', None)
- addCMFDefaultTool('Default Metadata Tool', None)
- addCMFDefaultTool('Default Syndication Tool', None)
-
- # try to install CMFUid without raising exceptions if not available
- try:
- addCMFUidTool = p.manage_addProduct['CMFUid'].manage_addTool
- except AttributeError:
- pass
- else:
- addCMFUidTool('Unique Id Annotation Tool', None)
- addCMFUidTool('Unique Id Generator Tool', None)
- addCMFUidTool('Unique Id Handler Tool', None)
-
- def setupMailHost(self, p):
- p.manage_addProduct['MailHost'].manage_addMailHost(
- 'MailHost', smtp_host='localhost')
-
- def setupUserFolder(self, p):
- p.manage_addProduct['OFSP'].manage_addUserFolder()
-
- def setupCookieAuth(self, p):
- p.manage_addProduct['CMFCore'].manage_addCC(
- id='cookie_authentication')
-
- def setupMembersFolder(self, p):
- PortalFolder.manage_addPortalFolder(p, 'Members')
- p.Members.manage_addProduct['OFSP'].manage_addDTMLMethod(
- 'index_html', 'Member list', '<dtml-return roster>')
-
- def setupRoles(self, p):
- # Set up the suggested roles.
- p.__ac_roles__ = ('Member', 'Reviewer',)
-
- def setupPermissions(self, p):
- # Set up some suggested role to permission mappings.
- mp = p.manage_permission
-
- mp(AddPortalContent, ['Owner','Manager',], 1)
- mp(AddPortalFolders, ['Owner','Manager',], 1)
- mp(ListPortalMembers, ['Member','Manager',], 1)
- mp(ListUndoableChanges, ['Member','Manager',], 1)
- mp(ReplyToItem, ['Member','Manager',], 1)
- mp(ReviewPortalContent, ['Reviewer','Manager',], 1)
- mp(SetOwnPassword, ['Member','Manager',], 1)
- mp(SetOwnProperties, ['Member','Manager',], 1)
-
- # Add some other permissions mappings that may be helpful.
- mp(DeleteObjects, ['Owner','Manager',], 1)
- mp(FTPAccess, ['Owner','Manager',], 1)
- mp(ManageProperties, ['Owner','Manager',], 1)
- mp(UndoChanges, ['Owner','Manager',], 1)
- mp(ViewManagementScreens, ['Owner','Manager',], 1)
-
- def setupDefaultSkins(self, p):
- from Products.CMFCore.DirectoryView import addDirectoryViews
- ps = getToolByName(p, 'portal_skins')
- addDirectoryViews(ps, 'skins', globals())
- addDirectoryViews(ps, 'skins', topic_globals)
- ps.manage_addProduct['OFSP'].manage_addFolder(id='custom')
- ps.addSkinSelection('Basic',
- 'custom, zpt_topic, zpt_content, zpt_generic,'
- + 'zpt_control, Images',
- make_default=1)
- p.setupCurrentSkin()
-
- def setupTypes(self, p, initial_types=factory_type_information):
- tool = getToolByName(p, 'portal_types', None)
- if tool is None:
- return
- for t in initial_types:
- fti = FactoryTypeInformation(**t)
- tool._setObject(t['id'], fti)
-
- def setupMimetypes(self, p):
- p.manage_addProduct[ 'CMFCore' ].manage_addRegistry()
- reg = p.content_type_registry
-
- reg.addPredicate( 'link', 'extension' )
- reg.getPredicate( 'link' ).edit( extensions="url, link" )
- reg.assignTypeName( 'link', 'Link' )
-
- reg.addPredicate( 'news', 'extension' )
- reg.getPredicate( 'news' ).edit( extensions="news" )
- reg.assignTypeName( 'news', 'News Item' )
-
- reg.addPredicate( 'document', 'major_minor' )
- reg.getPredicate( 'document' ).edit( major="text", minor="" )
- reg.assignTypeName( 'document', 'Document' )
-
- reg.addPredicate( 'image', 'major_minor' )
- reg.getPredicate( 'image' ).edit( major="image", minor="" )
- reg.assignTypeName( 'image', 'Image' )
-
- reg.addPredicate( 'file', 'major_minor' )
- reg.getPredicate( 'file' ).edit( major="application", minor="" )
- reg.assignTypeName( 'file', 'File' )
-
- def setupWorkflow(self, p):
- wftool = getToolByName(p, 'portal_workflow', None)
- if wftool is None:
- return
- try:
- from Products.DCWorkflow.Default \
- import createDefaultWorkflowClassic
- except ImportError:
- return
- id = 'default_workflow'
- wftool._setObject( id, createDefaultWorkflowClassic(id) )
-
- # These objects don't participate in workflow by default.
- wftool.setChainForPortalTypes( ('Folder', 'Topic'), () )
-
- def setup(self, p, create_userfolder):
- self.setupTools(p)
- self.setupMailHost(p)
- if int(create_userfolder) != 0:
- self.setupUserFolder(p)
- self.setupCookieAuth(p)
- self.setupMembersFolder(p)
- self.setupRoles(p)
- self.setupPermissions(p)
- self.setupDefaultSkins(p)
-
- # SkinnedFolders are only for customization;
- # they aren't a default type.
- default_types = tuple( filter( lambda x: x['id'] != 'Skinned Folder'
- , factory_type_information ) )
- self.setupTypes(p, default_types )
-
- self.setupTypes(p, PortalFolder.factory_type_information)
- self.setupTypes(p, Topic.factory_type_information)
- self.setupMimetypes(p)
- self.setupWorkflow(p)
-
- def create(self, parent, id, create_userfolder):
- id = str(id)
- portal = self.klass(id=id)
- parent._setObject(id, portal)
- # Return the fully wrapped object.
- p = parent.this()._getOb(id)
- self.setup(p, create_userfolder)
- return p
-
- def setupDefaultProperties(self, p, title, description,
- email_from_address, email_from_name,
- validate_email, default_charset=''):
- p._setProperty('email_from_address', email_from_address, 'string')
- p._setProperty('email_from_name', email_from_name, 'string')
- p._setProperty('validate_email', validate_email and 1 or 0, 'boolean')
- p._setProperty('default_charset', default_charset, 'string')
- p._setProperty('enable_permalink', 0, 'boolean')
- p.title = title
- p.description = description
-
-
-def manage_addCMFSite(self, id, title='Portal', description='',
- create_userfolder=1,
- email_from_address='postmaster at localhost',
- email_from_name='Portal Administrator',
- validate_email=0, default_charset='',
- RESPONSE=None):
- """ Adds a portal instance.
- """
- warn('manage_addCMFSite() is deprecated and will be removed in CMF 1.7. '
- 'Please use addConfiguredSite() instead.',
- DeprecationWarning)
- gen = PortalGenerator()
- id = id.strip()
- p = gen.create(self, id, create_userfolder)
- gen.setupDefaultProperties(p, title, description,
- email_from_address, email_from_name,
- validate_email, default_charset)
- if RESPONSE is not None:
- RESPONSE.redirect(p.absolute_url() + '/finish_portal_construction')
Modified: CMF/branches/yuppie-setup_cleanup/CMFDefault/SkinnedFolder.py
===================================================================
--- CMF/branches/yuppie-setup_cleanup/CMFDefault/SkinnedFolder.py 2005-10-20 12:28:29 UTC (rev 39525)
+++ CMF/branches/yuppie-setup_cleanup/CMFDefault/SkinnedFolder.py 2005-10-20 12:33:09 UTC (rev 39526)
@@ -22,61 +22,15 @@
from Products.CMFCore.PortalFolder import PortalFolder
from DublinCore import DefaultDublinCoreImpl
-from permissions import AddPortalContent
-from permissions import ListFolderContents
-from permissions import ManageProperties
from permissions import ModifyPortalContent
from permissions import View
-factory_type_information = (
- { 'id' : 'Skinned Folder'
- , 'meta_type' : 'Skinned Folder'
- , 'description' : """\
-Skinned folders can define custom 'view' actions.
-"""
- , 'icon' : 'folder_icon.gif'
- , 'product' : 'CMFDefault'
- , 'factory' : 'addSkinnedFolder'
- , 'filter_content_types' : 0
- , 'immediate_view' : 'folder_edit_form'
- , 'aliases' : {'(Default)': 'folder_view',
- 'view': 'folder_view'}
- , 'actions' : ( { 'id' : 'view'
- , 'name' : 'View'
- , 'action': 'string:${object_url}/folder_view'
- , 'permissions' : (View,)
- }
- , { 'id' : 'edit'
- , 'name' : 'Edit'
- , 'action': 'string:${object_url}/folder_edit_form'
- , 'permissions' : (ManageProperties,)
- }
- , { 'id' : 'folderContents'
- , 'name' : 'Folder contents'
- , 'action': 'string:${object_url}/folder_contents'
- , 'permissions' : (ListFolderContents,)
- }
- , { 'id' : 'new'
- , 'name' : 'New...'
- , 'action': 'string:${object_url}/folder_factories'
- , 'permissions' : (AddPortalContent,)
- , 'visible' : 0
- }
- , { 'id' : 'rename_items'
- , 'name' : 'Rename items'
- , 'action': 'string:${object_url}/folder_rename_form'
- , 'permissions' : (AddPortalContent,)
- , 'visible' : 0
- }
- )
- }
-,
-)
-
class SkinnedFolder(CMFCatalogAware, PortalFolder):
+
""" Skinned Folder class.
"""
+
meta_type = 'Skinned Folder'
security = ClassSecurityInfo()
@@ -104,7 +58,7 @@
# We derive from CMFCatalogAware first, so we are cataloged too.
-InitializeClass( SkinnedFolder )
+InitializeClass(SkinnedFolder)
def addSkinnedFolder( self, id, title='', description='', REQUEST=None ):
Modified: CMF/branches/yuppie-setup_cleanup/CMFDefault/__init__.py
===================================================================
--- CMF/branches/yuppie-setup_cleanup/CMFDefault/__init__.py 2005-10-20 12:28:29 UTC (rev 39525)
+++ CMF/branches/yuppie-setup_cleanup/CMFDefault/__init__.py 2005-10-20 12:33:09 UTC (rev 39526)
@@ -107,7 +107,6 @@
, content_types=contentClasses
, permission=AddPortalContent
, extra_constructors=contentConstructors
- , fti=Portal.factory_type_information
).initialize( context )
profile_registry.registerProfile('default',
@@ -126,8 +125,7 @@
context.registerClass( Portal.CMFSite
, constructors=(factory.addConfiguredSiteForm,
- factory.addConfiguredSite,
- Portal.manage_addCMFSite)
+ factory.addConfiguredSite)
, icon='images/portal.gif'
)
Modified: CMF/branches/yuppie-setup_cleanup/CMFDefault/setuphandlers.py
===================================================================
--- CMF/branches/yuppie-setup_cleanup/CMFDefault/setuphandlers.py 2005-10-20 12:28:29 UTC (rev 39525)
+++ CMF/branches/yuppie-setup_cleanup/CMFDefault/setuphandlers.py 2005-10-20 12:33:09 UTC (rev 39526)
@@ -18,11 +18,10 @@
from Products.CMFCore.utils import getToolByName
from exceptions import BadRequest
-from Portal import PortalGenerator
def importVarious(context):
- """ Import various settings from PortalGenerator.
+ """ Import various settings.
This provisional handler will be removed again as soon as full handlers
are implemented for these steps.
@@ -36,8 +35,9 @@
except BadRequest:
return 'Various settings: Nothing to import.'
- gen = PortalGenerator()
- gen.setupUserFolder(site)
- gen.setupMembersFolder(site)
+ site.manage_addProduct['OFSP'].manage_addUserFolder()
+ site.manage_addPortalFolder('Members')
+ site.Members.manage_addProduct['OFSP'].manage_addDTMLMethod('index_html',
+ 'Member list', '<dtml-return roster>')
return 'Various settings from PortalGenerator imported.'
Modified: CMF/branches/yuppie-setup_cleanup/CMFTopic/Topic.py
===================================================================
--- CMF/branches/yuppie-setup_cleanup/CMFTopic/Topic.py 2005-10-20 12:28:29 UTC (rev 39525)
+++ CMF/branches/yuppie-setup_cleanup/CMFTopic/Topic.py 2005-10-20 12:33:09 UTC (rev 39526)
@@ -22,65 +22,12 @@
from Products.CMFDefault.SkinnedFolder import SkinnedFolder
from Products.CMFCore.utils import getToolByName
-from permissions import ListFolderContents
from permissions import View
from permissions import AddTopics
from permissions import ChangeTopics
-# Factory type information -- makes Topic objects play nicely
-# with the Types Tool (portal_types )
-factory_type_information = (
- { 'id' : 'Topic'
- , 'icon' : 'topic_icon.gif'
- , 'meta_type' : 'Portal Topic'
- , 'description' : 'Topics are canned queries for organizing content '
- 'with up to date queries into the catalog.'
- , 'product' : 'CMFTopic'
- , 'factory' : 'addTopic'
- , 'immediate_view' : 'topic_edit_form'
- , 'allowed_content_types': ('Topic',)
- , 'aliases' : {'(Default)': 'topic_view',
- 'view': 'topic_view'}
- , 'actions' : ( { 'id' : 'view'
- , 'name' : 'View'
- , 'action': 'string:${object_url}/topic_view'
- , 'permissions' : (View,)
- }
- , { 'id' : 'edit'
- , 'name' : 'Edit'
- , 'action': 'string:${object_url}/topic_edit_form'
- , 'permissions' : (ChangeTopics,)
- }
- , { 'id' : 'criteria'
- , 'name' : 'Criteria'
- , 'action': 'string:${object_url}/topic_criteria_form'
- , 'permissions' : (ChangeTopics,)
- }
- , { 'id' : 'folderContents'
- , 'name' : 'Subtopics'
- , 'action': 'string:${object_url}/folder_contents'
- , 'permissions' : (ListFolderContents,)
- }
- , { 'id' : 'new'
- , 'name' : 'New...'
- , 'action': 'string:${object_url}/folder_factories'
- , 'permissions' : (AddTopics,)
- , 'visible' : 0
- }
- , { 'id' : 'rename_items'
- , 'name' : 'Rename items'
- , 'action': 'string:${object_url}/folder_rename_form'
- , 'permissions' : (AddTopics,)
- , 'visible' : 0
- }
- )
- }
-,
-)
-
def addTopic( self, id, title='', REQUEST=None ):
-
""" Create an empty topic.
"""
topic = Topic( id )
@@ -92,7 +39,7 @@
REQUEST['RESPONSE'].redirect( 'manage_main' )
-class Topic( SkinnedFolder ):
+class Topic(SkinnedFolder):
""" Topics are 'canned queries'
@@ -287,4 +234,4 @@
"""
return "%s %s" % (self.title, self.description)
-InitializeClass( Topic )
+InitializeClass(Topic)
Modified: CMF/branches/yuppie-setup_cleanup/CMFTopic/__init__.py
===================================================================
--- CMF/branches/yuppie-setup_cleanup/CMFTopic/__init__.py 2005-10-20 12:28:29 UTC (rev 39525)
+++ CMF/branches/yuppie-setup_cleanup/CMFTopic/__init__.py 2005-10-20 12:33:09 UTC (rev 39526)
@@ -57,7 +57,6 @@
, content_types = (Topic.Topic,)
, permission = AddTopics
, extra_constructors = (Topic.addTopic,)
- , fti = Topic.factory_type_information
).initialize( context )
profile_registry.registerProfile('default',
Modified: CMF/branches/yuppie-setup_cleanup/CMFTopic/tests/test_Topic.py
===================================================================
--- CMF/branches/yuppie-setup_cleanup/CMFTopic/tests/test_Topic.py 2005-10-20 12:28:29 UTC (rev 39525)
+++ CMF/branches/yuppie-setup_cleanup/CMFTopic/tests/test_Topic.py 2005-10-20 12:33:09 UTC (rev 39526)
@@ -26,7 +26,6 @@
from Products.CMFCore.tests.base.testcase import SecurityTest
from Products.CMFCore.TypesTool import FactoryTypeInformation as FTI
from Products.CMFCore.TypesTool import TypesTool
-from Products.CMFTopic.Topic import factory_type_information as FTIDATA_TOPIC
class FauxBrain( Implicit ):
@@ -198,8 +197,8 @@
def test_Nested( self ):
self.site._setObject( 'portal_types', TypesTool() )
- fti = FTIDATA_TOPIC[0].copy()
- self.site.portal_types._setObject( 'Topic', FTI(**fti) )
+ self.site.portal_types._setObject('Topic', FTI(id='Topic',
+ product='CMFTopic', factory='addTopic'))
topic = self._makeOne('top')
topic._setPortalTypeName('Topic')
More information about the CMF-checkins
mailing list