[Zope3-checkins]
SVN: Zope3/trunk/src/zope/app/security/browser/auth.py
Worked around the multiple user source bug.
Shane Hathaway
shane at zope.com
Wed Nov 24 03:18:09 EST 2004
Log message for revision 28495:
Worked around the multiple user source bug.
When there is more than one principal source, @@grant.html displays a
search field for each source. The submitted form then has two values
for the search field and the publisher interprets the multiple values as
a list. The principal search machinery breaks when it gets passed a
list as a search string. Workaround: concatenate the list elements to
form a string. Not a solution because we still get two fields on the
page that look exactly alike--very confusing.
The proper solution is probably to change SourceInputWidget to find a
single widget that will suffice for all sources. That's Jim's decision,
though.
Changed:
U Zope3/trunk/src/zope/app/security/browser/auth.py
-=-
Modified: Zope3/trunk/src/zope/app/security/browser/auth.py
===================================================================
--- Zope3/trunk/src/zope/app/security/browser/auth.py 2004-11-24 06:14:30 UTC (rev 28494)
+++ Zope3/trunk/src/zope/app/security/browser/auth.py 2004-11-24 08:18:07 UTC (rev 28495)
@@ -55,6 +55,14 @@
if not (name+'.search' in self.request):
return None
searchstring = self.request[name+'.searchstring']
+ if isinstance(searchstring, list):
+ # Interpret as a string.
+ # XXX This is a workaround for the fact that
+ # SourceInputWidget generates a separate input field for
+ # each principal source, so when there are multiple
+ # sources, we get multiple fields that usually look
+ # exactly the same. Something needs to be redesigned.
+ searchstring = ' '.join(searchstring).strip()
return [principal.id
for principal in self.context.getPrincipals(searchstring)]
More information about the Zope3-Checkins
mailing list