Creating Page Templates using XML-RPC
Hi, I'm assisting another programmer who's using Zope to create a new version of our website. I need to create about 3000 relatively static pages (the actual content is static, at least for a few months, until the next time I update the pages; the content is surrounded by a header, a footer, and a sidebar which may change depending upon news announcements). I'm new to Zope and just want to create the pages and then get out of the other programmer's way. For our old site I wrote a Python script that creates these 3000 pages and use SSIs to pull in a header and footer. I can do the same thing for the new site by using macros to pull in Zope page elements. However, I'm a bit confused as to how to do this. My questions: * 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? * If the previous is true, how do I create Page Templates programmatically? It seems XML-RPC can work for me, but I can't find an API to create Templates. Does one exist, or should I be using a different method? Thanks for any assistance, GL __________________________________________________ Do you Yahoo!? Yahoo! Mail Plus - Powerful. Affordable. Sign up now. http://mailplus.yahoo.com
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
participants (2)
-
Dieter Maurer -
Gordon Lai