Back to index

moin  1.9.0~rc2
Namespaces | Functions | Variables
MoinMoin.filter Namespace Reference

Namespaces

namespace  application_msword
namespace  application_octet_stream
namespace  application_pdf
namespace  application_vnd_ms_excel
namespace  application_vnd_ms_powerpoint
namespace  application_vnd_oasis_opendocument
namespace  application_vnd_oasis_opendocument_presentation
namespace  application_vnd_oasis_opendocument_spreadsheet
namespace  application_vnd_oasis_opendocument_text
namespace  application_vnd_sun_xml
namespace  application_vnd_sun_xml_calc
namespace  application_vnd_sun_xml_writer
namespace  audio
namespace  EXIF
namespace  image
namespace  image_jpeg
namespace  text
namespace  text_html
namespace  text_rtf
namespace  text_xml
namespace  video

Functions

def quote_filename
def execfilter

Variables

tuple logging = log.getLogger(__name__)
tuple modules = pysupport.getPackageModules(__file__)
list standard_codings = ['utf-8', 'iso-8859-15', 'iso-8859-1', ]

Function Documentation

def MoinMoin.filter.execfilter (   cmd,
  filename,
  codings = standard_codings 
)
use cmd to get plaintext content of filename
    to decode to unicode, we use the first coding of codings list that
    does not throw an exception or force ascii

Definition at line 38 of file __init__.py.

00038 
00039 def execfilter(cmd, filename, codings=standard_codings):
00040     """ use cmd to get plaintext content of filename
00041         to decode to unicode, we use the first coding of codings list that
00042         does not throw an exception or force ascii
00043     """
00044     filter_cmd = cmd % quote_filename(filename)
00045     data, errors, rc = exec_cmd(filter_cmd, timeout=300)
00046     logging.debug("Command '%s', rc: %d, stdout: %d bytes, stderr: %s" % (filter_cmd, rc, len(data), errors))
00047     for c in codings:
00048         try:
00049             return data.decode(c)
00050         except UnicodeError:
00051             pass
00052     return data.decode('ascii', 'replace')
00053 

Here is the call graph for this function:

Here is the caller graph for this function:

def MoinMoin.filter.quote_filename (   filename)
quote a filename (could contain blanks or other special chars) in a
    way suitable for the platform we run on.

Definition at line 24 of file __init__.py.

00024 
00025 def quote_filename(filename):
00026     """ quote a filename (could contain blanks or other special chars) in a
00027         way suitable for the platform we run on.
00028     """
00029     # XXX Use os.name AND/OR sys.platform?
00030     if os.name == 'posix':
00031         filename = "'%s'" % filename
00032     elif sys.platform == 'win32':
00033         filename = '"%s"' % filename
00034     else:
00035         raise ValueError("MoinMoin.filter.quote_filename: os/platform not supported")
00036     return filename
00037 

Here is the caller graph for this function:


Variable Documentation

Definition at line 13 of file __init__.py.

tuple MoinMoin.filter.modules = pysupport.getPackageModules(__file__)

Definition at line 17 of file __init__.py.

list MoinMoin.filter.standard_codings = ['utf-8', 'iso-8859-15', 'iso-8859-1', ]

Definition at line 19 of file __init__.py.