[Zope] Re: How to Add a File Dynamically??--manage_clone ERROR
Tue, 20 May 2003 22:24:06 +0530
Hi Josef ,
Thanks for yopur prompt reply . I am tryiong to resolve my problem but
getting stuck again.Please help me out here.
I am trying to use manage_clone to add a python script into a folder .
I am adding a new folder intot the Zope directory Structure and then taking
the context of the newly added Flder and adding a Python Script into it
.This is similar to what Zope does when adding a folder and adding a Page
template(index_html) into it.
#My Python file which I am adding as an External Method in
#from OFS import CopyContainer.manage_clone
from App.Common import *
from Globals import REPLACEABLE, NOT_REPLACEABLE, UNIQUE
ob=folderObj._getOb(id) #getting the context of the folder
if(strName != ''):
ob.CopyContainer.manage_clone(cloneObj,strName) #I am cloning
cloneObj and giving it a new name
#This is the Error I get on trying to add a Clone
Error Type: ImportError
Error Value: No module named CopyContainer
#My Python Script
#I first add a folder
#I then clone a Python Script into the Folder
result = context.sis.Public.add_fol_sep(context
#add_fol_sep is an External MEthod that ads a file into the current context
(which is a folder in the Zope Directory Structure)
#this is my call to External Python Script --------obj_Clone_Sep.py
If I try to add a Python file without importing the OFS Module I am asked
to login to the ZMI for accessing the manage_clone method .This is happening
inspite of my using External Methods.
Where am I going wrong??
Thanks and Best regards
----- Original Message -----
From: "Josef Meile" <email@example.com>
Sent: Monday, May 19, 2003 10:21 PM
Subject: [Zope] Re: How to Add a File Dynamically??
: > While adding a new folder I would like to add 3 files by default into
: > folder (like when i add a folder object through ZMI)
: > 1) index_html - (Page Template)
: > 2) tree.py - (Python Script)
: > 3) getPath.zsql - (ZSQL Method)
: I did it for a DTMLMethod, but I think it is similar to the other cases.
: my case, I just created an external method with this:
: from OFS import DTMLMethod
: def createMethod(folderObj, id, title, text):
: # Creates a dtml Method
: #Gets a reference to the created object
: #Changes the contents of the created object
: You just have to look at the html source code of the Zope's manage
: interface and see what methods are called when creating/editing a
: python script, page template and a ZSQL Method. Then, you have
: to search the implementation of this methods to see what parameters
: you need and which packages you have to import.
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.483 / Virus Database: 279 - Release Date: 5/19/2003