[Product-Developers] objects not saved in bin/instance run script
Maxfield
netropic at u.washington.edu
Thu Aug 13 18:41:46 UTC 2009
Appreciate any help with this, I have a feeling I'm missing
some kind of unknown magic in here. I'm trying to add a
new MutablePropertySheet to a MembraneUser...
---------begin----------------------------------
from Testing import makerequest
import transaction
from Products.CMFCore.utils import getToolByName
from Products.PlonePAS.sheet import MutablePropertySheet
from AccessControl.SecurityManagement import newSecurityManager
from AccessControl.User import system
from Acquisition import aq_base
import pdb
objs = app.listDAVObjects()
#
# find the plone site
#
plone_site = None
for o in objs:
if o.__class__.__name__ is 'PloneSite':
plone_site = o
app = makerequest.makerequest(app)
newSecurityManager(None,system)
MYPROPSHEET = 'remote_properties'
MYPROPTYPE = 'lines'
MYPROPNAME = 'messages'
acl_users = getToolByName(plone_site,'acl_users')
howard = acl_users.getUserById('howard')
psheets = howard.listPropertysheets()
print psheets
if MYPROPSHEET in psheets:
print 'found propertysheet'
else:
print 'could not find "' + MYPROPSHEET + '" in propertysheets'
try:
new_sheet = MutablePropertySheet( MYPROPSHEET, [ ( MYPROPNAME, 'lines' ) ] )
howard.addPropertysheet( MYPROPSHEET, new_sheet )
except KeyError:
print 'property sheet could not be found but also could not be added!'
sys.exit(1)
transaction.commit()
----------------end----------------------------
More information about the Product-Developers
mailing list