[Product-Developers] Re: objects not saved in bin/instance run script
Maxfield
netropic at u.washington.edu
Fri Aug 14 21:34:39 UTC 2009
Yes, with no new information gleaned (not really familiar with the
codebase yet).
However, I have sinced switched to using Annotations to
store my new information, which was probably the right way to
do this from the beginning.
Thanks for the reply!
-Max
On Fri, 14 Aug 2009, Alex Clark wrote:
> On 2009-08-13, Maxfield <netropic at u.washington.edu> wrote:
>>
>> 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...
>
> Have you tried pdb stepping through?
>
>>
>>
>> ---------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----------------------------
>
>
> --
> Alex Clark ? http://aclark.net
> Buy Practical Plone 3: http://tinyurl.com/practical-plone
>
>
> _______________________________________________
> Product-Developers mailing list
> Product-Developers at lists.plone.org
> http://lists.plone.org/mailman/listinfo/product-developers
>
More information about the Product-Developers
mailing list