[Zope-CMF] Updating skins for a product at the FS level

Tres Seaver tseaver@zope.com
03 Jul 2002 18:21:36 -0400


On Wed, 2002-07-03 at 16:59, J C Lawrence wrote:
> On 02 Jul 2002 18:07:58 -0400 
> Tres Seaver <tseaver@zope.com> wrote:
> 
> > Depends on the skin.  Each named skin is a "search path" through the
> > various skin folders.  In current CMF, the "Basic" skin is defined as:
> 
> >   custom, zpt_topic, zpt_content, zpt_generic,zpt_control, topic,
> > content, generic, control, Images
> 
> Gotcha.  I think I see now.  
> 
> My problem currently is that the right skin methods aren't being called
> by default:
> 
>   from Products.CMFTopic import TopicPermissions
>   from Products.CMFCore import CMFCorePermissions
>   from Products.CMFCore.utils import _checkPermission, _getViewFor,getToolByName
>   from Products.CMFCore.PortalFolder import PortalFolder
> 
>   from Globals import HTMLFile, package_home, InitializeClass
>   from AccessControl import ClassSecurityInfo
>   from Acquisition import aq_parent, aq_inner, aq_base
>   from ComputedAttribute import ComputedAttribute
>   import os
> 
>   factory_type_information = \
>   ( { 'id'                : 'CalTopic'
>     , 'content_icon'      : 'caltopic_icon.gif'
>     , 'meta_type'         : 'Portal CalTopic'
>     , 'description'       : 'CalTopics are canned queries for organizing content '
>                             'with up to date queries into the catalog and a '
>                             'displayed calendar overview.'
>     , 'product'           : 'CalTopic'
>     , 'factory'           : 'addCalTopic'
>     , 'immediate_view'    : 'caltopic_edit_form'
>     , 'actions'           :
>       ( { 'id'            : 'view'
>         , 'name'          : 'View'
>         , 'action'        : 'caltopic_view'
>         , 'permissions'   : (CMFCorePermissions.View, )
>         }
>       , { 'id'            : 'edit'
>         , 'name'          : 'Edit'
>         , 'action'        : 'caltopic_edit_form'
>         , 'permissions'   : (TopicPermissions.ChangeTopics, )
>         }
>       , { 'id'            : 'criteria'
>         , 'name'          : 'Criteria'
>         , 'action'        : 'caltopic_criteria_form'
>         , 'permissions'   : (TopicPermissions.ChangeTopics, )
>         }
>       , { 'id'            : 'subtopics'
>         , 'name'          : 'Subtopics'
>         , 'action'        : 'caltopic_subtopics_form'
>         , 'permissions'   : (TopicPermissions.ChangeTopics, )
>         }
>       )
>     }
>   ,
>   )
> 
> I then register the skins etc in the normal way, which seems to work.
> The problem is that the methods bound to new instances of the class are
> the old topic_* methods (eg topic_view) rather than my new caltopic_*
> methods (eg caltopic_view).  
> 
>   Note: I can call my new methods directly from the URL, and they work
>   and display properly.  However the sidebar edit/view etc links point
>   to the plain topic_ versions instead of the caltopic_ ones.  
> 
> Any idea why?

It sounds like your objects don't know that they should be of type
'CalTopic';  their 'portal_type' attribute is likely set to 'Topic',
or empty (in which case they fall back to the 'meta_type' of their
class).

Are you creating these objects using some mechanism other than
'invokeFactory' on their folder?  If so, you need to arrange for
them to have '_setPortalTypeName( "CalTopic" )' called on them after
they are constructed.

Tres.
-- 
===============================================================
Tres Seaver                                tseaver@zope.com
Zope Corporation      "Zope Dealers"       http://www.zope.com