[Zope] Adding Photo programmatically

Nicholas Piper pcomm@inorbit.com
Sun, 30 Jan 2000 19:47:04 +0000


ed,

On Sun, 30 Jan 2000, ed colmar wrote:

> def addImage(obj,id,file):
>     f=open('%s\Products\%s' % (SOFTWARE_HOME,file),'rb')
> 
>     contents=f.read()
>     f.close()
>     title=''
>     tlen = len(contents)
>     new_id = obj.manage_addImage(id,contents,title=title)
>     img_obj = obj.__getitem__(new_id)
>     img_obj.content_type = 'image/gif'
> 
> 
> 
> then to call it:
> 
>         addImage(curr_folder, 'mylogo','root/Images/mylogo.gif')

Yes, this works.

However, other classes don't seem to be in the same namespace
as manage_addImage. For example, in Products/*/*.py I see
things defined at "top level" such as 
def manage_addZCatalog(self,id,title,REQUEST=None):
and def manage_addPhoto(self, id, file, tit....

Where are these ? How can I call these from an External Method ?

-- 
<pcomm@inorbit.com>           <http://www.innotts.co.uk/~nicholas/>
2048/BEC44395 1999/08/02 Nicholas C. Piper <nicholas@innotts.co.uk>
If you want to change the automatic PGP actions of my mailer, see;
http://www.innotts.co.uk/~nicholas/Personal/personal.php3?page=pgp