# $Id: 0-7-x_1-0-0.py,v 1.5 2002/05/09 11:32:56 fresh Exp $
from Products.UpdateSupport.updatesupport import _updateall,_log
from Products.Squishdot.Updaters import fix_threading
from Products.Squishdot.Updaters import fix_replies
import sys

def do_update(self):
    """ Do the update """
    # add valid_tags property
    try:
        self.manage_addProperty('valid_tags',['b\na\ni\nbr\np'],'lines')
        thestring = _log('','Added valid_tags property.')
    except:
        thestring = _log('','Could not add valid_tags property:\nType: %s\nValue: %s'%(sys.exc_type,sys.exc_value))

    # code to redo threads
    thestring = thestring + fix_threading.do_update(self)
    
    # code to fix reply counts
    thestring = thestring + fix_replies.do_update(self)
    
    # code to re-index everything
    self.recatalogPostings()
    thestring = _log(thestring,'Re-catalogued everything to be safe.')

    return thestring


def updateall(self):
    return _updateall(self,do_update, metatypes=['Squishdot Site'])




