Author Archive

Oddness changing time zone in Zope

Alan Hoey - September 23rd, 2009

Setting the time zone for a Zope deployment is usually a simple process of adding the following to the relevant instance section in the buildout:

zope-conf-additional =
<environment>
TZ America/New_York
</environment>

This works fine in any configuration where the instance is started using the script generated by plone.recipe.zope2instance (usually ‘./bin/instance’).  However, we run most of our production environments using supervisor, which starts the instances using the runzope script buried within the buildout.  This is where the problems happen.

When the instance is started using runzope, the timezone is not changed (in some circumstances the instance reports the correct time but the wrong time zone).  I haven’t been able to find out what exactly is causing this, but I did find a workaround.

If you remove the TZ setting from the buildout completely, then set the TZ environment variable at the shell level (e.g. export TZ=America/New_York) it works!  To fix this for supervisor deployments you need to set the ‘environment’ variable for each program in the supervisor config.  At the moment this isn’t possible using the collective.recipe.supervisor (0.8) recipe, since it doesn’t allow the process_opts values to contain ‘=’ characters.  There’s a fix for this in trunk.  With a good version of the recipe, the program configuration for a zope instance looks like this:

10 instance1 (environment=TZ=America/New_York) ${instance1:location}/bin/runzope  ${instance1:location} true

(all on one line obviously)

The Oracle has the answer!

Alan Hoey - November 27th, 2008

Sometimes when writing things that poke into the deepest darkest corners of Plone (and also the more traditional, well lit corners) it’s nice to have some sort of rough guide to the area without having to trawl through pdb and the source code to find out what’s going on.

The Oracle helps by showing some of the more commonly needed information for objects all on one (rather large) page.  Some of the information included on the main page (@@the_oracle):

  • Authenticated User (id, type, roles, roles in context, attributes)
  • Context (id, type, path, methods (view source and call), attributes, source code)
  • Workflow history
  • AT Fields (id, type, required, mode, accessor, mutator)
  • Catalog Indexes/Metadata
  • Permissions

It also includes a quick method for dropping into pdb (@@pdb). To have a play just add teamrubber.theoracle to your buildout and enjoy!

Edit: Fixed a typo, thanks folks!