Personal tools

[4]インストール

コンテンツタイプが正しくインストールされたことを確認します。

Extensions/Install.pyスクリプトは、portal_quickinstallerツールから呼び出されす(Ploneのコントロールパネルの「プロダクトの追加、削除」から呼び出されます)。これは、プロダクトのインストール時にポータルの設定で行います。

RichDocumentには、Install.pyではコンテンツタイプとスキンを登録して、ポータルプロパーティを設定します。これは、PloneにRichDocumentオブジェクトの取り扱い方法を指定します。いくつかの固有の仕様はあとで詳細に説明しますが、install()メソッドのいくつかの要素は、大抵のコンテンツタイプで共通に使用できます。

    def install(self):
        """Install RichDocument: Install content types, skin layer, install the
        stylesheet, set up global properties, enable the portal factory and
        set up form controller actions for the widget actions
        """
        out = StringIO()
        
        print >> out, "Installing RichDocument"
        
        # Install types
        classes = listTypes(PROJECTNAME)
        installTypes(self, out,
                     classes,
                     PROJECTNAME)
        print >> out, "Installed types"
        
        # Install skin
        install_subskin(self, out, product_globals)
        print >> out, "Installed skin"
        
        # Migrate FTI, to make sure we get the necessary infrastructure for the
        # "display" menu to work.
        migrated = migrateFTIs(self, product=PROJECTNAME)
        print >>out, "Switched to DynamicViewFTI: %s" % ', '.join(migrated)
        
        # Enable portal_factory
        factory = getToolByName(self, 'portal_factory')
        types = factory.getFactoryTypes().keys()
        if 'RichDocument' not in types:
            types.append('RichDocument')
            factory.manage_setPortalFactoryTypes(listOfTypeIds = types)
        
        print >> out, "Added RichDocument to portal_factory"
        
        ...
        
        return out.getvalue()

ソースコードの残りの部分は、Install.pyを参照してください。上のコードでは、次のことを行っています。

  • registerType()で登録したコンテンツタイプをインストールします。RichDocumentでは、RichDocument自身です。FileAttachmentとImageAttachmentも同様です。
  • portal_skinsにスキンのファイルシステムディレクトリビューをインストールします。これは、プロダクトの__init__.pyで登録します。RichDocument/__init__.pyは次のコードを記述しています。
    # Register skin directories so they can be added to portal_skins
    DirectoryView.registerDirectory('skins', product_globals)
    DirectoryView.registerDirectory('skins/RichDocument', product_globals)
    DirectoryView.registerDirectory('skins/attachment_widgets', product_globals )
  • タイプのファクトリタイプ情報をCMFDynamicViewFTIを使ってマイグレートします。CMFからの標準FTIのこの拡張は「表示」メニューのサポートに必要です。詳細は「動的ビュー」を参照してください。
  • RichDocumentをポータルファクトリで使用するタイプのリストに追加します。ユーザが新規アイテムを作成して、保存しなかった場合、ごみのオブジェクトが残らないようになります。詳細は、「ポータルファクトリ」を参照してください。

インストールスクリプトの残りの部分は、RichDocumentで追加した設定オプションとportal_propertiesのプロパティに関するものです。詳細は、Install.pyと次の章を参照してください。

Navigation
Log in


Forgot your password?
 

Powered by Plone, the Open Source Content Management System