<commit_before>from Products.CMFCore.utils import getToolByName

def ObjectModifiedEventHandler(obj, event):
    """ Various types need automation on edit.
    """
    if not hasattr(obj, 'portal_type'):
        return
    pr = getToolByName(obj, 'portal_repository')
    uc = getToolByName(obj, 'uid_catalog')

    if obj.portal_type == 'Calculation':
        obj = uc(UID=obj.UID())[0].getObject()
        backrefs = obj.getBackReferences('AnalysisServiceCalculation')
        for i, service in enumerate(backrefs):
            service = uc(UID=service.UID())[0].getObject()
            pr.save(obj=service, comment="Calculation updated to version %s"%
                (obj.version_id+1,))
            service.reference_versions[obj.UID()] = obj.version_id + 1<commit_msg>objectmodified event caused schemaextender product to die on site creation<commit_after>from Products.CMFCore.utils import getToolByName

def ObjectModifiedEventHandler(obj, event):
    """ Various types need automation on edit.
    """
    if not hasattr(obj, 'portal_type'):
        return

    if obj.portal_type == 'Calculation':
        pr = getToolByName(obj, 'portal_repository')
        uc = getToolByName(obj, 'uid_catalog')
        obj = uc(UID=obj.UID())[0].getObject()
        backrefs = obj.getBackReferences('AnalysisServiceCalculation')
        for i, service in enumerate(backrefs):
            service = uc(UID=service.UID())[0].getObject()
            pr.save(obj=service, comment="Calculation updated to version %s"%
                (obj.version_id+1,))
            service.reference_versions[obj.UID()] = obj.version_id + 1
{'fraction_non_alphanumeric': 0.12121212121212122, 'fraction_numerical': 0.004947433518862091, 'mean_word_length': 3.2578947368421054, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3616003', 'n_tokens_mistral': 483, 'n_tokens_neox': 470, 'n_words': 104}