28 Jan 2005 lgs   » (Master)

Gazpacho

Today I released 0.4.0 of Gazpacho and as always I forgot to do something. This time it was the announce text, I forgot to put a description about Gazpacho and some people asked me to do so. Sorry, I won't forget next time.

This release has a lot of new features thanks to the bunch of people who got interested in Gazpacho and who helped me with it.

I'll try to fix Menu Toolbar problems and make it rock solid for 0.5, which hopefullly will be next week. Btw, we are going to start using Gazpacho next week for real purposes so I expect bugs coming all over the places. I'm really scaried :-)

Plone

Today, I learned how to customize a Plone site so in one of the folders you can put a special page to show some information dinamically.

In my case I wanted to show the list of Plone sites that were running in our server. All this plone objects live under the folder 'sitios'. So let's go with the recipe:

  1. Write a Python script to get the list of plone objects and put it in the folder you want to use as the section for this dinamic page. Ours is called Asociaciones:
    resultado = []
    
    

    carpetasAExcluir = ['sandbox', 'Plantilla', 'CicodeGcubo']

    for carpeta in container.superValues('Folder'): if carpeta.getId() in carpetasAExcluir: continue portales = carpeta.objectValues('Plone Site') if portales: resultado.append(portales[0])

    resultado.sort(lambda a, b: cmp(a.getProperty('title'), b.getProperty('title'))) return resultado

  2. Write a Zope Page Template (ZPT) in the same folder with the name index_html. In this ZPT just say you are going to use the main template and you are going to override the content slot:
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"
          lang="en"
          metal:use-macro="context/main_template/macros/master"
          i18n:domain="plone">
      <body>
      <div metal:fill-slot="content">
        <div class="documentContent"  id="region-content">
        <h1 class="documentFirstHeading" tal:content="here/title_or_id">Titulo de la carpeta</h1>    
        <p>Esta es la lista de asociaciones cuyo sitio web está alojado en
        este portal:</p>
        <tal:block tal:repeat="aso context/listaAsociaciones">
          <div class="cajaAsociacion" >
            <h3><a href="#"
    	   tal:define="url python:aso.absolute_url()"
               tal:attributes="href python:url[:-7]+test(aso.isPrincipiaFolderish, '/', '')"
               tal:content="aso/title_or_id">
               Asociacion Sin Titulo
            </a></h3>
    	<p tal:content="aso/description">
     	   Descripcion de la asociacion
    	</p>
          </div>
        </tal:block>
        </div>
      </div>
    </body>
    </html>
    

  3. If you want, customize plone_css object in portal_skins/plone_styles to support the class I added in the example: cajaAsociacion:
    /* Estilo especificos de CicodeGcubo */
    /* Caja para las asociaciones en la seccion 'Asociaciones' */
    div.cajaAsociacion h3 {
    text-decoration: underline;
    }
    

As you can see, with Plone, logic, structure and visual aspect are separated. My grandma would be proud :-)

Latest blog entries     Older blog entries

New Advogato Features

New HTML Parser: The long-awaited libxml2 based HTML parser code is live. It needs further work but already handles most markup better than the original parser.

Keep up with the latest Advogato features by reading the Advogato status blog.

If you're a C programmer with some spare time, take a look at the mod_virgule project page and help us with one of the tasks on the ToDo list!