Changeset 2295


Ignore:
Timestamp:
Mar 2, 2009 11:53:47 PM (9 years ago)
Author:
hazmat
Message:

alternate component registration, transform context abstraction

Location:
ore.transforms/trunk
Files:
1 added
7 edited

Legend:

Unmodified
Added
Removed
  • ore.transforms/trunk/setup.py

    r2293 r2295  
    2323    description="Text Transformations for Common Document Formats", 
    2424    long_description=( 
    25         read('alchemist','audit','readme.txt') 
     25        read('ore','transforms','readme.txt') 
    2626        + '\n\n' + 
    2727        read('changes.txt') 
  • ore.transforms/trunk/src/ore/transforms/__init__.py

    r2015 r2295  
    22$Id$ 
    33""" 
     4 
     5from context import TransformContext 
     6from common import register 
  • ore.transforms/trunk/src/ore/transforms/common.py

    r2293 r2295  
    44 
    55from ore.transforms import transform, interfaces, utils 
     6 
     7import threading 
     8 
     9_REGISTERED = False 
     10_REGISTERED_LOCK = threading.Lock() 
    611 
    712def register( ): 
     
    1217    command line usage. 
    1318    """ 
     19 
     20    _REGISTERED_LOCK.acquire() 
     21    try: 
     22        if _REGISTERED: 
     23            return 
     24        else: 
     25            _REGISTER = True 
     26    finally: 
     27        _REGISTERED_LOCK.release() 
     28     
    1429    from zope import component 
    1530    for transform in [ pdf_to_text, rtf_to_html, ppt_to_text, 
  • ore.transforms/trunk/src/ore/transforms/configure.zcml

    r2293 r2295  
    11<configure> 
    2    
    32 
     3  <a 
    44</configure> 
    55    
  • ore.transforms/trunk/src/ore/transforms/interfaces.py

    r2015 r2295  
    11from zope import interface, schema 
     2 
     3class INamedFileStream( interface.Interface ): 
     4    """ 
     5    named temporary file stream, we use symlinks behind the scenes 
     6    to create, the requisite data stores. application is responsible 
     7    for cleaning up any temporary file it creates. the transform system 
     8    manages any temporary directories it creates ( need a finally hook 
     9    in transform.py or its sf ). 
     10    """ 
     11     
     12class ITransformContext( interface.Interface ): 
     13 
     14    input_mime_type = schema.ASCIILine(__doc__ = u"Input Mime Type Name" ) 
     15    output_mime_type = schema.ASCIILine( __doc__ = u"Output Mime Type Name" ) 
     16     
     17    input_stream = interface.IObject( schema=INamedFileStream ) 
     18    output_stream = interface.IObject( schema=INamedFileStream ) 
    219 
    320class ITransform( interface.Interface ): 
  • ore.transforms/trunk/src/ore/transforms/readme.txt

    r2293 r2295  
     1 
     2A Simple Document Text Extract Transformation Suite for common document formats. 
     3 
     4What makes it worthwhile to other things like plone.transforms or fork oriented tools. 
     5 
     6In a Phrase. Simplicity, Stream Oriented with Minimal Copies, Customization. 
    17 
    28 
    3 A Simple Document Text Extract Transformation Suite for common document 
    4 formats. 
  • ore.transforms/trunk/src/ore/transforms/transform.py

    r2293 r2295  
    4141 
    4242    def __init__(self, binary=None): 
    43         self.binary = utils.bin_search(binary or self.binary ) 
     43        self.binary_path = utils.bin_search(binary or self.binary ) 
    4444        self.transform_count = 0 
    4545        self.transform_time  = 0 
     
    9191    def formatCommand( self, work_dir, source_copy, output_copy, **kw ): 
    9292        cmd = 'cd "%s" && %s %s "%s" "%s" 2>error_log 1>/dev/null' % ( 
    93             work_dir, self.binary, self.binaryArgs, source_copy, output_copy) 
     93            work_dir, self.binary_path, self.binaryArgs, source_copy, output_copy) 
    9494        return cmd 
    9595 
     
    122122    def formatCommand( self, work_dir, source_copy, output_copy, **kw ): 
    123123        cmd = 'cd "%s" && %s %s "%s" > "%s" 2>error_log 1>/dev/null' % ( 
    124             work_dir, self.binary, self.binaryArgs, source_copy, output_copy) 
     124            work_dir, self.binary_path, self.binaryArgs, source_copy, output_copy) 
    125125        return cmd 
    126126 
Note: See TracChangeset for help on using the changeset viewer.