StructuredDocument editing via web form
Hello, I am hoping to use Maik Jablonski's StructuredDocument product to allow a client to edit structured text content portions of pages of their web site. I want my client to be able to use a simple web form to edit their content, and keep them out of the ZMI. I call a simple zpt web form on the StructuredDocument I want to edit. Current content of the StructuredDocument is displayed in an editable textarea and I can make whatever changes I want. What I am stuck on is getting the submission of the form to update the content of the StructuredDocument it is called on. I have just tried to do this with a Python script, the key line being: context.content = request.stx_content ...where stx_content is the name of the editable textarea in the form. I get this error: "attribute-less object (assign or del)"
From what I can find in list archives on this error, it sounds like maybe it's not possible to do what I want in a python script (due to script security restrictions I assume). Or, I'm referencing the content of the StructuredDocument object incorrectly. Or both... :-p
If I'm referencing wrong, what is correct? If python scripts aren't allowed to do this type of assignment, how can I go about it as simply as possible? thanks, John S. __________________________________ Do you Yahoo!? Yahoo! Finance Tax Center - File online. File on time. http://taxes.yahoo.com/filing.html
John Schinnerer wrote:
Hello,
I am hoping to use Maik Jablonski's StructuredDocument product to allow a client to edit structured text content portions of pages of their web site. I want my client to be able to use a simple web form to edit their content, and keep them out of the ZMI.
I call a simple zpt web form on the StructuredDocument I want to edit. Current content of the StructuredDocument is displayed in an editable textarea and I can make whatever changes I want.
What I am stuck on is getting the submission of the form to update the content of the StructuredDocument it is called on.
I have just tried to do this with a Python script, the key line being:
context.content = request.stx_content
...where stx_content is the name of the editable textarea in the form.
You can't assign values directly to attributes in PythonScripts. You need to go with the API. StructuredDocument implements the DTMLMethod/Document-API, so you can use: context.manage_edit(request.stx_content, context.title) Cheers, Maik
Hello, Maik answered my previous question so well and quickly that I have another already... Now I am programmatically creating/adding a folderish product object (based on mxmObjectManager). I also want to create programmatically, *inside* the folderish object, several StructuredDocuments. I tried this: def manage_addAction(): mxmObjectManager.addClass() StructuredDocument.manage_addStructuredDocument() This does add a Structured Document, but it is created alongside the folderish object instead of inside it. How do I get the StructuredDocument to be created inside the folderish object I have just added? thanks, John S. __________________________________ Do you Yahoo!? Yahoo! Finance Tax Center - File online. File on time. http://taxes.yahoo.com/filing.html
Hello, I said:
I also want to create programmatically, *inside* the folderish object, several StructuredDocuments.
So after much poking about...this works to add multiple StructuredDocument objects *inside* the folderish object being added first: def manage_addAction(...): mxmObjectManager.addClass(...) newObjId = getattr(self,id) newObjId.manage_addProduct['StructuredDocument'].StructuredDocument.manage_addStructuredDocument('STXdocOne',...) newObjId.manage_addProduct['StructuredDocument'].StructuredDocument.manage_addStructuredDocument('STXdocTwo',...) ... and so on. If that could be cleaner and/or simpler I'd love to hear about it. thx, John S.
I tried this:
def manage_addAction(): mxmObjectManager.addClass() StructuredDocument.manage_addStructuredDocument()
This does add a Structured Document, but it is created alongside the folderish object instead of inside it.
How do I get the StructuredDocument to be created inside the folderish object I have just added?
__________________________________ Do you Yahoo!? Yahoo! Finance Tax Center - File online. File on time. http://taxes.yahoo.com/filing.html
participants (2)
-
John Schinnerer -
Maik Jablonski