[Zope] change textfile

Bjørge Solli Bjørge Solli
Wed, 24 Jul 2002 15:40:45 +0200 (CEST)


context.manage_addFile(id)
getattr(context,id).manage_edit(title, 'text/html', filedata=data)

I tried it, and got this error:

Error Value: manage_edit() got an unexpected keyword argument 'filedata'

I looked at DTMLMethod.py:

 def manage_edit(self,data,title,SUBMIT='Change',dtpref_cols='50',
                    dtpref_rows='20',REQUEST=None):
        """
        Replaces a Documents contents with Data, Title with Title.

And I looked at Image.py(which I think is the one I use):

 def manage_edit(self, title, content_type, precondition='', 
                                                  REQUEST=None):

But that is wrong?

Am I using the wrong method?

> I suggest you install DocFinderEverywhere
> <http://www.zope.org/Members/shh/DocFinderEverywhere>
Well, I'm not root, but I'll ask for it when he comes back from his 
vacation on monday...

regards
Bjorge

On Wed, 24 Jul 2002, Stefan H. Holek wrote:

> 
> You will then be easily able to find out that File's manage_edit takes the 
> following parameters:
> 
> self, title, content_type, precondition='', filedata=None, REQUEST=None
> 
> Your call should thus look something like (untested):
> yourfile.manage_edit('yourtitle', 'text/html', filedata='yourdata')
> 
> HTH,
> Stefan
> 
> 
> --On Mittwoch, 24. Juli 2002 12:58 +0200 Bjørge Solli <bjorge@ii.uib.no> 
> wrote:
> 
> > I am trying to make and change a textfile.
> >
> > I'm trying to do it this way:
> > context.manage_addFile(id)
> > getattr(context,id).manage_edit(title,data)
> >
> > This sets content_type(Property) to the value of data. I want to put the
> > contents of data INTO the file, and have content_type to be text/html.
> >
> > Any suggestions?
> >
> > Thanks in advance.
> > regards
> > Bjorge
> > --
> --
> Those who write software only for pay should go hurt some other field.
> /Erik Naggum/
> 

-- 
http://www.lstud.ii.uib.no/~s0182/smile/Smiles
--
Bjørge Solli - Universitas Bergensis, Norway
mailto:Bjorge@Kvarteret.no icq#29210281 MSN:bobelloco@hotmail.com
Møllendalsv.19, 5009 Bergen, Norway tel:55202853/91614343