[Grok-dev] file upload in a schema
David Marceau
uticdmarceau2007 at yahoo.ca
Thu Apr 15 16:35:36 EDT 2010
To Mr. Faassen and all the other Grok developers,
I just want to say I appreciate all the work you have placed into grok.
It's all good stuff and it does merit more attention.
OBSERVATION
------------
I must say, there are different recipes for installing grok at different
locations which perhaps need to be consolidated:
1)on launchpad there's a recipe to install grok which shows one way. I
followed it and it didn't work. I wasted time on this and gave me a
poor lasting first impression.
2)on grok.zope.org, there is a more elaborate recipe explaining
python2.5 dependencies which worked, but suprisingly broke my ubuntu
9.10 synaptic package installing. Even worse, I didn't realize it until
it was too late. I had to go search the web for kludge fix for this and
the least pain was to just cp /usr/bin/python2.6 /usr/bin/python as I
mentioned before. The stuff mentioning about config alternatives python
still breaks ubuntu packages. I had 3 different versions of python
installed for a while with the alternatives config pointing to
python2.5, but it broke ubuntu. When I tried getting it back to point to
python2.6, ubuntu 9.10 still complained.
>From where I stand, all docs should be pointing to grok.zope.org and no
recipes should be documented at launchpad. It only adds to the confusion.
QUESTION
-----------
I have a question. How do I add a file upload object as part of a
schema for an interface?
I'm trying to do the following interface, but grok/python complain about
the file_data variable:
class IAnomosTorrent(interface.Interface):
title =
schema.TextLine(title=u'Title',required=True,constraint=check_title)
kind = schema.Choice(title=u'Kind of
anomostorrent',values=['music','movie','ebook','game','operatingsystem','application'])
description = schema.Text(title=u'Description',required=False)
#file_data = zope.app.file.interfaces.IFile
next_id = schema.Int(title=u'Next id',default=0)
I was hoping to have all of these fields appear in one web page properly
using your famous line of code:
form_fields = grok.AutoFields(IAnomosTorrent).omit('next_id')
Technically, if I understand correctly it would be a multi-part form
with one part for some fields for the text lines fields and other parts
for attached files. I'm sure you have a solution for this already.
Thank you for listening.
Cheers
More information about the Grok-dev
mailing list