Export/import users in and out of Plone
Wed, Mar 9, 2011,
100 Words
A dirty quick method of importing and exporting the users (only usernames and passwords) out of Plone, using 2 external methods. Code below, not much else to say.
import cPickle def export(self): pas = self.acl_users users = pas.source_users passwords = users._user_passwords result = dict(passwords) f = open('/tmp/out.blob', 'w') cPickle.dump(result, f) f.close() return "done" def import_users(self): pas = self.acl_users users = pas.source_users f = open('/tmp/out.blob') res = cPickle.load(f) f.close() for uid, pwd in res.items(): users.addUser(uid, uid, pwd) return "done"