Ejemplo n.º 1
0
 def roundtripsource(self, dtdsource):
     """converts dtd source to po and back again, returning the resulting source"""
     dtdinputfile = wStringIO.StringIO(dtdsource)
     dtdinputfile2 = wStringIO.StringIO(dtdsource)
     pooutputfile = wStringIO.StringIO()
     dtd2po.convertdtd(dtdinputfile, pooutputfile, dtdinputfile2)
     posource = pooutputfile.getvalue()
     poinputfile = wStringIO.StringIO(posource)
     dtdtemplatefile = wStringIO.StringIO(dtdsource)
     dtdoutputfile = wStringIO.StringIO()
     po2dtd.convertdtd(poinputfile, dtdoutputfile, dtdtemplatefile)
     dtdresult = dtdoutputfile.getvalue()
     print "original dtd:\n", dtdsource, "po version:\n", posource, "output dtd:\n", dtdresult
     return dtdresult
Ejemplo n.º 2
0
 def roundtripsource(self, dtdsource):
     """converts dtd source to po and back again, returning the resulting source"""
     dtdinputfile = wStringIO.StringIO(dtdsource)
     dtdinputfile2 = wStringIO.StringIO(dtdsource)
     pooutputfile = wStringIO.StringIO()
     dtd2po.convertdtd(dtdinputfile, pooutputfile, dtdinputfile2)
     posource = pooutputfile.getvalue()
     poinputfile = wStringIO.StringIO(posource)
     dtdtemplatefile = wStringIO.StringIO(dtdsource)
     dtdoutputfile = wStringIO.StringIO()
     po2dtd.convertdtd(poinputfile, dtdoutputfile, dtdtemplatefile)
     dtdresult = dtdoutputfile.getvalue()
     print "original dtd:\n", dtdsource, "po version:\n", posource, "output dtd:\n", dtdresult
     return dtdresult
Ejemplo n.º 3
0
 def roundtripsource(self, dtdsource):
     """converts dtd source to po and back again, returning the resulting source"""
     dtdinputfile = wStringIO.StringIO(dtdsource)
     dtdinputfile2 = wStringIO.StringIO(dtdsource)
     pooutputfile = wStringIO.StringIO()
     dtd2po.convertdtd(dtdinputfile, pooutputfile, dtdinputfile2)
     posource = pooutputfile.getvalue()
     poinputfile = wStringIO.StringIO(posource)
     dtdtemplatefile = wStringIO.StringIO(dtdsource)
     dtdoutputfile = wStringIO.StringIO()
     po2dtd.convertdtd(poinputfile, dtdoutputfile, dtdtemplatefile)
     dtdresult = dtdoutputfile.getvalue()
     print_string = "Original DTD:\n%s\n\nPO version:\n%s\n\n"
     print_string = print_string + "Output DTD:\n%s\n################"
     print print_string % (dtdsource, posource, dtdresult)
     return dtdresult
Ejemplo n.º 4
0
 def roundtripsource(self, dtdsource):
     """converts dtd source to po and back again, returning the resulting source"""
     dtdinputfile = wStringIO.StringIO(dtdsource)
     dtdinputfile2 = wStringIO.StringIO(dtdsource)
     pooutputfile = wStringIO.StringIO()
     dtd2po.convertdtd(dtdinputfile, pooutputfile, dtdinputfile2)
     posource = pooutputfile.getvalue()
     poinputfile = wStringIO.StringIO(posource)
     dtdtemplatefile = wStringIO.StringIO(dtdsource)
     dtdoutputfile = wStringIO.StringIO()
     po2dtd.convertdtd(poinputfile, dtdoutputfile, dtdtemplatefile)
     dtdresult = dtdoutputfile.getvalue().decode('utf-8')
     print_string = "Original DTD:\n%s\n\nPO version:\n%s\n\n"
     print_string = print_string + "Output DTD:\n%s\n################"
     print(print_string % (dtdsource, posource, dtdresult))
     return dtdresult
Ejemplo n.º 5
0
 def convertdtd(self, posource, dtdtemplate):
     """helper to exercise the command line function"""
     inputfile = wStringIO.StringIO(posource)
     outputfile = wStringIO.StringIO()
     templatefile = wStringIO.StringIO(dtdtemplate)
     assert po2dtd.convertdtd(inputfile, outputfile, templatefile)
     return outputfile.getvalue()
Ejemplo n.º 6
0
 def convertdtd(self, posource, dtdtemplate):
     """helper to exercise the command line function"""
     inputfile = wStringIO.StringIO(posource)
     outputfile = wStringIO.StringIO()
     templatefile = wStringIO.StringIO(dtdtemplate)
     assert po2dtd.convertdtd(inputfile, outputfile, templatefile)
     return outputfile.getvalue()
Ejemplo n.º 7
0
 def convertdtd(self, posource, dtdtemplate, remove_untranslated=False):
     """helper to exercise the command line function"""
     inputfile = wStringIO.StringIO(posource)
     outputfile = wStringIO.StringIO()
     templatefile = wStringIO.StringIO(dtdtemplate)
     assert po2dtd.convertdtd(inputfile, outputfile, templatefile,
                              remove_untranslated=remove_untranslated)
     return outputfile.getvalue().decode('utf-8')
Ejemplo n.º 8
0
 def convertdtd(self, posource, dtdtemplate, remove_untranslated=False):
     """helper to exercise the command line function"""
     inputfile = wStringIO.StringIO(posource)
     outputfile = wStringIO.StringIO()
     templatefile = wStringIO.StringIO(dtdtemplate)
     assert po2dtd.convertdtd(inputfile,
                              outputfile,
                              templatefile,
                              remove_untranslated=remove_untranslated)
     return outputfile.getvalue().decode('utf-8')
Ejemplo n.º 9
0
 def convertdtd(posource, dtdtemplate, remove_untranslated=False):
     """helper to exercise the command line function"""
     inputfile = BytesIO(posource.encode())
     outputfile = BytesIO()
     templatefile = BytesIO(dtdtemplate.encode())
     assert po2dtd.convertdtd(inputfile,
                              outputfile,
                              templatefile,
                              remove_untranslated=remove_untranslated)
     return outputfile.getvalue().decode("utf-8")