""" pdfmwam.py implements all PDF MWAM classes, and binds instances of MWAMS to the AWAMs. All MWAM classes inherits from AbstractWAM, which defines the list of WAMs. """ # Copyright 2008-2010 eGovMon # This program is distributed under the terms of the GNU General # Public License. # # This file is part of the eGovernment Monitoring # (eGovMon) # # eGovMon is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # eGovMon is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with eGovMon; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, # MA 02110-1301 USA __author__ = "Nils Ulltveit-Moe" __updated__ = "$LastChangedDate$" __version__ = "$Id$" import new from AbstractWAM import * import re import mimetypes import urllib import sys from WAM_Results import egovmonMwamId # Class name iterator classNameIterator=1 # Default MWAM function class MWAM(AbstractM): def result(self,s): return self.aWAM(self.awams[0],s) # Class factory to generate MWAM classes def addMWAM(parentKlass,awamId,mType): global classNameIterator name=".".join([egovmonMwamId[mType],str(classNameIterator)]) nameSpace=eval("""{"__init__":lambda self,awamresult,**args: %s.__init__(self,awamresult,%s,%d, **args)}""" % (str(parentKlass).split(".")[-1],awamId,int(mType))) # WAMClasses.append(new.classobj(name,(parentKlass,),nameSpace)) AppendKlass(new.classobj(name,(parentKlass,),nameSpace)) # Add M-WAMs addMWAM(MWAM,["EGOVMON.PDF.PROP.01"],MWAM.TITLE) addMWAM(MWAM,["EGOVMON.PDF.PROP.02"],MWAM.AUTHOR) addMWAM(MWAM,["EGOVMON.PDF.PROP.03"],MWAM.VERSION) addMWAM(MWAM,["EGOVMON.PDF.PROP.04"],MWAM.CREATION_TIME) addMWAM(MWAM,["EGOVMON.PDF.PROP.05"],MWAM.MODIFICATION_TIME) addMWAM(MWAM,["EGOVMON.PDF.PROP.06"],MWAM.PRODUCER) addMWAM(MWAM,["EGOVMON.PDF.PROP.07"],MWAM.CREATOR) # Is this correct ? addMWAM(MWAM,["EGOVMON.A.0.0.0.4.PDF.4.1"],MWAM.LANGUAGE) #