Skip to content

Rhaptos Software Development

Personal tools
You are here: Home » Development » Removal of TWB branding

Removal of TWB branding

Document Actions
Script I used to remove the Teachers Without Borders special-branding property from the TWB collections. I think only NCPEA is still done this way now; RUP, TIMEA, and any other extant branding uses a different scheme. But here's the script for posterity.
c = app.plone.content
allcols = c.objectIds('Version Folder')

def getwgws():
  wgws = list(app.plone.GroupWorkspaces.objectValues(['WorkgroupAT']))
  wgws.extend(app.plone.Members.objectValues(['Plone Folder']))
  return wgws

wgws=getwgws()

def getwgcols():
  wgcols = []
  for w in wgws:
    wgcols.extend(w.objectValues(['Collection']))
  return wgcols

wgcols = getwgcols()

# This tells us what the published TWB courses are, and confirms that they have all the same attribute.
# for col in allcols:
#   for ver in c[col].objectValues():
#     if ver.getParameters().has_key('style'):                                                     
#       print col, ver, ver.getParameters()['style']

twb = ['col10329', 'col10330', 'col10333', 'col10334', 'col10335', 'col10336', 'col10337']

for col in twb:
  for ver in c[col].objectValues():
    if ver.getParameters().has_key('style'):
      ver.parameters.manage_delProperties(['style'])

# This tells us what the wg/ws TWB courses are, and confirms that they have all the same attribute.
# for col in wgcols:
#   if col.getParameters().has_key('style'):
#     print col, col.getParameters()['style']

for col in wgcols:
  if col.getParameters().has_key('style'):
    if col.getParameters()['style'] == 'http://cnx.org/twb/document.css':
      col.parameters.manage_delProperties(['style'])

import transaction as t
t.commit()
Created by jenn
Last modified 2008-04-28 11:33