-- cgit v1.2.3 From 896c49083aec918b0710f9c62f2f775a53f28057 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Wed, 9 Feb 2011 14:55:17 +0000 Subject: Resolves: rhbz#675806 crash in es thesaurus (cherry picked from commit b788f9fc846c0f47d02df02ac6733c0ac21a13c6) --- mythes/makefile.mk | 6 ++++-- mythes/mythes-1.2.1-rhbz675806.patch | 10 ++++++++++ 2 files changed, 14 insertions(+), 2 deletions(-) create mode 100644 mythes/mythes-1.2.1-rhbz675806.patch diff --git a/mythes/makefile.mk b/mythes/makefile.mk index b1667c3..131b1ee 100644 --- a/mythes/makefile.mk +++ b/mythes/makefile.mk @@ -41,8 +41,10 @@ TARFILE_MD5=067201ea8b126597670b5eff72e1f66c ADDITIONAL_FILES += makefile.mk -PATCH_FILES=mythes-1.2.0-vanilla-th-gen-idx.patch \ - mythes-1.2.0-makefile-mk.diff +PATCH_FILES=\ + mythes-1.2.0-vanilla-th-gen-idx.patch \ + mythes-1.2.0-makefile-mk.diff \ + mythes-1.2.1-rhbz675806.patch .IF "$(GUI)"=="UNX" CONFIGURE_DIR=$(BUILD_DIR) diff --git a/mythes/mythes-1.2.1-rhbz675806.patch b/mythes/mythes-1.2.1-rhbz675806.patch new file mode 100644 index 0000000..be50bee --- /dev/null +++ b/mythes/mythes-1.2.1-rhbz675806.patch @@ -0,0 +1,10 @@ +--- misc/mythes-1.2.0/mythes.cxx 2011-02-08 10:42:57.262964286 +0000 ++++ misc/build/mythes-1.2.0/mythes.cxx 2011-02-08 10:43:06.305076490 +0000 +@@ -14,6 +14,7 @@ + encoding = NULL; + list = NULL; + offst = NULL; ++ pdfile = NULL; + + if (thInitialize(idxpath, datpath) != 1) { + fprintf(stderr,"Error - can't open %s or %s\n",idxpath, datpath); -- cgit v1.2.3 -- cgit v1.2.3 From 1bb5b6cc83f18e668c486f9207e5d6fb6f31961c Mon Sep 17 00:00:00 2001 From: Fridrich Štrba Date: Fri, 1 Apr 2011 15:37:55 +0200 Subject: Handle corrupted WP6 prefixes graciously --- libwpd/libwpd.corruptedprefix.patch | 107 ++++++++++++++++++++++++++++++++++++ libwpd/makefile.mk | 3 +- 2 files changed, 109 insertions(+), 1 deletion(-) create mode 100644 libwpd/libwpd.corruptedprefix.patch diff --git a/libwpd/libwpd.corruptedprefix.patch b/libwpd/libwpd.corruptedprefix.patch new file mode 100644 index 0000000..1fa051f --- /dev/null +++ b/libwpd/libwpd.corruptedprefix.patch @@ -0,0 +1,107 @@ +--- misc/libwpd-0.9.1/src/lib/WP6PrefixDataPacket.cpp ++++ misc/build/libwpd-0.9.1/src/lib/WP6PrefixDataPacket.cpp +@@ -46,45 +46,67 @@ WP6PrefixDataPacket::WP6PrefixDataPacket(WPXInputStream * /* input */, WPXEncryp + } + + WP6PrefixDataPacket * WP6PrefixDataPacket::constructPrefixDataPacket(WPXInputStream * input, WPXEncryption *encryption, WP6PrefixIndice *prefixIndice) +-{ +- switch (prefixIndice->getType()) ++{ ++ WP6PrefixDataPacket *tmpPacket = 0; ++ try ++ { ++ switch (prefixIndice->getType()) ++ { ++ case WP6_INDEX_HEADER_INITIAL_FONT: ++ tmpPacket = new WP6DefaultInitialFontPacket(input, encryption, prefixIndice->getID(), ++ prefixIndice->getDataOffset(), prefixIndice->getDataSize()); ++ break; ++ case WP6_INDEX_HEADER_GENERAL_WORDPERFECT_TEXT: ++ tmpPacket = new WP6GeneralTextPacket(input, encryption, prefixIndice->getID(), ++ prefixIndice->getDataOffset(), prefixIndice->getDataSize()); ++ break; ++ case WP6_INDEX_HEADER_DESIRED_FONT_DESCRIPTOR_POOL: ++ tmpPacket = new WP6FontDescriptorPacket(input, encryption, prefixIndice->getID(), ++ prefixIndice->getDataOffset(), prefixIndice->getDataSize()); ++ break; ++ case WP6_INDEX_HEADER_FILL_STYLE: ++ tmpPacket = new WP6FillStylePacket(input, encryption, prefixIndice->getID(), ++ prefixIndice->getDataOffset(), prefixIndice->getDataSize()); ++ break; ++ case WP6_INDEX_HEADER_EXTENDED_DOCUMENT_SUMMARY: ++ tmpPacket = new WP6ExtendedDocumentSummaryPacket(input, encryption, prefixIndice->getID(), ++ prefixIndice->getDataOffset(), prefixIndice->getDataSize()); ++ break; ++ case WP6_INDEX_HEADER_OUTLINE_STYLE: ++ tmpPacket = new WP6OutlineStylePacket(input, encryption, prefixIndice->getID(), ++ prefixIndice->getDataOffset(), prefixIndice->getDataSize()); ++ break; ++ case WP6_INDEX_HEADER_GRAPHICS_FILENAME: ++ tmpPacket = new WP6GraphicsFilenamePacket(input, encryption, prefixIndice->getID(), prefixIndice->getFlags(), ++ prefixIndice->getDataOffset(), prefixIndice->getDataSize()); ++ break; ++ case WP6_INDEX_HEADER_GRAPHICS_CACHED_FILE_DATA: ++ tmpPacket = new WP6GraphicsCachedFileDataPacket(input, encryption, prefixIndice->getID(), ++ prefixIndice->getDataOffset(), prefixIndice->getDataSize()); ++ break; ++ case WP6_INDEX_HEADER_GRAPHICS_BOX_STYLE: ++ tmpPacket = new WP6GraphicsBoxStylePacket(input, encryption, prefixIndice->getID(), ++ prefixIndice->getDataOffset(), prefixIndice->getDataSize()); ++ break; ++ case WP6_INDEX_HEADER_TABLE_STYLE: ++ tmpPacket = new WP6TableStylePacket(input, encryption, prefixIndice->getID(), ++ prefixIndice->getDataOffset(), prefixIndice->getDataSize()); ++ break; ++ case WP6_INDEX_HEADER_COMMENT_ANNOTATION: ++ tmpPacket = new WP6CommentAnnotationPacket(input, encryption, prefixIndice->getID(), ++ prefixIndice->getDataOffset(), prefixIndice->getDataSize()); ++ break; ++ default: ++ break;; ++ } ++ } ++ catch (FileException) + { +- case WP6_INDEX_HEADER_INITIAL_FONT: +- return new WP6DefaultInitialFontPacket(input, encryption, prefixIndice->getID(), +- prefixIndice->getDataOffset(), prefixIndice->getDataSize()); +- case WP6_INDEX_HEADER_GENERAL_WORDPERFECT_TEXT: +- return new WP6GeneralTextPacket(input, encryption, prefixIndice->getID(), +- prefixIndice->getDataOffset(), prefixIndice->getDataSize()); +- case WP6_INDEX_HEADER_DESIRED_FONT_DESCRIPTOR_POOL: +- return new WP6FontDescriptorPacket(input, encryption, prefixIndice->getID(), +- prefixIndice->getDataOffset(), prefixIndice->getDataSize()); +- case WP6_INDEX_HEADER_FILL_STYLE: +- return new WP6FillStylePacket(input, encryption, prefixIndice->getID(), +- prefixIndice->getDataOffset(), prefixIndice->getDataSize()); +- case WP6_INDEX_HEADER_EXTENDED_DOCUMENT_SUMMARY: +- return new WP6ExtendedDocumentSummaryPacket(input, encryption, prefixIndice->getID(), +- prefixIndice->getDataOffset(), prefixIndice->getDataSize()); +- case WP6_INDEX_HEADER_OUTLINE_STYLE: +- return new WP6OutlineStylePacket(input, encryption, prefixIndice->getID(), +- prefixIndice->getDataOffset(), prefixIndice->getDataSize()); +- case WP6_INDEX_HEADER_GRAPHICS_FILENAME: +- return new WP6GraphicsFilenamePacket(input, encryption, prefixIndice->getID(), prefixIndice->getFlags(), +- prefixIndice->getDataOffset(), prefixIndice->getDataSize()); +- case WP6_INDEX_HEADER_GRAPHICS_CACHED_FILE_DATA: +- return new WP6GraphicsCachedFileDataPacket(input, encryption, prefixIndice->getID(), +- prefixIndice->getDataOffset(), prefixIndice->getDataSize()); +- case WP6_INDEX_HEADER_GRAPHICS_BOX_STYLE: +- return new WP6GraphicsBoxStylePacket(input, encryption, prefixIndice->getID(), +- prefixIndice->getDataOffset(), prefixIndice->getDataSize()); +- case WP6_INDEX_HEADER_TABLE_STYLE: +- return new WP6TableStylePacket(input, encryption, prefixIndice->getID(), +- prefixIndice->getDataOffset(), prefixIndice->getDataSize()); +- case WP6_INDEX_HEADER_COMMENT_ANNOTATION: +- return new WP6CommentAnnotationPacket(input, encryption, prefixIndice->getID(), +- prefixIndice->getDataOffset(), prefixIndice->getDataSize()); +- default: +- return 0; ++ if (tmpPacket) ++ delete tmpPacket; ++ tmpPacket = 0; + } ++ return tmpPacket; + } + + void WP6PrefixDataPacket::_read(WPXInputStream *input, WPXEncryption *encryption, uint32_t dataOffset, uint32_t dataSize) diff --git a/libwpd/makefile.mk b/libwpd/makefile.mk index 40b186d..717facb 100644 --- a/libwpd/makefile.mk +++ b/libwpd/makefile.mk @@ -43,7 +43,8 @@ TARGET=wpd TARFILE_NAME=libwpd-0.9.1 TARFILE_MD5=5ff846847dab351604ad859e2fd4ed3c -PATCH_FILES=libwpd.gcc460.patch +PATCH_FILES=libwpd.gcc460.patch \ + libwpd.corruptedprefix.patch BUILD_ACTION=dmake $(MFLAGS) $(CALLMACROS) BUILD_DIR=src$/lib -- cgit v1.2.3 From eebf0cf9b356151c9b0863f4007e38b682971297 Mon Sep 17 00:00:00 2001 From: Fridrich Štrba Date: Fri, 1 Apr 2011 15:40:20 +0200 Subject: Silence some unreachable code warnings --- libwpd/libwpd.warnings.patch | 32 ++++++++++++++++++++++++++++++++ libwpd/makefile.mk | 3 ++- 2 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 libwpd/libwpd.warnings.patch diff --git a/libwpd/libwpd.warnings.patch b/libwpd/libwpd.warnings.patch new file mode 100644 index 0000000..ebc86dc --- /dev/null +++ b/libwpd/libwpd.warnings.patch @@ -0,0 +1,32 @@ +--- misc/libwpd-0.9.1/src/lib/libwpd_internal.cpp ++++ misc/build/libwpd-0.9.1/src/lib/libwpd_internal.cpp +@@ -998,21 +998,25 @@ _WPXColumnProperties::_WPXColumnProperties() + // HACK: this function is really cheesey + int _extractNumericValueFromRoman(const char romanChar) + { ++ int retValue = 0; + switch (romanChar) + { + case 'I': + case 'i': +- return 1; ++ retValue = 1; ++ break; + case 'V': + case 'v': +- return 5; ++ retValue = 5; ++ break; + case 'X': + case 'x': +- return 10; ++ retValue = 10; ++ break; + default: + throw ParseException(); + } +- return 1; ++ return retValue; + } + + // _extractDisplayReferenceNumberFromBuf: given a nuWP6_DEFAULT_FONT_SIZEmber string in UCS2 represented diff --git a/libwpd/makefile.mk b/libwpd/makefile.mk index 717facb..6ecbbfa 100644 --- a/libwpd/makefile.mk +++ b/libwpd/makefile.mk @@ -44,7 +44,8 @@ TARGET=wpd TARFILE_NAME=libwpd-0.9.1 TARFILE_MD5=5ff846847dab351604ad859e2fd4ed3c PATCH_FILES=libwpd.gcc460.patch \ - libwpd.corruptedprefix.patch + libwpd.corruptedprefix.patch \ + libwpd.warnings.patch BUILD_ACTION=dmake $(MFLAGS) $(CALLMACROS) BUILD_DIR=src$/lib -- cgit v1.2.3 From 8b9d71f43d093afe638f7e8da15702f86a38ae1d Mon Sep 17 00:00:00 2001 From: Michael Meeks Date: Fri, 1 Apr 2011 16:48:40 +0100 Subject: disable patch breaking the build --- libwpd/makefile.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libwpd/makefile.mk b/libwpd/makefile.mk index 6ecbbfa..dd46e3e 100644 --- a/libwpd/makefile.mk +++ b/libwpd/makefile.mk @@ -44,8 +44,8 @@ TARGET=wpd TARFILE_NAME=libwpd-0.9.1 TARFILE_MD5=5ff846847dab351604ad859e2fd4ed3c PATCH_FILES=libwpd.gcc460.patch \ - libwpd.corruptedprefix.patch \ libwpd.warnings.patch +# libwpd.corruptedprefix.patch \ - disabled ... BUILD_ACTION=dmake $(MFLAGS) $(CALLMACROS) BUILD_DIR=src$/lib -- cgit v1.2.3 From d8256d686c72d6c76958eb43072b14290e8a589e Mon Sep 17 00:00:00 2001 From: Fridrich Štrba Date: Fri, 1 Apr 2011 18:47:49 +0200 Subject: This patch should apply now --- libwpd/libwpd.corruptedprefix.patch | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/libwpd/libwpd.corruptedprefix.patch b/libwpd/libwpd.corruptedprefix.patch index 1fa051f..9d5288d 100644 --- a/libwpd/libwpd.corruptedprefix.patch +++ b/libwpd/libwpd.corruptedprefix.patch @@ -1,10 +1,10 @@ ---- misc/libwpd-0.9.1/src/lib/WP6PrefixDataPacket.cpp -+++ misc/build/libwpd-0.9.1/src/lib/WP6PrefixDataPacket.cpp -@@ -46,45 +46,67 @@ WP6PrefixDataPacket::WP6PrefixDataPacket(WPXInputStream * /* input */, WPXEncryp +--- misc/libwpd-0.9.1/src/lib/WP6PrefixDataPacket.cpp 2010-08-26 13:35:21.000000000 +0200 ++++ misc/build/libwpd-0.9.1/src/lib/WP6PrefixDataPacket.cpp 2011-04-01 18:25:41.328379372 +0200 +@@ -46,45 +46,67 @@ } - + WP6PrefixDataPacket * WP6PrefixDataPacket::constructPrefixDataPacket(WPXInputStream * input, WPXEncryption *encryption, WP6PrefixIndice *prefixIndice) --{ +-{ - switch (prefixIndice->getType()) +{ + WP6PrefixDataPacket *tmpPacket = 0; @@ -62,26 +62,26 @@ + } + catch (FileException) { -- case WP6_INDEX_HEADER_INITIAL_FONT: -- return new WP6DefaultInitialFontPacket(input, encryption, prefixIndice->getID(), +- case WP6_INDEX_HEADER_INITIAL_FONT: +- return new WP6DefaultInitialFontPacket(input, encryption, prefixIndice->getID(), - prefixIndice->getDataOffset(), prefixIndice->getDataSize()); - case WP6_INDEX_HEADER_GENERAL_WORDPERFECT_TEXT: -- return new WP6GeneralTextPacket(input, encryption, prefixIndice->getID(), +- return new WP6GeneralTextPacket(input, encryption, prefixIndice->getID(), - prefixIndice->getDataOffset(), prefixIndice->getDataSize()); - case WP6_INDEX_HEADER_DESIRED_FONT_DESCRIPTOR_POOL: -- return new WP6FontDescriptorPacket(input, encryption, prefixIndice->getID(), +- return new WP6FontDescriptorPacket(input, encryption, prefixIndice->getID(), - prefixIndice->getDataOffset(), prefixIndice->getDataSize()); - case WP6_INDEX_HEADER_FILL_STYLE: -- return new WP6FillStylePacket(input, encryption, prefixIndice->getID(), +- return new WP6FillStylePacket(input, encryption, prefixIndice->getID(), - prefixIndice->getDataOffset(), prefixIndice->getDataSize()); - case WP6_INDEX_HEADER_EXTENDED_DOCUMENT_SUMMARY: -- return new WP6ExtendedDocumentSummaryPacket(input, encryption, prefixIndice->getID(), +- return new WP6ExtendedDocumentSummaryPacket(input, encryption, prefixIndice->getID(), - prefixIndice->getDataOffset(), prefixIndice->getDataSize()); - case WP6_INDEX_HEADER_OUTLINE_STYLE: -- return new WP6OutlineStylePacket(input, encryption, prefixIndice->getID(), +- return new WP6OutlineStylePacket(input, encryption, prefixIndice->getID(), - prefixIndice->getDataOffset(), prefixIndice->getDataSize()); - case WP6_INDEX_HEADER_GRAPHICS_FILENAME: -- return new WP6GraphicsFilenamePacket(input, encryption, prefixIndice->getID(), prefixIndice->getFlags(), +- return new WP6GraphicsFilenamePacket(input, encryption, prefixIndice->getID(), prefixIndice->getFlags(), - prefixIndice->getDataOffset(), prefixIndice->getDataSize()); - case WP6_INDEX_HEADER_GRAPHICS_CACHED_FILE_DATA: - return new WP6GraphicsCachedFileDataPacket(input, encryption, prefixIndice->getID(), @@ -103,5 +103,5 @@ } + return tmpPacket; } - + void WP6PrefixDataPacket::_read(WPXInputStream *input, WPXEncryption *encryption, uint32_t dataOffset, uint32_t dataSize) -- cgit v1.2.3 From bd02cce8d88b84760505757974639531e8346669 Mon Sep 17 00:00:00 2001 From: Fridrich Štrba Date: Fri, 1 Apr 2011 18:53:57 +0200 Subject: Now the patch applies --- libwpd/makefile.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libwpd/makefile.mk b/libwpd/makefile.mk index dd46e3e..6ecbbfa 100644 --- a/libwpd/makefile.mk +++ b/libwpd/makefile.mk @@ -44,8 +44,8 @@ TARGET=wpd TARFILE_NAME=libwpd-0.9.1 TARFILE_MD5=5ff846847dab351604ad859e2fd4ed3c PATCH_FILES=libwpd.gcc460.patch \ + libwpd.corruptedprefix.patch \ libwpd.warnings.patch -# libwpd.corruptedprefix.patch \ - disabled ... BUILD_ACTION=dmake $(MFLAGS) $(CALLMACROS) BUILD_DIR=src$/lib -- cgit v1.2.3 From f909227b9e10aeeb0041d31f998236411d653d6b Mon Sep 17 00:00:00 2001 From: Petr Mladek Date: Mon, 4 Apr 2011 15:03:08 +0200 Subject: add --skipsource option to translate toolkit (bugs.locamotion.org#1883) it will be used to fix problems with missing translations (fdo#35067 and fdo#35068 - originally fdo#33189) --- translate_toolkit/makefile.mk | 1 + .../translate-toolkit-1.8.1-skipsource.patch | 99 ++++++++++++++++++++++ 2 files changed, 100 insertions(+) create mode 100644 translate_toolkit/translate-toolkit-1.8.1-skipsource.patch diff --git a/translate_toolkit/makefile.mk b/translate_toolkit/makefile.mk index 9d0fbf6..334f663 100644 --- a/translate_toolkit/makefile.mk +++ b/translate_toolkit/makefile.mk @@ -69,6 +69,7 @@ PY_CMD=$(AUGMENT_LIBRARY_PATH) $(WRAPCMD) $(SOLARBINDIR)/python TARFILE_NAME=translate-toolkit-1.8.1 TARFILE_MD5=b4cae0700aa1c2aef7eb7f345365e6f1 +PATCH_FILES=translate-toolkit-1.8.1-skipsource.patch BUILD_ACTION=$(PY_CMD) setup.py build BUILD_DIR= diff --git a/translate_toolkit/translate-toolkit-1.8.1-skipsource.patch b/translate_toolkit/translate-toolkit-1.8.1-skipsource.patch new file mode 100644 index 0000000..c4cd7a0 --- /dev/null +++ b/translate_toolkit/translate-toolkit-1.8.1-skipsource.patch @@ -0,0 +1,99 @@ +Index: convert/po2oo.py +=================================================================== +--- misc/translate-toolkit-1.8.1/translate/convert/po2oo.py (revision 17314) ++++ misc/build/translate-toolkit-1.8.1/translate/convert/po2oo.py (working copy) +@@ -188,7 +188,7 @@ + filter = oocheckfilter(options, [checks.OpenOfficeChecker, checks.StandardUnitChecker], checks.openofficeconfig) + + +-def convertoo(inputfile, outputfile, templatefile, sourcelanguage=None, targetlanguage=None, timestamp=None, includefuzzy=False, multifilestyle="single", filteraction=None): ++def convertoo(inputfile, outputfile, templatefile, sourcelanguage=None, targetlanguage=None, timestamp=None, includefuzzy=False, multifilestyle="single", skip_source=False, filteraction=None): + inputstore = factory.getobject(inputfile) + inputstore.filename = getattr(inputfile, 'name', '') + if not targetlanguage: +@@ -205,7 +205,7 @@ + convertor = reoo(templatefile, languages=languages, timestamp=timestamp, includefuzzy=includefuzzy, long_keys=multifilestyle != "single", filteraction=filteraction) + outputstore = convertor.convertstore(inputstore) + # TODO: check if we need to manually delete missing items +- outputfile.write(str(outputstore)) ++ outputfile.write(outputstore.__str__(skip_source, targetlanguage)) + return True + + +@@ -223,6 +223,7 @@ + help="don't change the timestamps of the strings") + parser.add_option("", "--nonrecursiveoutput", dest="allowrecursiveoutput", default=True, action="store_false", help="don't treat the output oo as a recursive store") + parser.add_option("", "--nonrecursivetemplate", dest="allowrecursivetemplate", default=True, action="store_false", help="don't treat the template oo as a recursive store") ++ parser.add_option("", "--skipsource", dest="skip_source", default=False, action="store_true", help="don't output the source language, but fallback to it where needed") + parser.add_option("", "--filteraction", dest="filteraction", default="none", metavar="ACTION", + help="action on pofilter failure: none (default), warn, exclude-serious, exclude-all") + parser.add_fuzzy_option() +@@ -230,6 +231,7 @@ + parser.passthrough.append("sourcelanguage") + parser.passthrough.append("targetlanguage") + parser.passthrough.append("timestamp") ++ parser.passthrough.append("skip_source") + parser.passthrough.append("filteraction") + parser.run(argv) + +Index: convert/test_po2oo.py +=================================================================== +--- misc/translate-toolkit-1.8.1/translate/convert/test_po2oo.py (revision 17280) ++++ misc/build/translate-toolkit-1.8.1/translate/convert/test_po2oo.py (working copy) +@@ -170,6 +170,7 @@ + options = self.help_check(options, "--nonrecursiveoutput") + options = self.help_check(options, "--nonrecursivetemplate") + options = self.help_check(options, "--filteraction") ++ options = self.help_check(options, "--skipsource") + options = self.help_check(options, "--fuzzy") + options = self.help_check(options, "--nofuzzy") + options = self.help_check(options, "-t TEMPLATE, --template=TEMPLATE") +Index: storage/oo.py +=================================================================== +--- misc/translate-toolkit-1.8.1/translate/storage/oo.py (revision 17301) ++++ misc/build/translate-toolkit-1.8.1/translate/storage/oo.py (working copy) +@@ -246,9 +246,18 @@ + """convert to a string. double check that unicode is handled""" + return encode_if_needed_utf8(self.getoutput()) + +- def getoutput(self): ++ def getoutput(self, skip_source=False, fallback_lang=None): + """return the lines in tab-delimited form""" +- return "\r\n".join([str(line) for line in self.lines]) ++ if skip_source: ++ lines = self.lines[1:] ++ if not lines: ++ # Untranslated, so let's do fall-back: (bug 1883) ++ new_line = ooline(self.lines[0].getparts()) ++ new_line.languageid = fallback_lang ++ lines = [new_line] ++ else: ++ lines = self.lines ++ return "\r\n".join([str(line) for line in lines]) + + + class oofile: +@@ -295,11 +304,11 @@ + thisline = ooline(parts) + self.addline(thisline) + +- def __str__(self): ++ def __str__(self, skip_source=False, fallback_lang=None): + """convert to a string. double check that unicode is handled""" +- return encode_if_needed_utf8(self.getoutput()) ++ return encode_if_needed_utf8(self.getoutput(skip_source, fallback_lang)) + +- def getoutput(self): ++ def getoutput(self, skip_source=False, fallback_lang=None): + """converts all the lines back to tab-delimited form""" + lines = [] + for oe in self.units: +@@ -307,7 +316,7 @@ + warnings.warn("contains %d lines (should be 2 at most): languages %r" % (len(oe.lines), oe.languages)) + oekeys = [line.getkey() for line in oe.lines] + warnings.warn("contains %d lines (should be 2 at most): keys %r" % (len(oe.lines), oekeys)) +- oeline = str(oe) + "\r\n" ++ oeline = oe.getoutput(skip_source, fallback_lang) + "\r\n" + lines.append(oeline) + return "".join(lines) + -- cgit v1.2.3