Archive for the 'plone' Category

Plone bulk update of default values for new attribute

Tuesday, September 16th, 2008

Scenario: I added a new attribute “orderPriority” to a few different archetypes based content types. These attributes had default values. As this is an existing site, there were 400 or so existing objects that had not picked up these default values - i.e. they would only pick up the value after they had been re-saved. To make sure these objects picked up the default value I created a skin script, which I proxied as manager (watch out for indentation here, really must find a better way to display preformatted code):-

catalog = context.portal_catalog
# objects are all in folder /directory/listing/
listing_folder = getattr(context.directory, 'listing')

for brain in catalog(portal_type = ['NameOfMyContentType']):
print brain.portal_type + ' ' + brain.id + ' ' + brain.Title

listing = getattr(listing_folder, brain.id)
#this gets the default vakue from the schema
order = listing.getOrderPriority()   #this sets it
listing.setOrderPriority(order)

return printed

I needed to be able to sort by this field in a catalog query/ Topic/SmartFolder/Collection so, so I then added the field as a fielindex in the portal catalog, reindexed the catalog (ZMI) and used the collection edit options in site setup to add it as a field

Dexterity

Thursday, August 28th, 2008

overriding the title attribute in an archetypes schema

Thursday, August 7th, 2008

pdb and zdb - debuggers for python and zope

Thursday, May 29th, 2008

Plone hotfix - how to install it for those who might be nervous to do so

Thursday, November 15th, 2007

Wessex Plone Users Group

Friday, November 2nd, 2007

Interesting debate about TTW support in plone

Saturday, October 20th, 2007

Bristol contingent at Plone conference 2007, Naples

Friday, October 12th, 2007

OK maybe this Zope object database makes sense now..

Tuesday, October 2nd, 2007

i’m joining the circus

Monday, May 28th, 2007