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
dean hale wrote at 2003-5-28 10:16 +0100:
... 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
... 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.
The standard way to create an object looks like: destination.manage_addProduct[name_of_your_product].constructor(args) When you checked the "add constructors" during ZClass construction, then two "constructors" have been generated for you: a form and the associated action. "constructor" above is the "action". Modern Zope versions generate a Python Script. You can then easily determine what parameters must be passed in. Dieter
participants (2)
-
dean hale -
Dieter Maurer