예제 #1
0
파일: vlam.py 프로젝트: Mekyi/crunchy
 def read(self):  # tested
     '''create fake file from a tree, adding DTD and charset information
        and return its value as a string'''
     self.fix_divs()  # fix required when using etree
     fake_file = StringIO()
     fake_file.write(DTD + '\n')
     self.add_charset()
     try:
         self.tree.write(fake_file)
     except Exception:
         return handle_exception()
     return fake_file.getvalue()
예제 #2
0
파일: vlam.py 프로젝트: wolverine2k/crunchy
 def read(self):  # tested
     '''create fake file from a tree, adding DTD and charset information
        and return its value as a string'''
     self.fix_divs()  # fix required when using etree
     fake_file = StringIO()
     fake_file.write(DTD + '\n')
     self.add_charset()
     try:
         self.tree.write(fake_file)
     except Exception:
         return handle_exception()
     return fake_file.getvalue()