Document Actions

Plone Tips & Tricks

by David Hostetler [modified 20120418:16:12 (Wed)] [posted 20091128:13:46 (Sat)]
  • The set of ZPT/TAL variables available in a given context can be browsed in the Plone egg via Products/CMFPlone/browser/interfaces.py
  • A similar set can be discovered in Products/CMFPlone/browser/ploneview.py (the Plone class). 
  • The differences and usage are discussed in the plone docs.
  • How to really really make items not appear in the navigation portlet.
  • John Stahl describes how to combine quills and scrawl to get a nice plone blogging system.  UPDATE: according to johnstahl (via irc), collective.blog.star is likely a better option (in that same scenario) these days than quills.
  • Use the following to examine which eggs are are NOT version-pinned:
    • bin/buildout -Novvvvv |sed -ne 's/^Picked: //p' | sort | uniq
  • Use dumppickedversions to examine which eggs are version-pinned.  Just add the following to your [buildout] section:
    • extensions = buildout.dumppickedversions
  • To manage the redirection aliases for a given piece of content, add '/manage_aliases' to its URL and view it.
  • To view the UID of an (Archetypes) object, just add '/reference_url' to it's URL and view it.  That'll show you a URL string that includes the object's UID.
  • If you see error messages about '_imaging' not being available, when you know that you installed PIL, it's probably the case that your system's libjpeg cycled out from under your plone's virtualenv.  Even in the sandbox where python and PIL get setup, it still links to your /usr/lib/libjpeg.  So if for example on gentoo, the media-libs/jpeg package got updated, it probably broke your plone sandbox (and revdep-rebuild won't know anything about it).  To fix it, just use easy_install to reinstall PIL into the virtualenv:
    • ./python24/bin/easy_install -U http://dist.plone.org/thirdparty/PILwoTk-1.1.6.4.tar.gz
      
  • A quick and dirty way to cause a forced 404 via TAL:
    • <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"
            xmlns:tal="http://xml.zope.org/namespaces/tal">

      <tal:block tal:replace="structure python:context.standard_error_message(error_type='NotFound')">

      </tal:block>

      </html>

  • jazkarta's take on how to handle big files.
  • The ownership form doesn't get exposed by the stock plone UI anymore, but it's still there.  Just ad 'ownership_form' to any content object's URL.
  • If you aborted out of a PDB session of a foreground instance of Zope, you might lose stdin echo (i.e. you can't see what you're typing in the shell window).  If so, try using 'tset <enter>'.  Obviously this isn't strictly a Plone trick, but dropping out of debug Plone instances is the only place I've encountered this shell quirk.
  • If your form handler complains about "Forbidden: Form authenticator is invalid.", then the form is missing the authenticator thingamabob (thanks Evgeni):
    • <input type="hidden" name="form.submitted" value="1" />
      <input tal:replace="structure context/@@authenticator/authenticator" />
      
  • Use the spinner graphic on AJAX calls.
  • Here's a post describing how to get domain overrides for plone 4 (the i18n folder trick doesn't work anymore).
  • ZCML is frustratingly undocumented.  Use aws.zope2zcmldoc to help ease the pain.
  • and more...