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() but is has to be [<LocalFile instance at 018A0210>, <LocalFile instance at 0189F720>]. Anyone suggestions ? Thanks in advance. Michael Bleijerveld
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
Thanks Paul. It works perfectly. Michael ----- Original Message ----- From: "Paul Winkler" <pw_lists@slinkp.com> To: <zope@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@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 )
participants (2)
-
Michael Bleijerveld -
Paul Winkler