Back to index

plone3  3.1.7
Public Member Functions | Public Attributes | Private Attributes | Static Private Attributes
PortalTransforms.libtransforms.commandtransform.commandtransform Class Reference

List of all members.

Public Member Functions

def __init__
def name
def initialize_tmpdir
def subObjects
def fixImages
def cleanDir

Public Attributes

 binary

Private Attributes

 __name__

Static Private Attributes

 __implements__ = itransform

Detailed Description

abstract class for external command based transform

Definition at line 11 of file commandtransform.py.


Constructor & Destructor Documentation

def PortalTransforms.libtransforms.commandtransform.commandtransform.__init__ (   self,
  name = None,
  binary = None,
  kwargs 
)

Definition at line 16 of file commandtransform.py.

00016 
00017     def __init__(self, name=None, binary=None, **kwargs):
00018         if name is not None:
00019             self.__name__ = name
00020         if binary is not None:
00021             self.binary = bin_search(binary)
00022             self.binary = getShortPathName(self.binary)


Member Function Documentation

Definition at line 52 of file commandtransform.py.

00052 
00053     def cleanDir(self, tmpdir):
00054         shutil.rmtree(tmpdir)

Here is the caller graph for this function:

def PortalTransforms.libtransforms.commandtransform.commandtransform.fixImages (   self,
  path,
  images,
  objects 
)

Definition at line 48 of file commandtransform.py.

00048 
00049     def fixImages(self, path, images, objects):
00050         for image in images:
00051             objects[image] = open(join(path, image), 'rb').read()

Here is the caller graph for this function:

create a temporary directory, copy input in a file there
return the path of the tmp dir and of the input file

Definition at line 26 of file commandtransform.py.

00026 
00027     def initialize_tmpdir(self, data, **kwargs):
00028         """create a temporary directory, copy input in a file there
00029         return the path of the tmp dir and of the input file
00030         """
00031         tmpdir = tempfile.mktemp()
00032         os.mkdir(tmpdir)
00033         filename = kwargs.get("filename", '')
00034         fullname = join(tmpdir, basename(filename))
00035         filedest = open(fullname , "wb").write(data)
00036         return tmpdir, fullname

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 23 of file commandtransform.py.

00023 
00024     def name(self):
00025         return self.__name__

Here is the caller graph for this function:

Definition at line 37 of file commandtransform.py.

00037 
00038     def subObjects(self, tmpdir):
00039         imgs = []
00040         for f in os.listdir(tmpdir):
00041             result = re.match("^.+\.(?P<ext>.+)$", f)
00042             if result is not None:
00043                 ext = result.group('ext')
00044                 if ext in ('png', 'jpg', 'gif'):
00045                     imgs.append(f)
00046         path = join(tmpdir, '')
00047         return path, imgs

Here is the caller graph for this function:


Member Data Documentation

Definition at line 14 of file commandtransform.py.

Definition at line 18 of file commandtransform.py.

Definition at line 20 of file commandtransform.py.


The documentation for this class was generated from the following file: