Ejemplo n.º 1
0
    def __call__(self, content, event):
        """Called by the event system."""
        sdm = content.session_data_manager
        session = sdm.getSessionData()
        if "tg" in session.keys():
            # In case it's a on the fly translation avoid
            return

        if IDexterityTranslatable.providedBy(content):
            self.canonical = ITranslationManager(content).query_canonical()

            if event.descriptions and len(event.descriptions) > 1 and event.descriptions[1] == self.canonical:
                return

            if IObjectModifiedEvent.providedBy(event):
                self.handle_modified(content)
    def __call__(self, content, event):
        """Called by the event system."""
        request = getattr(event.object, 'REQUEST', getRequest())
        translation_info = getattr(request, 'translation_info', {})

        if 'tg' in translation_info.keys():
            # In case it's a on the fly translation avoid
            return

        if IDexterityTranslatable.providedBy(content):
            self.canonical = ITranslationManager(content).query_canonical()

            if event.descriptions \
               and len(event.descriptions) > 1 \
               and event.descriptions[1] == self.canonical:
                return

            if IObjectModifiedEvent.providedBy(event):
                self.handle_modified(content)
    def __call__(self, content, event):
        """Called by the event system."""
        request = getattr(event.object, 'REQUEST', getRequest())
        translation_info = getattr(request, 'translation_info', {})

        if 'tg' in translation_info.keys():
            # In case it's a on the fly translation avoid
            return

        if IDexterityTranslatable.providedBy(content):
            self.canonical = ITranslationManager(content).query_canonical()

            if event.descriptions \
               and len(event.descriptions) > 1 \
               and event.descriptions[1] == self.canonical:
                return

            if IObjectModifiedEvent.providedBy(event):
                self.handle_modified(content)
Ejemplo n.º 4
0
    def __call__(self, content, event):
        """Called by the event system."""
        if aq_parent(content) is None:
            # The event is thrown on a non acquired object
            # so we can't get the session_data_manager
            sdm = getSite().session_data_manager
        else:
            sdm = getToolByName(content, 'session_data_manager')

        session = sdm.getSessionData()
        if 'tg' in session.keys():
            # In case it's a on the fly translation avoid 
            return

        if IDexterityTranslatable.providedBy(content):
            self.canonical = ITranslationManager(content).query_canonical()

            if event.descriptions \
               and len(event.descriptions) > 1 \
               and event.descriptions[1] == self.canonical:
                return

            if IObjectModifiedEvent.providedBy(event):
                self.handle_modified(content)