Posts

Showing posts from October, 2008

Plone: Reverse Folder Contents in TAL Define

Using TAL, I needed to display the folder contents with dates ascending (newest first). By default context/folderlistFolderContents returns the tuple descending. So I fixed it by using a ternary statment hack, that evaluates both entries/blocks. [code] <metal:fill fill-slot="main"> <metal:main_macro define-macro="main" tal:define="portal_type python:here.getPortalTypeName().lower().replace(' ', '_'); folder_list context/folderlistingFolderContents; folder_list python: (folder_list.reverse(), folder_list)[1]; base_macros here/base/macros; view_template python:'%s_view' % portal_type; <!-- rest of code --> [/code]

Plone: Reinstall Product Button

While creating Plone Products, I noticed that Plone will delete any created Portal objects, once a product associated with it has been uninstalled. Since I created a ZCatalog, which had data in it, I don't want that feature. After marching through the QuickInstaller code, I decided to add a "Reinstall Button" to all the respective products, to prevent uninstallation. In your egg or product code root, simple add: version.txt Directory Structure Example (Python Pkg): myproduct.stuff/myproduct/stuff/version.txt The contents should be: 1.0-alpha build 1 When ever the version.txt is changed it will display the reinstall button. Note: If you add the version.txt file to an existing product, you will have to manually uninstall the Product, then install it again. Otherwise, pressing "reinstall product" will anger the QuickInstaller (very bad). The Fix for angry QuickInstaller: If you manage to click "reinstall product" before you uninstall and install again, sh