Jean Revertera a écrit :
Hi everbody,

Okay, first, just to introduce myself, I started learning zope for 2 weeks
nows in the frame of a very small project I have to do. I've read several
documentations, including the first chapters of the Zope book, but i still
have difficulties to get started... I tried for days and i sligthly get
desperated, so your help would be very gratefully appreciated

So I want to make a really simple app:
- A (ZPT) page with a upload form.
- This form would be managed via a python script.
- A operation would be performed on the uploaded file.
- The so-modified file has to be displayed back to the user.
That's it...

So far:
- I've create a now folder at the root of the ZMI.
- I've upragaded it into a site.
- And I've added a new ZPT page with my HTML form in the content view.

But from this point I already got problem with the python script.
I know it seems a realy basic question but...
How should I add into the ZMI a new py script?
At first, I simply expected to have a corresponding choice in the "Add
wizard" from my default package... But the nearest thing i've found it's
just a "generic" file, to wich a add the x-python content type.
It is the correct thing to do?

Once I've successfuly added my script, let's call it "", I
just have to write something like:
<form action="processForm">
In my ZPT page... Right?

you're trying to do things the Zope2 way. Zope3 is not well suited to this development pattern, and it's even not used anymore on Zope2. There is no problem adding a folder through the zmi, since this is not some development action, but a content management action.

But your upload form shoud be seen as a « view » for this (or any) folder.
And writing an upload form is no more a content management action, but a development action. So you have to write a class (derived from BrowserPage) that will be used to link the html template to the content class (the folder). This should be done on the filesystem, not in the zmi.(in the lib/python/<youpackage> folder of you instance) Then write a ZPT template (still filesystem-based), and register the view with a (filesystem based) ZCML file.

To perform an operation on the uploaded file, you should just write (and register) an event subscriber (to IObjectAddedEvent). This can be as simple as a single function.

To display back the file (I mean a link to the file) to the user, you should write another view for the folder (and its associated zpt template).

You should probably consider trying Grok, since it can be easier to begin with than plain zope3. Another really good idea is to buy Philipp's book ( ), you will save days of headache.


All comments/suggestions are welcome
Thank you (and sorry for my poor english :-/)
Zope3-users mailing list

Zope3-users mailing list

Reply via email to