[Erp5-report] r43966 nicolas - in /erp5/trunk/utils/cloudooo/cloudooo/handler: ffmpeg/ ffmp...

nobody at svn.erp5.org nobody at svn.erp5.org
Fri Mar 4 11:59:49 CET 2011


Author: nicolas
Date: Fri Mar  4 11:59:49 2011
New Revision: 43966

URL: http://svn.erp5.org?rev=43966&view=rev
Log:
Rename All IHandler Class with name "Handler" as it make them easier to imports
dynamically.
As they all belong to a different namespace they can not collide with each other.


Modified:
    erp5/trunk/utils/cloudooo/cloudooo/handler/ffmpeg/handler.py
    erp5/trunk/utils/cloudooo/cloudooo/handler/ffmpeg/tests/testAllSupportedFormat.py
    erp5/trunk/utils/cloudooo/cloudooo/handler/ffmpeg/tests/testFFMPEGHandler.py
    erp5/trunk/utils/cloudooo/cloudooo/handler/ffmpeg/tests/testInterface.py
    erp5/trunk/utils/cloudooo/cloudooo/handler/imagemagick/handler.py
    erp5/trunk/utils/cloudooo/cloudooo/handler/imagemagick/tests/testImageMagickHandler.py
    erp5/trunk/utils/cloudooo/cloudooo/handler/ooo/handler.py
    erp5/trunk/utils/cloudooo/cloudooo/handler/ooo/tests/testInterface.py
    erp5/trunk/utils/cloudooo/cloudooo/handler/ooo/tests/testOOHandler.py
    erp5/trunk/utils/cloudooo/cloudooo/handler/pdf/handler.py
    erp5/trunk/utils/cloudooo/cloudooo/handler/pdf/tests/testPDFHandler.py

Modified: erp5/trunk/utils/cloudooo/cloudooo/handler/ffmpeg/handler.py
URL: http://svn.erp5.org/erp5/trunk/utils/cloudooo/cloudooo/handler/ffmpeg/handler.py?rev=43966&r1=43965&r2=43966&view=diff
==============================================================================
--- erp5/trunk/utils/cloudooo/cloudooo/handler/ffmpeg/handler.py [utf8] (original)
+++ erp5/trunk/utils/cloudooo/cloudooo/handler/ffmpeg/handler.py [utf8] Fri Mar  4 11:59:49 2011
@@ -33,8 +33,8 @@ from subprocess import Popen, PIPE
 from tempfile import mktemp
 
 
-class FFMPEGHandler(object):
-  """FFMPEGHandler is used to handler inputed video files"""
+class Handler(object):
+  """FFMPEG Handler is used to handler inputed video files"""
 
   implements(IHandler)
 

Modified: erp5/trunk/utils/cloudooo/cloudooo/handler/ffmpeg/tests/testAllSupportedFormat.py
URL: http://svn.erp5.org/erp5/trunk/utils/cloudooo/cloudooo/handler/ffmpeg/tests/testAllSupportedFormat.py?rev=43966&r1=43965&r2=43966&view=diff
==============================================================================
--- erp5/trunk/utils/cloudooo/cloudooo/handler/ffmpeg/tests/testAllSupportedFormat.py [utf8] (original)
+++ erp5/trunk/utils/cloudooo/cloudooo/handler/ffmpeg/tests/testAllSupportedFormat.py [utf8] Fri Mar  4 11:59:49 2011
@@ -27,7 +27,7 @@
 ##############################################################################
 
 from magic import Magic
-from cloudooo.handler.ffmpeg.handler import FFMPEGHandler
+from cloudooo.handler.ffmpeg.handler import Handler
 from cloudooo.handler.tests.handlerTestCase import HandlerTestCase, make_suite
 
 
