Re: Portal remote controller and CPS Image Field

Daniel de la Cuesta <[email protected]> Fri, 27 Nov 2009 08:29:55 +0000 (GMT)
Newsgroups gmane.comp.web.zope.cps.devel
Message-ID <[email protected]>
--===============1085773553==
Content-Type: multipart/alternative; boundary="0-862280259-1259310595=:30438"

--0-862280259-1259310595=:30438
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable

Hi,=0A=0A2. I have tried using pure Python code but I get the same exceptio=
n:=0A=0Axmlrpclib.Fault: <Fault -1: 'Unexpected Zope exception: exceptions.=
IndexError - list index out of range'>=0A=0A1. I have tried with a CPS File=
 field and the xmlrpc client doesn't return any exception, the object is cr=
eated and the binary assigned but when I try to see the new document in the=
 browser I get the following exception:=0A=0A=0AError Type:AttributeError =
=0AError Value:Binary instance has no attribute 'size' =0ATraceback:Traceba=
ck (innermost last):=0A=0A=0A=0A=0A=09*   Module ZPublisher.Publish, line 1=
15, in publish=0A=0A=0A=09*   Module ZPublisher.mapply, line 88, in mapply=
=0A=0A=0A=09*   Module ZPublisher.Publish, line 41, in call_object=0A=0A=0A=
=09*   Module Shared.DC.Scripts.Bindings, line 311, in __call__=0A=0A=0A=09=
*   Module Shared.DC.Scripts.Bindings, line 348, in _bindAndExec=0A=0A=0A=
=09*   Module Products.CMFCore.FSPageTemplate, line 195, in _exec=0A=0A=0A=
=09*   Module Products.CMFCore.FSPageTemplate, line 134, in pt_render=0A=0A=
=0A=09*   Module Products.PageTemplates.PageTemplate, line 104, in pt_rende=
r =0A=0A=0A=0A=0A=0A=0A=0A=0A________________________________=0A=0AI sugges=
t to try to simplify the problem to find where the problem is.=0A=0A1. Firs=
t could you please validate if creating a File field works=0Afor you? If th=
is works that could mean that the encoding of binary=0Adata is not the caus=
e of the problem.=0A=0A2. Another try would be to test the creation of your=
 document from pure=0APython code as is specified in the CPSRemoteControlle=
r doc:=0A=0A        from xmlrpclib import ServerProxy, Binary=0A        f =
=3D open('MyImage.png', 'r')=0A        binary =3D Binary(f.read())=0A      =
  p.createDocument('MySpecialZipFile',=0A        {'Title': "The report from=
 Monday meeting",=0A         'Description': "Another boring report"},=0A   =
      'file_name': "MyImage.png",=0A         'file_key': 'file_zip',=0A    =
     'file': binary,=0A         },=0A        'workspaces')=0A=0A=0AAnd plea=
se when having an error, could you please also send=0Athe stacktrace from t=
he server, as there should be one.=0A=0ACheers,=0A=0A-- =0AMarc-Aur=E8le DA=
RCHE=0AAFUL http://www.aful.org/=0AAssociation Francophone des Utilisateurs=
 de Logiciels Libres=0AFrench speaking Libre Software Users' Association=0A=
_______________________________________________=0Acps-devel mailing list=0A=
http://lists.nuxeo.com/mailman/listinfo/cps-devel=0A=0A=0A=0A      
--0-862280259-1259310595=:30438
Content-Type: text/html; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable

<html><head><style type=3D"text/css"><!-- DIV {margin:0px;} --></style></he=
ad><body><div style=3D"font-family:times new roman,new york,times,serif;fon=
t-size:12pt"><div>Hi,<br><br>2. I have tried using pure Python code but I g=
et the same exception:<br>=0A<br>=0Axmlrpclib.Fault: &lt;Fault -1: 'Unexpec=
ted Zope exception: exceptions.IndexError - list index out of range'&gt;<br=
>=0A<br>1. I have tried with a CPS File field and the xmlrpc client doesn't=
 return any exception, the object is created and the binary assigned but wh=
