[Zope] Python get LocalFS objects in subfolder
Paul Winkler
pw_lists at slinkp.com
Tue Aug 12 11:40:29 EDT 2003
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
More information about the Zope
mailing list