@@ -36,11 +36,11 @@ class TestAllSupportedFormat(HandlerTest
   def afterSetUp(self):
     self.data = open("./data/test.ogv").read()
     self.kw = dict(env=dict(PATH=self.env_path))
-    self.input = FFMPEGHandler(self.tmp_url, self.data, "ogv", **self.kw)
+    self.input = Handler(self.tmp_url, self.data, "ogv", **self.kw)
     self.file_detector = Magic(mime=True)
 
   def afterFormat(self, data):
-    ogv_file = FFMPEGHandler(self.tmp_url, data, "avi", **self.kw)
+    ogv_file = Handler(self.tmp_url, data, "avi", **self.kw)
     ogv_data = ogv_file.convert("ogv")
     ogv_mimetype = self.file_detector.from_buffer(ogv_data)
     return ogv_mimetype

Modified: erp5/trunk/utils/cloudooo/cloudooo/handler/ffmpeg/tests/testFFMPEGHandler.py
URL: http://svn.erp5.org/erp5/trunk/utils/cloudooo/cloudooo/handler/ffmpeg/tests/testFFMPEGHandler.py?rev=43966&r1=43965&r2=43966&view=diff
==============================================================================
--- erp5/trunk/utils/cloudooo/cloudooo/handler/ffmpeg/tests/testFFMPEGHandler.py [utf8] (original)
+++ erp5/trunk/utils/cloudooo/cloudooo/handler/ffmpeg/tests/testFFMPEGHandler.py [utf8] Fri Mar  4 11:59:49 2011
@@ -27,16 +27,16 @@
 ##############################################################################
 
 import magic
-from cloudooo.handler.ffmpeg.handler import FFMPEGHandler
+from cloudooo.handler.ffmpeg.handler import Handler
 from cloudooo.handler.tests.handlerTestCase import HandlerTestCase, make_suite
 
 
-class TestFFMPEGHandler(HandlerTestCase):
+class TestHandler(HandlerTestCase):
 
   def afterSetUp(self):
     self.data = open("./data/test.ogv").read()
     kw = dict(env=dict(PATH=self.env_path))
-    self.input = FFMPEGHandler(self.tmp_url, self.data, "ogv", **kw)
+    self.input = Handler(self.tmp_url, self.data, "ogv", **kw)
 
   def testConvertVideo(self):
     """Test coversion of video to another format"""
@@ -55,4 +55,4 @@ class TestFFMPEGHandler(HandlerTestCase)
 
 
 def test_suite():
-  return make_suite(TestFFMPEGHandler)
+  return make_suite(TestHandler)

Modified: erp5/trunk/utils/cloudooo/cloudooo/handler/ffmpeg/tests/testInterface.py
URL: http://svn.erp5.org/erp5/trunk/utils/cloudooo/cloudooo/handler/ffmpeg/tests/testInterface.py?rev=43966&r1=43965&r2=43966&view=diff
==============================================================================
--- erp5/trunk/utils/cloudooo/cloudooo/handler/ffmpeg/tests/testInterface.py [utf8] (original)
+++ erp5/trunk/utils/cloudooo/cloudooo/handler/ffmpeg/tests/testInterface.py [utf8] Fri Mar  4 11:59:49 2011
@@ -28,7 +28,7 @@
 
 import unittest
 from cloudooo.interfaces.handler import IHandler
-from cloudooo.handler.ffmpeg.handler import FFMPEGHandler
+from cloudooo.handler.ffmpeg.handler import Handler
 from cloudooo.handler.tests.handlerTestCase import make_suite
 
 
@@ -37,8 +37,8 @@ class TestInterface(unittest.TestCase):
 
   def testIHandler(self):
     """Test if Handlers implements IHandler"""
-    # XXX this might verify FFMPEGHandler methods too
-    self.assertTrue(IHandler.implementedBy(FFMPEGHandler))
+    # XXX this might verify Handler methods too
+    self.assertTrue(IHandler.implementedBy(Handler))
 
 
 def test_suite():

Modified: erp5/trunk/utils/cloudooo/cloudooo/handler/imagemagick/handler.py
URL: http://svn.erp5.org/erp5/trunk/utils/cloudooo/cloudooo/handler/imagemagick/handler.py?rev=43966&r1=43965&r2=43966&view=diff
==============================================================================
--- erp5/trunk/utils/cloudooo/cloudooo/handler/imagemagick/handler.py [utf8] (original)
+++ erp5/trunk/utils/cloudooo/cloudooo/handler/imagemagick/handler.py [utf8] Fri Mar  4 11:59:49 2011
@@ -34,8 +34,8 @@ from subprocess import Popen, PIPE
 from tempfile import mktemp
 
 
-class ImageMagickHandler(object):
-  """ImageMagicHandler is used to handler images."""
+class Handler(object):
+  """ImageMagic Handler is used to handler images."""
 
   implements(IHandler)
 

Modified: erp5/trunk/utils/cloudooo/cloudooo/handler/imagemagick/tests/testImageMagickHandler.py
URL: http://svn.erp5.org/erp5/trunk/utils/cloudooo/cloudooo/handler/imagemagick/tests/testImageMagickHandler.py?rev=43966&r1=43965&r2=43966&view=diff
==============================================================================
--- erp5/trunk/utils/cloudooo/cloudooo/handler/imagemagick/tests/testImageMagickHandler.py [utf8] (original)
+++ erp5/trunk/utils/cloudooo/cloudooo/handler/imagemagick/tests/testImageMagickHandler.py [utf8] Fri Mar  4 11:59:49 2011
@@ -28,11 +28,11 @@
 
 
 import magic
-from cloudooo.handler.imagemagick.handler import ImageMagickHandler
+from cloudooo.handler.imagemagick.handler import Handler
 from cloudooo.handler.tests.handlerTestCase import HandlerTestCase, make_suite
 
 
-class TestImageMagickHandler(HandlerTestCase):
+class TestHandler(HandlerTestCase):
 
   def afterSetUp(self):
     self.kw = dict(env=dict(PATH=self.env_path))
@@ -40,7 +40,7 @@ class TestImageMagickHandler(HandlerTest
   def testConvertPNGtoJPG(self):
     """Test conversion of png to jpg"""
     png_file = open("data/test.png").read()
-    handler = ImageMagickHandler(self.tmp_url, png_file, "png", **self.kw)
+    handler = Handler(self.tmp_url, png_file, "png", **self.kw)
     jpg_file = handler.convert("jpg")
     mime = magic.Magic(mime=True)
     jpg_mimetype = mime.from_buffer(jpg_file)
@@ -49,7 +49,7 @@ class TestImageMagickHandler(HandlerTest
   def testgetMetadataFromImage(self):
     """Test if metadata is extracted from image correctly"""
     png_file = open("data/test.png").read()
-    handler = ImageMagickHandler(self.tmp_url, png_file, "png", **self.kw)
+    handler = Handler(self.tmp_url, png_file, "png", **self.kw)
     metadata = handler.getMetadata()
     self.assertEquals(metadata.get("Compression"), "Zip")
     self.assertEquals(metadata.get("Colorspace"), "RGB")
@@ -57,9 +57,9 @@ class TestImageMagickHandler(HandlerTest
 
   def testsetMetadata(self):
     """ Test if metadata are inserted correclty """
-    handler = ImageMagickHandler(self.tmp_url, "", "png", **self.kw)
+    handler = Handler(self.tmp_url, "", "png", **self.kw)
     self.assertRaises(NotImplementedError, handler.setMetadata)
 
 
 def test_suite():
-  return make_suite(TestImageMagickHandler)
+  return make_suite(TestHandler)

Modified: erp5/trunk/utils/cloudooo/cloudooo/handler/ooo/handler.py
URL: http://svn.erp5.org/erp5/trunk/utils/cloudooo/cloudooo/handler/ooo/handler.py?rev=43966&r1=43965&r2=43966&view=diff
==============================================================================
--- erp5/trunk/utils/cloudooo/cloudooo/handler/ooo/handler.py [utf8] (original)
+++ erp5/trunk/utils/cloudooo/cloudooo/handler/ooo/handler.py [utf8] Fri Mar  4 11:59:49 2011
@@ -43,8 +43,8 @@ from cloudooo.utils.utils import logger
 from psutil import pid_exists
 
 
-class OOHandler(object):
-  """OOHandler is used to access the one Document and OpenOffice.
+class Handler(object):
+  """OOO Handler is used to access the one Document and OpenOffice.
   For each Document inputed is created on instance of this class to manipulate
   the document. This Document must be able to create and remove a temporary
   document at FS, load and export.

Modified: erp5/trunk/utils/cloudooo/cloudooo/handler/ooo/tests/testInterface.py
URL: http://svn.erp5.org/erp5/trunk/utils/cloudooo/cloudooo/handler/ooo/tests/testInterface.py?rev=43966&r1=43965&r2=43966&view=diff
==============================================================================
--- erp5/trunk/utils/cloudooo/cloudooo/handler/ooo/tests/testInterface.py [utf8] (original)
+++ erp5/trunk/utils/cloudooo/cloudooo/handler/ooo/tests/testInterface.py [utf8] Fri Mar  4 11:59:49 2011
@@ -28,7 +28,7 @@
 
 import unittest
 from cloudooo.handler.ooo.document import FileSystemDocument, OdfDocument
-from cloudooo.handler.ooo.handler import OOHandler
+from cloudooo.handler.ooo.handler import Handler
 from cloudooo.handler.ooo.application.openoffice import OpenOffice
 from cloudooo.manager import Manager
 from cloudooo.handler.ooo.mimemapper import MimeMapper
@@ -142,7 +142,7 @@ class TestInterface(unittest.TestCase):
 
   def testIHandler(self):
     """Test if Handlers implements IHandler"""
-    self.assertTrue(IHandler.implementedBy(OOHandler))
+    self.assertTrue(IHandler.implementedBy(Handler))
     method_list = ['convert', 'getMetadata', 'setMetadata']
     for method in method_list:
       self.assertTrue(method in IHandler.names(),

Modified: erp5/trunk/utils/cloudooo/cloudooo/handler/ooo/tests/testOOHandler.py
URL: http://svn.erp5.org/erp5/trunk/utils/cloudooo/cloudooo/handler/ooo/tests/testOOHandler.py?rev=43966&r1=43965&r2=43966&view=diff
==============================================================================
--- erp5/trunk/utils/cloudooo/cloudooo/handler/ooo/tests/testOOHandler.py [utf8] (original)
+++ erp5/trunk/utils/cloudooo/cloudooo/handler/ooo/tests/testOOHandler.py [utf8] Fri Mar  4 11:59:49 2011
@@ -30,7 +30,7 @@ import magic
 from os import path
 from base64 import encodestring, decodestring
 from cloudooo.handler.tests.handlerTestCase import HandlerTestCase, make_suite
-from cloudooo.handler.ooo.handler import OOHandler
+from cloudooo.handler.ooo.handler import Handler
 from cloudooo.handler.ooo.application.openoffice import openoffice
 import os
 from lxml import etree
@@ -39,8 +39,8 @@ from zipfile import ZipFile
 OPENOFFICE = True
 
 
-class TestOOHandler(HandlerTestCase):
-  """Test OOHandler and manipulation of OOo Instance"""
+class TestHandler(HandlerTestCase):
+  """Test OOO Handler and manipulation of OOo Instance"""
 
   _file_path_list = []
 
@@ -69,7 +69,7 @@ class TestOOHandler(HandlerTestCase):
   def testConvertOdtToDoc(self):
     """Test convert ODT to DOC"""
     data = encodestring(open("data/test.odt").read())
-    handler = OOHandler(self.tmp_url,
+    handler = Handler(self.tmp_url,
                         decodestring(data),
                         'odt')
     doc_exported = handler.convert("doc")
@@ -78,7 +78,7 @@ class TestOOHandler(HandlerTestCase):
   def testConvertDocToOdt(self):
     """Test convert DOC to ODT"""
     data = encodestring(open("data/test.doc").read())
-    handler = OOHandler(self.tmp_url,
+    handler = Handler(self.tmp_url,
                         decodestring(data),
                         'doc')
     doc_exported = handler.convert("odt")
@@ -88,7 +88,7 @@ class TestOOHandler(HandlerTestCase):
   def testGetMetadata(self):
     """Test getMetadata"""
     data = encodestring(open("data/test.odt").read())
-    handler = OOHandler(self.tmp_url,
+    handler = Handler(self.tmp_url,
                         decodestring(data),
                         'odt')
     metadata = handler.getMetadata()
@@ -101,20 +101,20 @@ class TestOOHandler(HandlerTestCase):
   def testSetMetadata(self):
     """Test setMetadata"""
     data = encodestring(open("data/test.odt").read())
-    handler = OOHandler(self.tmp_url,
+    handler = Handler(self.tmp_url,
                         decodestring(data),
                         'odt')
     new_data = handler.setMetadata({"Title": "cloudooo Test -"})
-    new_handler = OOHandler(self.tmp_url,
+    new_handler = Handler(self.tmp_url,
                             new_data,
                             'odt')
     metadata = new_handler.getMetadata()
     self.assertEquals(metadata.get('Title'), "cloudooo Test -")
-    handler = OOHandler(self.tmp_url,
+    handler = Handler(self.tmp_url,
                         decodestring(data),
                         'odt')
     new_data = handler.setMetadata({"Title": "Namie's working record"})
-    new_handler = OOHandler(self.tmp_url,
+    new_handler = Handler(self.tmp_url,
                             new_data,
                             'odt')
     metadata = new_handler.getMetadata()
@@ -124,7 +124,7 @@ class TestOOHandler(HandlerTestCase):
     """Test convert with openoffice stopped"""
     openoffice.stop()
     data = encodestring(open("data/test.doc").read())
-    handler = OOHandler(self.tmp_url,
+    handler = Handler(self.tmp_url,
                         decodestring(data),
                         'doc')
     doc_exported = handler.convert("odt")
@@ -135,7 +135,7 @@ class TestOOHandler(HandlerTestCase):
     """Test getMetadata with openoffice stopped"""
     openoffice.stop()
     data = encodestring(open("data/test.odt").read())
-    handler = OOHandler(self.tmp_url,
+    handler = Handler(self.tmp_url,
                         decodestring(data),
                         'odt')
     metadata = handler.getMetadata()
@@ -147,11 +147,11 @@ class TestOOHandler(HandlerTestCase):
     """Test setMetadata with openoffice stopped"""
     openoffice.stop()
     data = encodestring(open("data/test.doc").read())
-    handler = OOHandler(self.tmp_url,
+    handler = Handler(self.tmp_url,
                         decodestring(data),
                         'doc')
     new_data = handler.setMetadata({"Title": "cloudooo Test -"})
-    new_handler = OOHandler(self.tmp_url,
+    new_handler = Handler(self.tmp_url,
                             new_data,
                             'doc')
     metadata = new_handler.getMetadata()
@@ -161,7 +161,7 @@ class TestOOHandler(HandlerTestCase):
     """Test refresh argument"""
     # Check when refreshing is disabled
     data = encodestring(open("data/test_fields.odt").read())
-    handler = OOHandler(self.tmp_url,
+    handler = Handler(self.tmp_url,
                         decodestring(data),
                         'odt',
                         refresh=False)
@@ -175,7 +175,7 @@ class TestOOHandler(HandlerTestCase):
 
     # Check when refreshing is enabled
     data = encodestring(open("data/test_fields.odt").read())
-    handler = OOHandler(self.tmp_url,
+    handler = Handler(self.tmp_url,
                         decodestring(data),
                         'odt',
                         refresh=True)
@@ -189,4 +189,4 @@ class TestOOHandler(HandlerTestCase):
 
 
 def test_suite():
-  return make_suite(TestOOHandler)
+  return make_suite(TestHandler)

Modified: erp5/trunk/utils/cloudooo/cloudooo/handler/pdf/handler.py
URL: http://svn.erp5.org/erp5/trunk/utils/cloudooo/cloudooo/handler/pdf/handler.py?rev=43966&r1=43965&r2=43966&view=diff
==============================================================================
--- erp5/trunk/utils/cloudooo/cloudooo/handler/pdf/handler.py [utf8] (original)
+++ erp5/trunk/utils/cloudooo/cloudooo/handler/pdf/handler.py [utf8] Fri Mar  4 11:59:49 2011
@@ -33,8 +33,8 @@ from subprocess import Popen, PIPE
 from tempfile import mktemp
 
 
-class PDFHandler(object):
-  """PDFHandler is used to handler inputed pdf document."""
+class Handler(object):
+  """PDF Handler is used to handler inputed pdf document."""
 
   implements(IHandler)
 

Modified: erp5/trunk/utils/cloudooo/cloudooo/handler/pdf/tests/testPDFHandler.py
URL: http://svn.erp5.org/erp5/trunk/utils/cloudooo/cloudooo/handler/pdf/tests/testPDFHandler.py?rev=43966&r1=43965&r2=43966&view=diff
==============================================================================
--- erp5/trunk/utils/cloudooo/cloudooo/handler/pdf/tests/testPDFHandler.py [utf8] (original)
+++ erp5/trunk/utils/cloudooo/cloudooo/handler/pdf/tests/testPDFHandler.py [utf8] Fri Mar  4 11:59:49 2011
@@ -27,12 +27,12 @@
 ##############################################################################
 
 
-from cloudooo.handler.pdf.handler import PDFHandler
+from cloudooo.handler.pdf.handler import Handler
 from cloudooo.handler.tests.handlerTestCase import HandlerTestCase, make_suite
 from types import DictType
 
 
-class TestPDFHandler(HandlerTestCase):
+class TestHandler(HandlerTestCase):
 
   def afterSetUp(self):
     self.kw = dict(env=dict(PATH=self.env_path))
@@ -40,14 +40,14 @@ class TestPDFHandler(HandlerTestCase):
   def testConvertPDFtoText(self):
     """Test conversion of pdf to txt"""
     pdf_document = open("data/test.pdf").read()
-    handler = PDFHandler(self.tmp_url, pdf_document, "pdf", **self.kw)
+    handler = Handler(self.tmp_url, pdf_document, "pdf", **self.kw)
     txt_document = handler.convert("txt")
     self.assertTrue(txt_document.startswith("UNG Docs Architecture"))
 
   def testgetMetadata(self):
     """Test if the metadata are extracted correctly"""
     pdf_document = open("data/test.pdf").read()
-    handler = PDFHandler(self.tmp_url, pdf_document, "pdf", **self.kw)
+    handler = Handler(self.tmp_url, pdf_document, "pdf", **self.kw)
     metadata = handler.getMetadata()
     self.assertEquals(type(metadata), DictType)
     self.assertNotEquals(metadata, {})
@@ -56,14 +56,14 @@ class TestPDFHandler(HandlerTestCase):
   def testsetMetadata(self):
     """Test if the metadata is inserted correctly"""
     pdf_document = open("data/test.pdf").read()
-    handler = PDFHandler(self.tmp_url, pdf_document, "pdf", **self.kw)
+    handler = Handler(self.tmp_url, pdf_document, "pdf", **self.kw)
     metadata_dict = {"title": "Set Metadata Test", "creator": "gabriel\'@"}
     new_document = handler.setMetadata(metadata_dict)
-    handler = PDFHandler(self.tmp_url, new_document, "pdf", **self.kw)
+    handler = Handler(self.tmp_url, new_document, "pdf", **self.kw)
     metadata = handler.getMetadata()
     self.assertEquals(metadata["title"], 'Set Metadata Test')
     self.assertEquals(metadata['creator'], 'gabriel\'@')
 
 
 def test_suite():
-  return make_suite(TestPDFHandler)
+  return make_suite(TestHandler)



More information about the Erp5-report mailing list