Skip to content

Instantly share code, notes, and snippets.

@jone
Created February 27, 2012 10:29
Show Gist options
  • Save jone/1923002 to your computer and use it in GitHub Desktop.
Save jone/1923002 to your computer and use it in GitHub Desktop.
bin/instance run setup
from AccessControl.SecurityManagement import newSecurityManager
from Testing.makerequest import makerequest
from zope.app.component.hooks import setSite
site_name = 'Plone'
# setup request and get plone site
app = makerequest(app)
site = app.unrestrictedTraverse(site_name)
# setup user context
user = site.acl_users.getUser(site.getWrappedOwner())
user = user.__of__(app.acl_users)
newSecurityManager(app, user)
#setup site
setSite(site)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment