Please don't cross-post (python list removed) On Thursday 05 September 2002 04:38 am, michael.taƱag wrote:
Hi!
I'm uploading a file to a particular folder in Zope using a form. For example I need to upload celebrants.txt to 2002/august/birthday so what I did (from a script by runyaga- thanks!)
context.2002.august.birthday.manage_addFile()
1. error when I use '2002' so I changed it to 'yr2002' (why can't I use '2002'?) code now becomes
context.yr2002.august.birthday.manage_addFile()
Although '2002' is a legal Zope id, it is not a legal identifier in Python. Identifiers must start with a letter. To get around this, use the getitem notation: context['2002'].august.blah.blah
2. The month and year are hard coded. What if I want it to be supplied by the user. So my idea is to use a variable. for example month = month_value year = year_value
code becomes context.year.month.birthday.manage_addFile()
for example if month_value is september and year is yr2002 code should read context.yr2002.september.birthday.manage_addFile()
but this produces an error. I think python sees year and month as folder names.
Same thing, use the getitem notation: context[year][month].birthday.manage_addFile() Where year and month are variables. hth, -Casey