[Zope] uploading page templates?
Charlie Reiman
creiman@kefta.com
Fri, 17 Jan 2003 14:00:04 -0800
> -----Original Message-----
> From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of
> Andrew Altepeter
> Sent: Friday, January 17, 2003 1:48 PM
> To: Dieter Maurer
> Cc: zope@zope.org
> Subject: Re: [Zope] uploading page templates?
>
>
> > > These html documents are really page templates. I have read
> in the Zope
> > > Book that the only way to upload page templates in Zope 2.6
> is to first
> > > go into the ZMI and add a page template, then using your ftp program,
> > > upload to /zope/path/page_template/source.html.
> > This is true only for a plain vanilla installation.
> >
> > When you install a so called PUTFactory, you can create whatever
> > type of object your PUTFactory is able to.
> >
> > There is a HowTo on Zope.org.
>
> This would be a HUGE help...only problem: doing a search on zope.org
> doesn't yield any relevant results for PUTFactory...do you have an url
> for me?
He means PUT_factory.
http://www.zope.org/Wikis/DevSite/Proposals/HookablePUTCreation
Mine for ZPT & ZSQL methods is below:
# Implement the "hookable PUT" hook.
import re, Products.PageTemplates.ZopePageTemplate
import Products.ZSQLMethods.SQL
import sys
TEXT_PATTERN = re.compile( r'^text/.*$' )
ZSQL_PATTERN = re.compile( r'<params>([^<]+)</params>(.*)', re.DOTALL )
# New behaviors:
# Support for ftp put of ZSQL methods (sorta). Connection ID is hardcoded.
def PUT_factory( self, name, typ, body ):
"""
"""
if TEXT_PATTERN.match( typ ):
grps = ZSQL_PATTERN.match(body)
if grps:
return Products.ZSQLMethods.SQL.SQL(name, '',
'Oracle_database_connection', grps.group(1),
grps.group(2))
else:
return
Products.PageTemplates.ZopePageTemplate.ZopePageTemplate(name,'','text/html'
)
return None