[Zope3-checkins] SVN:
Zope3/trunk/src/zope/app/security/browser/auth.py
Worked around the multiple user source bug.
Jim Fulton
jim at zope.com
Wed Nov 24 09:18:25 EST 2004
Shane Hathaway wrote:
> 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.
That's impossible. The bug is that the field names aren't being
generated correctly. Each search form should have a prefix for it's
field names. It sounds like the prefix is being ignored.
Please back out this change. I don't want work-arounds getting
checked in, as they tend to become mysterious fossils.
If you are up for fixing this, we could discuss the fix. Otherwise,
please submit a collector issue.
Jim
>
>
> 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)]
>
>
> _______________________________________________
> Zope3-Checkins mailing list
> Zope3-Checkins at zope.org
> http://mail.zope.org/mailman/listinfo/zope3-checkins
--
Jim Fulton mailto:jim at zope.com Python Powered!
CTO (540) 361-1714 http://www.python.org
Zope Corporation http://www.zope.com http://www.zope.org
More information about the Zope3-Checkins
mailing list