示例#1
0
 def test_parse(self):
     handler = HandlersManager.get_best_handler(".odt")
     myfile = handler(self.FILE, os.path.basename(self.FILE))
     self.assertTrue(myfile.is_valid())
     self.assertEquals(tuple(myfile.attributes), ("nb_pages", "format"))
     self.assertEqual("A4", myfile.format)
     self.assertEqual(3, myfile.nb_pages)
示例#2
0
 def test_parse(self):
     handler = HandlersManager.get_best_handler(".odt")
     myfile = handler(self.FILE, os.path.basename(self.FILE))
     self.failUnless(myfile.is_valid())
     self.assertEquals(tuple(myfile.attributes), ("nb_pages", "format"))
     self.assertEqual("A4", myfile.format)
     self.assertEqual(3, myfile.nb_pages)
示例#3
0
文件: models.py 项目: amarh/openPLM
 def handle_added_file(self, doc_file):
     if os.path.splitext(doc_file.file.path)[1].lower() == ".odt":
         handler_cls = HandlersManager.get_best_handler(".odt")
         handler = handler_cls(doc_file.file.path, doc_file.filename)
         if handler.is_valid():
             self.nb_pages = handler.nb_pages
             self.format = handler.format
             self.save()
示例#4
0
 def handle_added_file(self, doc_file):
     if os.path.splitext(doc_file.file.path)[1].lower() == ".odt":
         handler_cls = HandlersManager.get_best_handler(".odt")
         handler = handler_cls(doc_file.file.path, doc_file.filename)
         if handler.is_valid():
             self.nb_pages = handler.nb_pages
             self.format = handler.format
             self.save()
示例#5
0
 def handle_added_file(self, doc_file):
     ext = os.path.splitext(doc_file.file.path)[1].lower() 
     if os.path.splitext(doc_file.file.path)[1].lower() == ".pdf":
         handler_cls = HandlersManager.get_best_handler(".pdf")
         handler = handler_cls(doc_file.file.path, doc_file.filename)
         if handler.is_valid():
             self.nb_pages = handler.nb_pages
             self.name = handler.title
     self.save()
示例#6
0
 def handle_added_file(self, doc_file):
     ext = os.path.splitext(doc_file.file.path)[1].lower() 
     if os.path.splitext(doc_file.file.path)[1].lower() == ".pdf":
         handler_cls = HandlersManager.get_best_handler(".pdf")
         handler = handler_cls(doc_file.file.path, doc_file.filename)
         if handler.is_valid():
             self.nb_pages = handler.nb_pages
             self.name = handler.title
     self.save()
示例#7
0
 def test_get_handler(self):
     handler = HandlersManager.get_best_handler(".odt")
     self.assertEquals(handler, ODFHandler)
示例#8
0
 def test_get_handler(self):
     handler = HandlersManager.get_best_handler(".odt")
     self.assertEquals(handler, ODFHandler)