Attempt to find user folder even if the context is not able to acquire it

git-svn-id: http://svn.plone.org/svn/plone/plone.principalsource/trunk@26129 3b4cdb85-528f-c531-b63d-5919d5b1aa08
This commit is contained in:
optilude 2009-03-25 04:36:10 +00:00
parent dd1fa6c1eb
commit 455db3f91f
1 changed files with 10 additions and 2 deletions

View File

@ -1,7 +1,11 @@
from zope.interface import implements
from z3c.formwidget.query.interfaces import IQuerySource
from zope.app.component.hooks import getSite
from zope.schema.interfaces import IContextSourceBinder
from z3c.formwidget.query.interfaces import IQuerySource
from plone.principalsource.term import PrincipalTerm
from Products.CMFCore.utils import getToolByName
class PrincipalSource(object):
@ -27,7 +31,11 @@ class PrincipalSource(object):
if not self.users and not self.groups:
raise ValueError(u"You must enable either users or groups")
self.acl_users = getToolByName(context, 'acl_users')
self.acl_users = getToolByName(context, 'acl_users', None)
if self.acl_users is None:
site = getSite()
if site is not None:
self.acl_users = getToolByName(site, 'acl_users', None)
def __contains__(self, value):
try: