mtpgwlib
index
/home/klokan/Projects/MarineTrans/opt/mtpgw/lib/mtpgwlib/__init__.py

Libraries for MTPGW
-------------------
Define necessary imports for libraries of MTPGW project.
 
Additional classes have to be imported explicitly.
 
MTP - Marine Trans Purchasing
Copyright (2005) Klokan Petr Pridal

 
Package Contents
       
Archive
Config
EmailParser
EmailSender
Log
MTMLPolarisReader
MTPDocument
MTPReader
MTPWriter
errors
magic
templates (package)

 
Classes
       
mtpgwlib.Log.Log

 
class Log
    Logging class for project MTP, implement writing to several files.
 
  Methods defined here:
__init__(self, debug=False, robot=False)
Main init function
critical(self, message)
debug(self, message)
error(self, message)
flushJobLogToFile(self, filename)
flushOutputLog(self)
info(self, message)
warn(self, message)

 
Functions
       
magic(content, filename)
Recognise content type according magic sequence (in the begining of
file). Returns one of: 'EMAIL', 'MTP', 'MTMLPolarisAttachment', 
'MTMLPolarisRequisition', 'XLS' or throw a DocumentUnsupported exception.
 
>>> magic('From adfafasf@klokan.cz','')
'EMAIL'
>>> magic('<?xml asdfasdf <MTP','')
'MTP'
>>> magic('<?xml asdfasdf <MTmL> ... <Requisition','')
'MTMLPolarisRequisition'
>>> magic('<?xml><MTML VersionNumber="2.0" PreparationTime=""> <Attachment..','')
'MTMLPolarisAttachment'
>>> magic('BIFF8asdfasdf','test.xls')
'XLS'
>>> magic('asdfasdfa','') # not supported document
Traceback (most recent call last):
    ...
DocumentUnsupported: Unsupported type of document

 
Data
        __all__ = ('config', 'Log', 'magic', 'errors')
config = <mtpgwlib.Config.Config instance>