products/CPSRSS

changeset 226:b126b9cc1e01

Removed obsolete CPSInstaller method
author Georges Racinet on purity.racinet.fr <georges@racinet.fr>
date Sat, 13 Nov 2010 17:05:22 +0100
parents ff458a7963b3
children ff592c2444b0
files Extensions/__init__.py Extensions/install.py
diffstat 2 files changed, 0 insertions(+), 163 deletions(-) [+]
line diff
     1.1 deleted file mode 100644
     2.1 deleted file mode 100644
     2.2 --- a/Extensions/install.py
     2.3 +++ /dev/null
     2.4 @@ -1,163 +0,0 @@
     2.5 -# (C) Copyright 2003 Nuxeo SARL <http://nuxeo.com>
     2.6 -# Author: Emmanuel Pietriga <ep@nuxeo.com>
     2.7 -#
     2.8 -# This program is free software; you can redistribute it and/or modify
     2.9 -# it under the terms of the GNU General Public License version 2 as published
    2.10 -# by the Free Software Foundation.
    2.11 -#
    2.12 -# This program is distributed in the hope that it will be useful,
    2.13 -# but WITHOUT ANY WARRANTY; without even the implied warranty of
    2.14 -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    2.15 -# GNU General Public License for more details.
    2.16 -#
    2.17 -# You should have received a copy of the GNU General Public License
    2.18 -# along with this program; if not, write to the Free Software
    2.19 -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
    2.20 -# 02111-1307, USA.
    2.21 -#
    2.22 -# $Id$
    2.23 -
    2.24 -"""
    2.25 -CPSRSS Installer
    2.26 -
    2.27 -HOWTO USE THAT ?
    2.28 -
    2.29 - - Log into the ZMI as manager
    2.30 - - Go to your CPS root directory
    2.31 -* - Create an External Method with the following parameters:
    2.32 -
    2.33 -     id    : CPSRSS Installer (or whatever)
    2.34 -     title : CPSRSS Installer (or whatever)
    2.35 -     Module Name   :  CPSRSS.install
    2.36 -     Function Name : install
    2.37 -
    2.38 - - save it
    2.39 - - click now the test tab of this external method.
    2.40 -
    2.41 -"""
    2.42 -
    2.43 -import os, sys
    2.44 -from zLOG import LOG, INFO, DEBUG
    2.45 -
    2.46 -from Products.CMFCore.DirectoryView import createDirectoryView
    2.47 -
    2.48 -def cps_rss_i18n_update(self):
    2.49 -    """
    2.50 -    Importation of the po files for internationalization.
    2.51 -    """
    2.52 -    _log = []
    2.53 -    def pr(bla, _log=_log):
    2.54 -        if bla == 'flush':
    2.55 -            return '\n'.join(_log)
    2.56 -        _log.append(bla)
    2.57 -        if (bla):
    2.58 -            LOG('cps_i18n_update:', INFO, bla)
    2.59 -
    2.60 -    def primp(pr=pr):
    2.61 -        pr(" !!! Cannot migrate that component !!!")
    2.62 -
    2.63 -    def prok(pr=pr):
    2.64 -        pr(" Already correctly installed")
    2.65 -
    2.66 -    portal = self.portal_url.getPortalObject()
    2.67 -    def portalhas(id, portal=portal):
    2.68 -        return id in portal.objectIds()
    2.69 -
    2.70 -    pr(" Updating i18n support")
    2.71 -
    2.72 -
    2.73 -    Localizer = portal['Localizer']
    2.74 -    languages = Localizer.get_supported_languages()
    2.75 -    catalog_id = 'cpsrss'
    2.76 -    # Message Catalog
    2.77 -    if catalog_id in Localizer.objectIds():
    2.78 -        Localizer.manage_delObjects([catalog_id])
    2.79 -        pr(" Previous default MessageCatalog deleted for CPSRSS")
    2.80 -
    2.81 -    # Adding the new message Catalog
    2.82 -    Localizer.manage_addProduct['Localizer'].manage_addMessageCatalog(
    2.83 -        id=catalog_id,
    2.84 -        title='CPSRSS messages',
    2.85 -        languages=languages,
    2.86 -        )
    2.87 -
    2.88 -    cpsrssCatalog = Localizer.cpsrss
    2.89 -
    2.90 -    # computing po files' system directory
    2.91 -    CPSRSS_path = sys.modules['Products.CPSRSS'].__path__[0]
    2.92 -    i18n_path = os.path.join(CPSRSS_path, 'i18n')
    2.93 -    pr("   po files are searched in %s" % i18n_path)
    2.94 -    pr("   po files for %s are expected" % str(languages))
    2.95 -
    2.96 -    # loading po files
    2.97 -    for lang in languages:
    2.98 -        po_filename = lang + '.po'
    2.99 -        pr("   importing %s file" % po_filename)
   2.100 -        po_path = os.path.join(i18n_path, po_filename)
   2.101 -        try:
   2.102 -            po_file = open(po_path)
   2.103 -        except (IOError, NameError):
   2.104 -            pr("    %s file not found" % po_path)
   2.105 -        else:
   2.106 -            cpsrssCatalog.manage_import(lang, po_file)
   2.107 -            pr("    %s file imported" % po_path)
   2.108 -
   2.109 -    # Translation Service Tool
   2.110 -    if portalhas('translation_service'):
   2.111 -        translation_service = portal.translation_service
   2.112 -        pr (" Translation Sevice Tool found in here ")
   2.113 -        try:
   2.114 -            if getattr(portal['translation_service'], 'cpsrss', None) == None:
   2.115 -                # translation domains
   2.116 -                translation_service.manage_addDomainInfo('RSSBox','Localizer/cpsrss')
   2.117 -                pr(" RSSBox domain set to Localizer/cpsrss")
   2.118 -        except:
   2.119 -            pass
   2.120 -    else:
   2.121 -        raise str('DependanceError'), 'translation_service'
   2.122 -
   2.123 -    return pr('flush')
   2.124 -
   2.125 -def install(self):
   2.126 -    """
   2.127 -    Starting point
   2.128 -    """
   2.129 -    _log = []
   2.130 -    def pr(bla, zlog=1, _log=_log):
   2.131 -        if bla == 'flush':
   2.132 -            return '<html><head><title>CPSRSS Installer</title></head><body><pre>'+ \
   2.133 -                   '\n'.join(_log) + \
   2.134 -                   '</pre></body></html>'
   2.135 -
   2.136 -        _log.append(bla)
   2.137 -        if bla and zlog:
   2.138 -            LOG('CPSRSS Install:', INFO, bla)
   2.139 -
   2.140 -    def prok(pr=pr):
   2.141 -        pr(" Already correctly installed")
   2.142 -
   2.143 -    pr("Starting CPSRSS Install")
   2.144 -
   2.145 -    portal = self.portal_url.getPortalObject()
   2.146 -
   2.147 -    def portalhas(id, portal=portal):
   2.148 -        return id in portal.objectIds()
   2.149 -
   2.150 -    ##########################################
   2.151 -    # TOOL
   2.152 -    ##########################################
   2.153 -    pr("Installing RSS Tool")
   2.154 -    if portalhas('portal_rss'):
   2.155 -        prok()
   2.156 -    else:
   2.157 -        pr(" Creating RSS Tool (portal_rss)")
   2.158 -        portal.manage_addProduct["CPSRSS"].manage_addTool('RSS Tool')
   2.159 -
   2.160 -    ##############################################
   2.161 -    # i18n support
   2.162 -    ##############################################
   2.163 -
   2.164 -    pr(cps_rss_i18n_update(self))
   2.165 -
   2.166 -    pr("End of CPSRSS install")
   2.167 -    return pr('flush')