From: Joe B. <je...@ps...> - 2010-08-13 03:51:07
|
Hello, I am trying to install product created with archgenxml. I added the product to my products folder and clicked and tried to add it via add/remove products. When I click onActivate, I get an error message which I pasted in paster at http://pastie.org/1088858 Here's my environment: * Plone 4.0rc1 * Zope 2.12.4 * Python 2.6.4 (r264:75708, Oct 26 2009, 08:23:19) [MSC v.1500 32 bit (Intel)] ArchGenxml 2.4.1 The original product worked in Plone 2.5. I used the same UML file to generate it in Plone 4. Here's what the original Install.py looked like # -*- coding: utf-8 -*- # # File: Install.py # # Copyright (c) 2010 by [] # Generator: ArchGenXML Version 2.4.1 # http://plone.org/products/archgenxml # # GNU General Public License (GPL) # __author__ = """unknown <unknown>""" __docformat__ = 'plaintext' from StringIO import StringIO from Products.CMFCore.utils import getToolByName from Products.Model.config import PROJECTNAME def install(self, reinstall=False): """External Method to install Model This method to install a product is kept, until something better will get part of Plones front end, which utilize portal_setup. """ out = StringIO() print >> out, "Installation log of %s:" % PROJECTNAME setuptool = getToolByName(self, 'portal_setup') importcontext = 'profile-Products.%s:default' % PROJECTNAME setuptool.setImportContext(importcontext) setuptool.runAllImportSteps() return out.getvalue() I looked at Marcos's suggestion and came up with this for the Install.py file from Products.CMFCore.utils import getToolByName def uninstall(portal): qi = getToolByName(portal, 'portal_quickinstaller') if qi.isProductInstalled('Model'): return "Transform tab kept for Model" setup_tool = getToolByName(portal, 'portal_setup') setup_tool.runAllImportStepsFromProfile('Model:uninstall') return "Ran all uninstall steps." The error no longer appears, but now I get this error: Traceback (innermost last): Module ZPublisher.Publish, line 127, in publish Module ZPublisher.mapply, line 77, in mapply Module ZPublisher.Publish, line 47, in call_object Module Products.CMFQuickInstallerTool.QuickInstallerTool, line 575, in installProducts Module Products.CMFQuickInstallerTool.QuickInstallerTool, line 512, in installProduct - __traceback_info__: ('Model',) Module Products.GenericSetup.tool, line 330, in runAllImportStepsFromProfile - __traceback_info__: profile-Products.Model:default Module Products.GenericSetup.tool, line 1085, in _runImportStepsFromContext Module Products.GenericSetup.tool, line 999, in _doRunImportStep - __traceback_info__: Model-Import-Relations Module Products.Model.setuphandlers, line 40, in installRelations Module Products.CMFCore.utils, line 125, in getToolByName AttributeError: relations_library The relations_library is in SetupHandlers.py def installRelations(context): """imports the relations.xml file""" if isNotModelProfile(context): return site = context.getSite() qi = getToolByName(site, 'portal_quickinstaller') if not qi.isProductInstalled('Relations'): # you can't declare relations unless you first install the Relations product logger.info("Installing Relations Product") qi.installProducts(['Relations']) relations_tool = getToolByName(site, 'relations_library') <--this is line 40 xmlpath = os.path.join(package_home(product_globals), 'data', 'relations.xml') f = open(xmlpath) xml = f.read() f.close() relations_tool.importXML(xml) The Module Products.CMFCore.utils, line 125, is in C:\Program Files\Plone\buildout-cache\eggs\products.cmfcore-2.2.1-py2.6.egg\Products\CMFCore\utils.py security.declarePublic('getToolByName') def getToolByName(obj, name, default=_marker): """ Get the tool, 'toolname', by acquiring it. o Application code should use this method, rather than simply acquiring the tool by name, to ease forward migration (e.g., to Zope3). """ tool_interface = _tool_interface_registry.get(name) if tool_interface is not None: try: utility = getUtility(tool_interface) # Site managers, except for five.localsitemanager, return unwrapped # utilities. If the result is something which is acquisition-unaware # but unwrapped we wrap it on the context. if IAcquirer.providedBy(obj) and \ aq_parent(utility) is None and \ IAcquirer.providedBy(utility): utility = utility.__of__(obj) return utility except ComponentLookupError: # behave in backwards-compatible way # fall through to old implementation pass try: tool = aq_get(obj, name, default, 1) except AttributeError: if default is _marker: raise return default else: if tool is _marker: raise AttributeError, name <-- This is line 125 return tool At this point, I am stuck. I have no idea what to do here. Any suggestions are appreciated. Joe Bigler Joseph E. Bigler je...@ps...<mailto:je...@ps...> 814-865-1560 201 Chambers Building Web Administrator |