[CMF-checkins] CVS: CMF/CMFDefault - MembershipTool.py:1.43

Casey Duncan casey at zope.com
Tue Feb 10 15:45:03 EST 2004


If you do this, you probably need to do aq_base(members) because
otherwise you might acquire an object named id from above (getitem
doesn't acquire). You'd then have to rewrap it. That makes it something
pretty like:

folder = getattr(aq_base(members), id).__of__(members)

8^)

I'm curious, what is the motivation behind this change. What folder in
existance doesn't support __getitem__? Frankly this seems a bit dubious.

-Casey

On Tue, 10 Feb 2004 15:07:58 -0500
Florent Guillaume <fg at nuxeo.com> wrote:

> Update of /cvs-repository/CMF/CMFDefault
> In directory cvs.zope.org:/tmp/cvs-serv21599
> 
> Modified Files:
> 	MembershipTool.py 
> Log Message:
> Always use getattr to access the home folder as a subobject of the
> members folder. This is more consistent and doesn't assume that the
> members folder has item-based access.
> 
> 
> === CMF/CMFDefault/MembershipTool.py 1.42 => 1.43 ===
> --- CMF/CMFDefault/MembershipTool.py:1.42	Sun Jan 11 07:59:01 2004
> +++ CMF/CMFDefault/MembershipTool.py	Tue Feb 10 15:07:57 2004
> @@ -276,12 +276,13 @@
>          members = self.getMembersFolder()
>          if members:
>              try:
> -                folder = members[id]
> +                folder = getattr(members, id)
>                  if verifyPermission and not _checkPermission(View,
>                  folder):
>                      # Don't return the folder if the user can't get
>                      # to it.
>                      return None
>                  return folder
> -            except KeyError: pass
> +            except AttributeError:
> +                pass
>          return None
>  
>      def getHomeUrl(self, id=None, verifyPermission=0):
> 
> 
> _______________________________________________
> CMF-checkins mailing list
> CMF-checkins at zope.org
> http://mail.zope.org/mailman/listinfo/cmf-checkins



More information about the CMF-checkins mailing list