Skip to content. | Skip to navigation

Exporting users in CSV format

A client asked for a list of users. There's no way to do this out of the box in Plone. A quick product search turned up atreal.usersinout. After an hour or so, I had some joy. Here are the steps:

  • I was working with an older version of plone, so I set up a clean 3.2.2 instance for testing.
  • I added our eggs, including our src egg to the buildout.cfg
  • I added a product that we were using.
  • I ran buildout -N  and hit a version problem. I went back and pinned a version: Products.Ploneboard == 2.0.1
  • After a clean buildout, I added atreal.usersinout to eggs and zcml in buildout.cfg and re-ran buildout -N.
  • I copied Data.fs from the live server.
  • I started up plone and installed the new product.
  • After install, the product gives you Users In/Out control panel. This has both an import (untested) and an export.
  • My first attempt at an export failed with a python error, "NoneType has no member getProperty()". I went to work and after throwing a bunch of prints in the code, I discovered that groups were showing up when iterating over members. This may be a plone bug, since it's similar to the "phantom" members that come from creating groups. We've seen this before and reported it.
  • I patched the code to skip over the users with userid of "members" and "secretariat". Once that was done I got a clean export. This patching was done in browser/usersinout.py.
  • However, once I had a working CSV export, I wasn't getting all the fields. I worked on config.py and added our custom fields to both the CSV_MEMBER section and the MEMBER_PROPERTIES section.

fini

Document Actions