Skip to content

Instantly share code, notes, and snippets.

@martior
Created May 13, 2014 11:15
Show Gist options
  • Save martior/b93dd0ec4cf1bee4eaa9 to your computer and use it in GitHub Desktop.
Save martior/b93dd0ec4cf1bee4eaa9 to your computer and use it in GitHub Desktop.
Mocukp request and secrutiy manager for Plone debug prompt or console scripts
from AccessControl.SecurityManagement import newSecurityManager
from Testing import makerequest
from zope.site.hooks import setHooks
from zope.site.hooks import setSite
root = makerequest.makerequest(app)
site = root.get('Plone')
setHooks()
setSite(site)
uf = app.acl_users
user = uf.getUserById("admin")
newSecurityManager(None, user)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment