[Zope] Inser image in atnews from pythonscript

trashman trashman at httconsulting.com
Fri Dec 29 11:13:17 EST 2006


Hi,
i must create newsitem with pythonscript. The source is a database.
I create object with metadata but i don't know how insert image with name 
lid+'jpg' located in the fs in /home/zope/images
Help!!!

The script is

# Import a standard function, and get the HTML request and response objects.
from Products.PythonScripts.standard import html_quote
request = container.REQUEST
RESPONSE =  request.RESPONSE

newss= context.lettura_news_id(collocation=1)

for l in newss:
   lid = l[1].replace(' ','-')
   container.invokeFactory('News Item', id=lid)
   container[lid].edit(title=l[5], description=l[6])
   container[lid].setText(l[7])
   datina = str(l[2]).replace('/','-')+ ' '+strstr(l[3])
   container[lid].setEffectiveDate(datina)
   container[lid].setSubject("Prima")

return "Created list"


Massimiliano 



More information about the Zope mailing list