[Zope] manage_addFile method

The Count the.count at count0.dyndns.org
Thu Nov 4 15:33:07 EST 2004


On Thu, 4 Nov 2004 15:07:06 -0500 (EST), Asad Habib 
<ahabib at engin.umich.edu> wrote:

> Hello. Is there a way to pass a variable for the id argument to
> manage_addFile? I want the user to be able to choose the id for a file
> that they wish to upload instead of hard-coding it in as a string 
> literal.

NEVER trust input passed through a form as being free of malicious or 
downright unluckily selected characters!
You can either choose the ID to be something generated randomly (write 
something to call thus : context.generate_a_random_id_for_me()),
or even pass the string the user intended and try to fix any illegal 
characters ... if you like ;-)
Problem with random IDs is - they might be taken so you can't even trust 
your own function - double-check!
[You might want to acquire the container for the Z-Object you're creating 
and use it's objectIds() list to do that]

Try passing your id-string as title, this field is for the elaborate 
stuff, id is just a handle - I'd just show it if no title is set.
[Z-Object.title_or_id()]
You can even have HTML in your titles ...

-- 
---
The Count  |  http://count0.dyndns.org/members/count0
# Programmers don't DIE - they just GOSUB without RETURN



More information about the Zope mailing list