Created
October 28, 2008 14:41
-
-
Save dirceu/20394 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
from StringIO import StringIO | |
from Products.CMFCore.utils import getToolByName | |
from zope.app.component.hooks import setSite | |
from zope.app.component.interfaces import ISite, IPossibleSite | |
from Products.Five.site.localsite import enableLocalSiteHook | |
from collective.lead.interfaces import IDatabase | |
from interlegis.sqlalchemystorage.database import InterlegisDatabase | |
def install(self, reinstall=False): | |
""" External Method to install interlegis.sqlalchemystorage """ | |
out = StringIO() | |
print >> out, "Installation log of interlegis.sqlalchemystorage" | |
portal = getToolByName(self,'portal_url').getPortalObject() | |
if not IPossibleSite.providedBy(portal): | |
e = "Object is not IPossible: %s " % portal.getPhysicalPath() | |
print >> out, e | |
raise Exception(e) | |
if not ISite.providedBy(portal): | |
enableLocalSiteHook(portal) | |
setSite(portal) | |
# register InterlegisDatabase utility | |
sm = portal.getSiteManager() | |
sm.registerUtility(InterlegisDatabase, IDatabase) | |
return out.getvalue() | |
def uninstall(self, reinstall=False): | |
out = StringIO() | |
return out.getvalue() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment