[Zope] StructuredDocument PUT_factory problem
John Hunter
jdhunter@ace.bsd.uchicago.edu
Wed, 21 Aug 2002 09:37:12 -0500
I have a folder where I want to create StructuredDocuments via
ange-ftp using emacs. I wrote a PUT_Factory external method to make
StructuredDocument the default for text/plain or text/html PUTs, but I
am getting an error when I try the constructor. I have added some
extra stuff to see what is getting passed to the put factory, which
I'll include below
def PUT_factory( self, name, typ, body ):
"""
Override the default PUT method to make STX page the
default type for ftp uploads
"""
from Products.StructuredDocument import StructuredDocument
h = open('/home/jdhunter/tmp/zope.out', 'w')
h.write('name = %s, typ= %s, \nbody = %s\n' % (name, typ, body))
if typ == 'text/plain' or typ=='text/html':
try:
ob = StructuredDocument( body, __name__=name )
except:
h.write('Could not create STX')
ob = None
return ob
return None
Here is the output file ~/tmp/zope.out. Any idea why my PUT_Factory
is failing?
name = test3, typ= text/html,
body = Structured Text - Introduction
Structured text uses indentation and simple symbology
to indicate the structure of a document.
Elements of a Structured Text
|-------------------------------------------|
| A simple sample Table |
|===========================================|
| *emphasized* | **strong** | _underlined_ |
|-------------------------------------------|
| "Link to ZOPE":http://www.zope.org/ |
|-------------------------------------------|
Text enclosed in brackets [footnote] is treated as
hyperlinks within the document.
Three types of lists
- Unordered lists with '-', '*', or 'o'
1 Ordered lists with digits
Description -- A paragraph with a first line that
contains some text, followed by some white-space
and '--' is treated as a descriptive list element.
Example code
Sub-paragraphs of a paragraph that ends in '::' is treated as example code::
<html>...</html>
.. [footnote] Here is the footnoote.
Could not create STX