[Zope] ZPhoto - A Beginner's question
CY
cyhoong at pc.jaring.my
Mon Sep 22 00:31:51 EDT 2003
My apologies to this simple question. I appreciate for some advice. TQ
I want to create a photo folder using DTML script. I am currently
using ZPhoto version 1.2.3.
How do I call to ZPhoto API using DTML?.
Error Message
===========
Cannot locate object at: http://lifebook:8080/Photo_Z/manage_addPhotoFolder
Add Photo Folder Form (taken from ZPhoto dtml script)
=================
<form action="manage_addPhotoFolder" method="POST"
enctype="multipart/form-data">
<table>
<tr>
<th align="right" class="form-label">Id:</th>
<td>
<input type="text" name="id" class="form-element">
</td>
</tr>
<tr>
<th align="right" class="form-label">Title:</th>
<td>
<input type="text" name="title" size="30" class="form-element">
</td>
</tr>
<tr>
<th class="form-label">Store:</th>
<td class="form-element">
<select name="store" class="form-element">
<option value="Image" selected>Image (ZODB)</option>
<option value="ExtImage">ExtImage (File System)</option>
</select>
</td>
</tr>
<tr>
<th class="form-label">Engine:</th>
<td class="form-element">
<select name="engine" class="form-element">
<option value="ImageMagick" selected>ImageMagick</option>
<option value="PIL">PIL</option>
</select>
</td>
</tr>
<tr>
<th align="right">Quality:</th>
<td>
<select name="quality:int" class="form-element">
<dtml-in expr="_.range(100)">
<option value="&dtml-sequence-number;"
<dtml-if "_['sequence-number'] == 75">selected</dtml-if>>
<dtml-var sequence-number>
</option>
</dtml-in>
</select>
</td>
</tr>
<tr>
<th align="right">Pregenerate Displays:</th>
<td>
<input type="checkbox" name="pregen:boolean" value="checkbox">
</td>
</tr>
<tr>
<th align="right">Display Cache Timeout:</th>
<td>
<input type="text" name="timeout" size="10" value="0">
minutes (0 = never)</td>
</tr>
<tr>
<th class="form-label"></th>
<td class="form-element">
<input type="checkbox" name="createsamples" value="1">
Create sample views.</td>
</tr>
<tr>
<td></td>
<td>
<input type="submit" value=" Add ">
</td>
</tr>
</table>
</form>
ZPhoto API
=========
manage_addPhotoFolderForm = DTMLFile('dtml/addPhotoFolderForm', globals())
def manage_addPhotoFolder(dispatcher, id, title, store='Image',
engine='ImageMagick', quality=75, pregen=0,
timeout=0,
createsamples=0, REQUEST=None):
"""Add Photo Folder object"""
dest = dispatcher.Destination()
dest._setObject(id, PhotoFolder(id, title, store, engine, quality,
pregen, timeout))
if createsamples:
self = dest._getOb(id)
sampleView = DTMLFile('dtml/sampleView', globals())
self.manage_addDTMLMethod('view', '')
self._getOb('view').manage_edit(sampleView, 'Sample View')
sampleFolderView = DTMLFile('dtml/sampleFolderView', globals())
self.manage_addDTMLMethod('index_html', '')
self._getOb('index_html').manage_edit(sampleFolderView, 'Sample
Folder View')
if REQUEST is not None:
try: url=dispatcher.DestinationURL()
except: url=REQUEST['URL1']
REQUEST.RESPONSE.redirect('%s/manage_main' % url)
return id
InitializeClass(PhotoFolder
More information about the Zope
mailing list