Nancy Donnelly wrote:
That helped a lot! I yahoo'd (can't google any more since they've sold out to the 
interests gathering our personal data for Homeland Security) "put_factory" and 
got this code snippet:

if ext == 'dtml': from OFS.DTMLDocument import DTMLDocument return DTMLDocument( '', __name__=name ) would I rewrite that to change it into a page template?

Here's a more complete PUT_factory that I use:

from Products.PythonScripts.PythonScript import PythonScript
from Products.PageTemplates.ZopePageTemplate import ZopePageTemplate
from OFS.DTMLDocument import DTMLDocument
from OFS.Image import Image
from OFS.Image import File

def PUT_factory( self, name, typ, body ):

    # Gimme a PageTemplate or a PythonScript, but never DTML!
if typ=='text/x-python' or (body and body[0]=='#') or name.endswith('.py'):

        ob = PythonScript( name )

    elif typ.startswith('text') or name.endswith('.pt'):

        ob = ZopePageTemplate(name, body, content_type='text/html')

    elif typ.startswith('image/'):

        ob = Image(name, '', body, content_type=typ)


        ob = File(name, '', body, content_type=typ)

    return ob



Simplistix - Content Management, Zope & Python Consulting

Zope maillist  -
**   No cross posts or HTML encoding!  **
(Related lists - )

Reply via email to