コード例 #1
0
ファイル: test_po2dtd.py プロジェクト: AshishNamdev/verbatim
 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
コード例 #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
コード例 #3
0
ファイル: test_po2dtd.py プロジェクト: ANKIT-KS/fjord
 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
コード例 #4
0
 def convertdtd(self, dtdsource):
     """call the convertdtd, return the outputfile"""
     inputfile = BytesIO(dtdsource.encode())
     outputfile = BytesIO()
     templatefile = None
     assert dtd2po.convertdtd(inputfile, outputfile, templatefile)
     return outputfile.getvalue()
コード例 #5
0
ファイル: test_po2dtd.py プロジェクト: cloph/translate
 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
コード例 #6
0
ファイル: test_dtd2po.py プロジェクト: zbj00/translate
 def convertdtd(self, dtdsource):
     """call the convertdtd, return the outputfile"""
     inputfile = wStringIO.StringIO(dtdsource)
     outputfile = wStringIO.StringIO()
     templatefile = None
     assert dtd2po.convertdtd(inputfile, outputfile, templatefile)
     return outputfile.getvalue()
コード例 #7
0
ファイル: test_dtd2po.py プロジェクト: anderson916/translate
 def convertdtd(self, dtdsource):
     """call the convertdtd, return the outputfile"""
     inputfile = wStringIO.StringIO(dtdsource)
     outputfile = wStringIO.StringIO()
     templatefile = None
     assert dtd2po.convertdtd(inputfile, outputfile, templatefile)
     return outputfile.getvalue()