[Zope] add product question

dean hale dean.hale@sunderland.ac.uk
Wed, 28 May 2003 10:16:10 +0100


Hi

Can anyone offer any advice please as i cannot figure it out at all.

Currently we have a form which allows the user to upload images creates 
a DTMLDocument called PageText and it also creates a folder to store 
them in, all in one go.

I have created a simple product and zclass based on DTMLDocument called 
OnlineEdit which does a little extra so would rather use this than the 
DTMLDocument we currently use, however i cannot figure out what to use 
to add it, below may make more sense than above

currently we use below

newfolder.manage_addDTMLDocument('PageText','PageText',data)

and i have been trying to call the zclass i did

newfolder.manage_addOnlineEdit('PageText','PageText',data)

however receive the error

ErrorType: AttributeError
ErrorValue: online Editor

sorry for the thickness and i hope it makes sense.

here is the full script if it's of any use

-------------

import string,re,os

def clonetemplate(self,REQUEST):
     file = REQUEST['file']
     id = string.lower(REQUEST['title'])
     newid = string.replace(id,' ','_')
     ob = self.web_template
     newfolder = self.manage_clone(ob,newid)
     setprops(newfolder,REQUEST)
     data = gethtml(file)
     newfolder.manage_addDTMLDocument('PageText','PageText',data)
     if REQUEST['img1'].filename <> '':
         addimages(newfolder,REQUEST)
     if REQUEST is not None:
         try: parent = self.DestinationURL()
         except: parent=REQUEST['URL1']
         REQUEST.RESPONSE.redirect(parent+'/manage_main?update_menu=1')
     return ''

def gethtml(file):
     htmldata = file.read()
     htmldata = re.sub('.*<body(.*?)>(?i)(?s)', '', htmldata)
     htmldata = re.sub('</body(.*?)>.*(?i)(?s)', '', htmldata)

thanks
dean



-- 

Dean Hale
Information Services

Web Development Manager
0191 515 2424