Porting user sync code from 2.1.3, get Error in PAS code getUtility()
jgayle
jrgayle at gmail.com
Wed Oct 24 22:24:47 UTC 2007
I have code that retrieves users from a Oracle system and syncs them with a
Plone instance. I try running this code on Plone 3.0.1 and I get the
following exception
zope.component.interfaces.ComponentLookupError: (<InterfaceClass
Products.CMFCore.interfaces._content.ISiteRoot>, '')
when calling addMember() on portal_membership tool.
But I can reproduce the problem with the following lines at the zeo debug
prompt:
>>> site = app.unrestrictedTraverse('/myplonesite')
>>> mtool=getToolByName(site, 'portal_membership')
>>> mtool.addMember('john', 'welcome', [], [], {'fullname':'John Smith'})
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File
"/opt/Plone-3.0.1/zeocluster/client1/Products/PlonePAS/tools/membership.py",
line 69, in addMember
member.setMemberProperties(properties)
File
"/opt/Plone-3.0.1/zeocluster/client1/Products/PlonePAS/tools/memberdata.py",
line 141, in setMemberProperties
sheet.setProperty(user, k, v)
File "/opt/Plone-3.0.1/zeocluster/client1/Products/PlonePAS/sheet.py",
line 96, in setProperty
provider = self._getPropertyProviderForUser(user)
File "/opt/Plone-3.0.1/zeocluster/client1/Products/PlonePAS/sheet.py",
line 118, in _getPropertyProviderForUser
portal = getUtility(ISiteRoot)
File "/opt/Plone-3.0.1/lib/python/zope/component/_api.py", line 207, in
getUtility
raise ComponentLookupError(interface, name)
zope.component.interfaces.ComponentLookupError: (<InterfaceClass
Products.CMFCore.interfaces._content.ISiteRoot>, '')
The original code is run from a .zctl script scheduled with cron.
I've found this error in a few posts on the web but none seem to establish
the cause, just that it was fixed. Does someone have the time explain the
environment necessary for the getUtility() function to return without
throwing this exception? I must be missing something simple.
...jeff
--
View this message in context: http://www.nabble.com/Porting-user-sync-code-from-2.1.3%2C-get-Error-in-PAS-code-getUtility%28%29-tf4687452s20094.html#a13396490
Sent from the Product Developers mailing list archive at Nabble.com.
More information about the Product-Developers
mailing list