# -*- coding: utf-8 # Copyright 2005 by Vahur Rebas from Products.CMFCore.utils import getToolByName from Products.Archetypes.Extensions.utils import install_subskin, installTypes from Products.Archetypes.public import listTypes from StringIO import StringIO import string from Products.Krihvel.config import GLOBALS, PROJECT_NAME def install(self, portal): """ install. """ out = StringIO() install_subskin(self, out, GLOBALS) installTypes(self, out, listTypes(PROJECT_NAME), PROJECT_NAME) qi=getToolByName(self, 'portal_quickinstaller') p=qi._getOb(PROJECT_NAME, None) if p: oldVersion=p.getInstalledVersion() else: oldVersion="0" newVersion=qi.getProductVersion(PROJECT_NAME) migrate(self, portal, out,oldVersion,newVersion) return out.getvalue() def uninstall(self): """ uninstall """ out = StringIO() return out.getvalue() def migrate(self, portal, out, old, new): """ migrate """ if not old: return if new==old: return if new>out, "Migrating from %s to %s" % (old, new) if old<="1.5.9": portal.acl_users.addRole("Teacher") linkCollector = getattr(portal, 'linkcollector') linkCollector.manage_permission('Add portal content', ('Manager','Teacher',) ,1)