[Zope] Python get LocalFS objects in subfolder
Michael Bleijerveld
michael at bleijerveld.nl
Tue Aug 12 18:04:09 EDT 2003
Thanks Paul.
It works perfectly.
Michael
----- Original Message -----
From: "Paul Winkler" <pw_lists at slinkp.com>
To: <zope at zope.org>
Sent: Tuesday, August 12, 2003 4:40 PM
Subject: Re: [Zope] Python get LocalFS objects in subfolder
> On Tue, Aug 12, 2003 at 03:15:40PM +0200, Michael Bleijerveld wrote:
> > Hi all,
> >
> > I am trying to get the fileValues in a LocalFS subfolder with the name
admin
> > but the following statements don't work.
> >
> > from AccessControl import getSecurityManager
> > user = getSecurityManager().getUser()
> > username = user.getUserName()
> >
> > return 'container.%s.fileValues()' % username
> >
> > The result is container.admin.fileValues()
>
> well, sure... you built a string and returned it; the string
> happens to resemble python code but that doesn't mean it
> magically gets interpreted ;-)
>
> > but is has to be [<LocalFile
> > instance at 018A0210>, <LocalFile instance at 0189F720>].
> >
> > Anyone suggestions ?
>
> you might try:
>
> return container[username].fileValues()
>
> or maybe
>
> u = getattr(container, username)
> return u.fileValues()
>
> --
>
> Paul Winkler
> http://www.slinkp.com
>
>
> _______________________________________________
> Zope maillist - Zope at zope.org
> http://mail.zope.org/mailman/listinfo/zope
> ** No cross posts or HTML encoding! **
> (Related lists -
> http://mail.zope.org/mailman/listinfo/zope-announce
> http://mail.zope.org/mailman/listinfo/zope-dev )
>
>
More information about the Zope
mailing list