en I try to see the new document in the browser I get the following excepti=
on:<br><br><table width=3D"100%" cellpadding=3D"2" cellspacing=3D"2"><tbody=
><tr><th width=3D"10%">Error Type:</th>=0A        <td>AttributeError</td>=
=0A      </tr>=0A      <tr>=0A        <th>Error Value:</th>=0A        <td><=
pre>Binary instance has no attribute 'size'</pre></td>=0A      </tr>=0A    =
  <tr>=0A        <th>Traceback:</th>=0A        <td><pre><p>Traceback (inner=
most last):<br></p><ul><br><br><li>  Module ZPublisher.Publish, line 115, i=
n publish</li><br><br><li>  Module ZPublisher.mapply, line 88, in mapply</l=
i><br><br><li>  Module ZPublisher.Publish, line 41, in call_object</li><br>=
<br><li>  Module Shared.DC.Scripts.Bindings, line 311, in __call__</li><br>=
<br><li>  Module Shared.DC.Scripts.Bindings, line 348, in _bindAndExec</li>=
<br><br><li>  Module Products.CMFCore.FSPageTemplate, line 195, in _exec</l=
i><br><br><li>  Module Products.CMFCore.FSPageTemplate, line 134, in pt_ren=
der</li><br><br><li>  Module Products.PageTemplates.PageTemplate, line 104,=
 in pt_render</li></ul></pre></td></tr></tbody></table><br><br><br><br><br>=
</div><div style=3D"font-family: times new roman,new york,times,serif; font=
-size: 12pt;"><br><div style=3D"font-family: arial,helvetica,sans-serif; fo=
nt-size: 10pt;"><font size=3D"2" face=3D"Tahoma"><hr size=3D"1"><b><span st=
yle=3D"font-weight:
 bold;"></span></b></font><br>I suggest to try to simplify the problem to f=
ind where the problem is.<br><br>1. First could you please validate if crea=
ting a File field works<br>for you? If this works that could mean that the =
encoding of binary<br>data is not the cause of the problem.<br><br>2. Anoth=
er try would be to test the creation of your document from pure<br>Python c=
ode as is specified in the CPSRemoteController doc:<br><br>&nbsp; &nbsp; &n=
bsp; &nbsp; from xmlrpclib import ServerProxy, Binary<br>&nbsp; &nbsp; &nbs=
p; &nbsp; f =3D open('MyImage.png', 'r')<br>&nbsp; &nbsp; &nbsp; &nbsp; bin=
ary =3D Binary(f.read())<br>&nbsp; &nbsp; &nbsp; &nbsp; p.createDocument('M=
ySpecialZipFile',<br>&nbsp; &nbsp; &nbsp; &nbsp; {'Title': "The report from=
 Monday meeting",<br>&nbsp; &nbsp; &nbsp; &nbsp;  'Description': "Another b=
oring report"},<br>&nbsp; &nbsp; &nbsp; &nbsp;  'file_name': "MyImage.png",=
<br>&nbsp; &nbsp; &nbsp; &nbsp;  'file_key': 'file_zip',<br>&nbsp;
 &nbsp; &nbsp; &nbsp;  'file': binary,<br>&nbsp; &nbsp; &nbsp; &nbsp;  },<b=
r>&nbsp; &nbsp; &nbsp; &nbsp; 'workspaces')<br><br><br>And please when havi=
ng an error, could you please also send<br>the stacktrace from the server, =
as there should be one.<br><br>Cheers,<br><br>-- <br>Marc-Aur=E8le DARCHE<b=
r>AFUL <a href=3D"http://www.aful.org/" target=3D"_blank">http://www.aful.o=
rg/</a><br>Association Francophone des Utilisateurs de Logiciels Libres<br>=
French speaking Libre Software Users' Association<br>______________________=
_________________________<br>cps-devel mailing list<br><a href=3D"http://li=
sts.nuxeo.com/mailman/listinfo/cps-devel" target=3D"_blank">http://lists.nu=
xeo.com/mailman/listinfo/cps-devel</a><br></div></div>=0A<!-- cg11.c41.mail=
.ird.yahoo.com compressed/chunked Fri Nov 27 00:10:40 PST 2009 -->=0A</div>=
<br>=0A=0A=0A=0A      </body></html>
--0-862280259-1259310595=:30438--

--===============1085773553==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
cps-devel mailing list
http://lists.nuxeo.com/mailman/listinfo/cps-devel

--===============1085773553==--