ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> zope-List
zope-List
Re: [Zope] Creating Page Templates using XML-RPC
by Dieter Maurer other posts by this author
Jan 1 2003 7:34PM messages near this date
[Zope] Creating Page Templates using XML-RPC | RE: [Zope] Change current path in External Method
Gordon Lai wrote at 2002-12-30 14:36 -0800:
 >  * In looking through our site using the Zope manage
 >  interface, it seems as though every page is
 >  represented by a Page Template. Is this true? Do I
 >  need to create 3000 Page Templates?
You can use Page Templates to do this but you do not need to.

You may look at the CMF to see how to separate content (Document, File) from
presentation (Page Template).

 >  * If the previous is true, how do I create Page
 >  Templates programmatically?
You use its constructor. This usually takes the form of

    ObjectManager.manage_addProduct[ProductName].ObjectConstructor(Arguments)

"ObjectManager" is the destination container (usually a folder),
"ProductName" is the product that defines the object class
("PageTemplates", in your case),
"ObjectConstructor" is the method constructing the instance
("manage_addPageTemplate", in your case),
"Arguments" are the arguments the constructor needs
("id,title,text", in your case, with "title" and "text" optional).

 >  It seems XML-RPC can work
It is probably easier to use a wrapper.

But you can use XML-RPC directly. You would use the URL:

    URL_to_ObjectManager/manage_addProduct/ProductName

and call "ObjectConstructor" with the necessary arguments.
You will probably get a 302 response (this is a redirect response)
because Zope will make a redirect to the management page.
XML-RPC might convert this into an exception.

That's one reason why a wrapper is better.

 >  for me, but I can't find an API to create Templates.
 >  Does one exist, or should I be using a different
 >  method?
The most elegant way would be to go for CMF (but, you would
need some time to get acquainted with CMF), because of the
clear separation of content and presentation.

An alternative to CMF/PageTemplates retaining the separation
of content/presentation would be to use "File" objects either

  *  presented via a PageTemplate (e.g. "File/view")

  *  or with an overridden "index_html".

An alternative to XML-RPC would be to use FTP/WebDAV together with
a so called "PUT_factory" (HowTo in zope.org).



Dieter

_______________________________________________
Zope maillist  -  Zope@[...].org
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )
Thread:
Gordon Lai
Dieter Maurer

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved