Changeset 704

Show
Ignore:
Timestamp:
03/20/07 01:14:41 (2 years ago)
Author:
sgillies
Message:

Add vocabulary metadata to catalog on install, add smart folder indexes in the hierarchy creation script (#18)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • PleiadesEntity/trunk/Extensions/AppInstall.py

    r701 r704  
    66    ] 
    77 
     8columns = ['getTermKey', 'getTermValue'] 
     9 
     10 
    811def install(self): 
    9      """ 
    10        custom installation steps 
    11      """ 
    12       
    13      out = [] 
    14       
    15      portal = self.portal_url.getPortalObject() 
    16       
    17      for iname, itype in indexes: 
    18          addIndex(portal, out, iname, itype)  
    19           
    20      return out 
    21       
     12    """ 
     13    custom installation steps 
     14    """ 
     15    out = [] 
     16    portal = self.portal_url.getPortalObject() 
     17    for iname, itype in indexes: 
     18        addIndex(portal, out, iname, itype)  
     19         
     20    # Vocab catalog metadata 
     21    catalog_tool = getToolByName(portal, 'portal_catalog', None) 
     22    for name in columns: 
     23        addColumn(catalog_tool, name) 
     24 
     25    return out 
     26     
     27def addColumn(tool, name): 
     28    try: 
     29        tool.manage_addColumn(name) 
     30    except: 
     31        pass 
     32 
    2233def addIndex(portal, out, name, type): 
    2334    catalog = getToolByName(portal, 'portal_catalog', None) 
  • PleiadesEntity/trunk/skins/PleiadesEntity/makeSmartFolders.py

    r700 r704  
    88##title= 
    99## 
     10 
     11smart_folder_tool = container.portal_atct 
     12         
     13try: 
     14    smart_folder_tool.removeIndex("getPlaceType") 
     15except: 
     16    pass 
     17         
     18try: 
     19    smart_folder_tool.removeIndex("getTimePeriods") 
     20except: 
     21    pass 
     22         
     23smart_folder_tool.addIndex('getPlaceType', 'Place Type', 'Type of ancient place', enabled=True) 
     24smart_folder_tool.addIndex('getTimePeriods', 'Time Periods', 'Attested time periods', enabled=True) 
     25 
    1026v_types = container.portal_catalog.uniqueValuesFor('getPlaceType') 
    1127v_times = container.portal_catalog.uniqueValuesFor('getTimePeriods')