<div dir="ltr">Hi Dieter,<br><br>Where is the &#39;manage_upload&#39; function documented?<br><br>The problem that I had with manage_addFile seems to because I passed it a unicode object rather than a string. The error message was &quot;<strong>&#39;unicode&#39; object has no attribute &#39;seek&#39;</strong>&quot; which led me to think a file-like object was needed.<br>
<br>Thanks,<br><br>Jakob<br><br><div class="gmail_quote">2008/9/2 Dieter Maurer <span dir="ltr">&lt;<a href="mailto:dieter@handshake.de">dieter@handshake.de</a>&gt;</span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Jakob Schou Jensen wrote at 2008-9-2 09:25 +0200:<br>
<div class="Ih2E3d">&gt;By file object I meant the &quot;OFS.Image.File&quot; kind. I had two problems<br>
&gt;creating and modifying the file (at least). The first was that the<br>
&gt;manage_addFile() function that you mention seemed to insist on a os-file<br>
&gt;like object for the &quot;file&quot; parameter.<br>
<br>
</div>It is ready to accept a string or a &quot;file&quot; like object<br>
(usually, it gets a &quot;ZPublisher.HTTPRequest.FileUpload&quot; instance).<br>
<div class="Ih2E3d"><br>
&gt;Appart from that I got a security error when I called the File.update_data()<br>
&gt;function.<br>
<br>
</div>This is internal. The corresponding &quot;official&quot; method<br>
is &quot;manage_upload&quot;.<br>
<br>
&gt; ...<br>
<div class="Ih2E3d">&gt;Well ... it works ... there may be a simpler way as you suggest. If you have<br>
&gt;some sample code I would like to see it. I am using zope 2.4.something.<br>
<br>
</div>In an interactive Python session (under *nix: &quot;bin/zopectl debug&quot;):<br>
<br>
&gt;&gt;&gt; app.manage_addProduct[&#39;OFSP&#39;].manage_addFile(&#39;test_file&#39;, &#39;test_content&#39;)<br>
&gt;&gt;&gt; tf=app.test_file<br>
&gt;&gt;&gt; str(tf)<br>
&#39;test_content&#39;<br>
<br>
The example shows you, that a string is accepted as &quot;file&quot; value.<br>
<br>
<br>
<br>
--<br>
<font color="#888888">Dieter<br>
</font></blockquote></div><br></div>