Richard Green
Richard Green

Reputation: 2062

Zope Plone 3.1.2 - export all users with email addresses

I have been running zope / plone site for about a year now - it seemed to be a pretty fast way of getting a CMS up and running and it's a great job for this - it's running 3.1.2 of plone. I am in now way a zope or plone expert (in fact the more I read about it - the less I know I know!) , but I am handy at python.

I have tried to export the users as xml - it fails with the unicode / id bug. I have tried export as a zexp file, but I can't actually find out how to read this file (I have tried import zope etc but I don't know what to do next !

I have found scripts that run listing all users, but these are for zope2 and, if I am honest, I wouldn't actually know how to install them anyway.

Can someone please either

1) tell me how to fix the id / unicode xml export bug? And please tell me in ways I can do directly on the site ? or 2) show me how to read and zope zexp file and do something simple like put it into a dict ?

I didn't know so many people were going to sign up for using my site and now I wish to move the email list management to another system - hence the requirement for the export.

Thanks in advance,

Richard.

Upvotes: 3

Views: 1475

Answers (2)

Mark van Lent
Mark van Lent

Reputation: 13011

Another way of extracting the email addresses of the users:

  1. Go to the root of the Plone site in the ZMI.
  2. Add a "Script (Python)".
    1. Come up with a nice id e.g. "export_email".
    2. Click on "Add and edit".
    3. Replace the code in the text field with the code listed below.
    4. Don't forget to save your changes.
  3. Go to the "test tab".

The code for the script:

for member in context.portal_membership.listMembers():
    print member.getProperty('email')
return printed

Upvotes: 4

Richard Green
Richard Green

Reputation: 2062

OK - I'm going to put an answer here anyway, just in case anybody else ever gets stuck with this issue.

It's a cheat really, but I edited the /portal_skins/custom/prefs_users_overview and changed the line below from :20 to :2000 and then just did a simple user search, and then I HTML scraped the mailto: addresses.

b_size request/b_size | python:2000;

If anybody else finds this useful, let me know !

Upvotes: 0

Related Questions