Python script returning link to local file
Hi, I want to use a Python script for returning a link to a local file (in a LocalFS object) in ZPT. The parameter given is the id of the file and is named file. from AccessControl import getSecurityManager user = getSecurityManager().getUser() username = user.getUserName() return container[username].[file] This doesn't work. Is it a reference problem ? Regards, Michael
On Tue, Aug 12, 2003 at 07:22:54PM +0200, Michael Bleijerveld wrote: | Hi, | | I want to use a Python script for returning a link to a local file (in a | LocalFS object) in ZPT. | The parameter given is the id of the file and is named file. | | from AccessControl import getSecurityManager | user = getSecurityManager().getUser() | username = user.getUserName() | | return container[username].[file] ^^ | This doesn't work. Is it a reference problem ? The above is a syntax error. You probably meant to write return container[username][file] (no '.'), but I can't say for certain because I don't have experience with LocalFS. -D -- Do not be afraid of those who kill the body but cannot kill the soul. Rather be afraid of the One who can destroy both soul and body in hell. Matthew 10:28 http://dman13.dyndns.org/~dman/
Hi Derrick, It doesn't return a link to the (LocalFS) file. Greetings. Michael ----- Original Message ----- From: "Derrick 'dman' Hudson" <dman@dman13.dyndns.org> To: <zope@zope.org> Sent: Tuesday, August 12, 2003 10:56 PM Subject: [Zope] Re: Python script returning link to local file
_______________________________________________ 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 )
Michael Bleijerveld wrote at 2003-8-13 09:58 +0200:
It doesn't return a link to the (LocalFS) file.
You do not tell it to return a link. You tell it to return the object itself. When you want to return the URL, use an objects "absolute_url" method. When a link is something else (for you), construct it (almost surely from "absolute_url"). Dieter
participants (3)
-
Derrick 'dman' Hudson -
Dieter Maurer -
Michael Bleijerveld