Skip to content

Instantly share code, notes, and snippets.

@dirceu
Created October 28, 2008 14:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dirceu/20394 to your computer and use it in GitHub Desktop.
Save dirceu/20394 to your computer and use it in GitHub Desktop.
# -*- 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