Example #1
0
    def get_attrs(self, html_compatibility, source_language):
        context = aq_inner(self.context)
        schema = context.Schema()
        attrs = []

        for key in self.attrs:
            field = schema[key]
            if field.languageIndependent:
                logger.warn(
                    "Exporting language independent attribute %s, "
                    "this may give unexpected results during import such as all "
                    "language versions have the value of the last language set "
                    "in the attribute!" % key)

            value = field.get(context)

            data = dict(id=key,
                        value=value,
                        source_language=source_language)

            if html_compatibility:
                attrs.append(HTML_ATTR_BODY % data)
            else:
                attrs.append(XLIFF_ATTR_BODY % data)

        return attrs
Example #2
0
    def get_attrs(self, html_compatibility, source_language):

        schema = get_dx_schema(self.context)
        attrs = []
        for key in self.attrs:
            if key.startswith('qSEO_'):
                if self.context.hasProperty(key):
                    value = self.context.getProperty(key)
                else:
                    continue
            else:
                field = schema[key]
                if ILanguageIndependentField.providedBy(field):
                    logger.warn(
                        "Exporting language independent attribute %s, "
                        "this may give unexpected results during import such as all "
                        "language versions have the value of the last language set "
                        "in the attribute!" % key)

                value = field.get(self.context)
                if IRichTextValue.providedBy(value):
                    value = value.raw
            if isinstance(value, unicode):
                value = value.encode('UTF-8')
            if not value:
                value = ''
            data = dict(id=key, value=value, source_language=source_language)

            if html_compatibility:
                attrs.append(HTML_ATTR_BODY % data)
            else:
                attrs.append(XLIFF_ATTR_BODY % data)

        return attrs
Example #3
0
    def get_attrs(self, html_compatibility, source_language):

        schema = get_dx_schema(self.context)
        attrs = []

        for key in self.attrs:
            field = schema[key]
            if ILanguageIndependentField.providedBy(field):
                logger.warn(
                    "Exporting language independent attribute %s, "
                    "this may give unexpected results during import such as all "
                    "language versions have the value of the last language set "
                    "in the attribute!" % key
                )

            value = field.get(self.context)
            if IRichTextValue.providedBy(value):
                value = value.raw
            if isinstance(value, unicode):
                value = value.encode("UTF-8")

            data = dict(id=key, value=value, source_language=source_language)

            if html_compatibility:
                attrs.append(HTML_ATTR_BODY % data)
            else:
                attrs.append(XLIFF_ATTR_BODY % data)

        return attrs
Example #4
0
    def get_attrs(self, html_compatibility, source_language):
        context = aq_inner(self.context)
        schema = context.Schema()
        attrs = []

        for key in self.attrs:
            field = schema[key]
            if field.languageIndependent:
                logger.warn(
                    "Exporting language independent attribute %s, "
                    "this may give unexpected results during import such as all "
                    "language versions have the value of the last language set "
                    "in the attribute!" % key)

            value = field.get(context)

            data = dict(id=key, value=value, source_language=source_language)

            if html_compatibility:
                attrs.append(HTML_ATTR_BODY % data)
            else:
                attrs.append(XLIFF_ATTR_BODY % data)

        return attrs