Skip to content

Commit

Permalink
refactor(dependencies): remove plone.api dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
toutpt committed May 27, 2013
1 parent f69999b commit 756b6ce
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
10 changes: 8 additions & 2 deletions collective/etherpad/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@

#plone
from plone.registry.interfaces import IRegistry
from plone import api

#internal
from collective.etherpad.settings import EtherpadSettings
from Products.CMFCore.interfaces._content import ISiteRoot
from zope.component.hooks import getSite

logger = logging.getLogger('collective.etherpad')

Expand Down Expand Up @@ -339,7 +340,12 @@ def update(self):
if self._settings is None:
self._settings = self._registry.forInterface(EtherpadSettings)
if self._portal_url is None:
self._portal_url = api.portal.get().absolute_url()
#code stolen to plone.api
closest_site = getSite()
if closest_site is not None:
for potential_portal in closest_site.aq_chain:
if ISiteRoot in interface.providedBy(potential_portal):
self._portal_url = potential_portal.absolute_url()
if self.uri is None:
basepath = self._settings.basepath
apiversion = self._settings.apiversion
Expand Down
1 change: 0 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
zip_safe=False,
install_requires=[
'setuptools',
'plone.api',
# -*- Extra requirements: -*-
],
extras_require=dict(
Expand Down

0 comments on commit 756b6ce

Please sign in to comment.