#!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright (C) 2008, Mathieu PASQUET aka kiorky # Copyright (C) 2008, Jeanmichel Francois aka toutpt # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. import os import sys import logging from Testing.makerequest import makerequest import Zope2 def connect(zopeconf): """options is an options optparser object.""" os.environ['ZOPE_COMPATIBLE_STARTUP'] = " " os.environ['ZOPE_CONFIG'] = zopeconf app = makerequest(Zope2.app()) logger = logging.getLogger('20080624 migration') from AccessControl import getSecurityManager from AccessControl.SecurityManagement import newSecurityManager from AccessControl.SecurityManagement import setSecurityManager plone = app.anticancer.get('www.anticancer.fr') user = plone.acl_users.getUser('webmestre').__of__(plone.acl_users) newSecurityManager(app, plone.acl_users.getUser('webmestre')) import Products return plone, user def initLogging(): # logging to stdout logging.root.setLevel(logging.INFO) lformatter = logging.Formatter("%(asctime)s %(name)-1s %(levelname)-2s - %(message)s") lhandler = logging.StreamHandler(sys.stdout) lhandler.setFormatter(lformatter) logging.root.addHandler(lhandler)