当前位置: 首页>>代码示例>>Python>>正文


Python Suspect.getSource方法代码示例

本文整理汇总了Python中fuglu.shared.Suspect.getSource方法的典型用法代码示例。如果您正苦于以下问题:Python Suspect.getSource方法的具体用法?Python Suspect.getSource怎么用?Python Suspect.getSource使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在fuglu.shared.Suspect的用法示例。


在下文中一共展示了Suspect.getSource方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_modified_message

# 需要导入模块: from fuglu.shared import Suspect [as 别名]
# 或者: from fuglu.shared.Suspect import getSource [as 别名]
 def test_modified_message(self):
     """Test if the modified message gets archived correctly"""
     from fuglu.shared import Suspect
     import shutil
     import tempfile
     
     tempfilename=tempfile.mktemp(suffix='archive', prefix='fuglu-unittest', dir='/tmp')
     shutil.copy('testdata/helloworld.eml',tempfilename)
     self.tempfiles.append(tempfilename)
     
     #
     self.config.set('ArchivePlugin', 'storeoriginal', '0')
     candidate=ArchivePlugin(self.config)
     suspect=Suspect('[email protected]', '[email protected]', tempfilename)
     origmessage=suspect.getSource()
     #modify the mesg
     msgrep= suspect.get_message_rep()
     msgrep['X-Changed-Something']='Yes'
     suspect.setMessageRep(msgrep)
     
     filename=candidate.archive(suspect)
     self.assertTrue(filename!=None and filename)
     
     self.tempfiles.append(filename)
     
     archivedmessage=open(filename,'r').read()
     self.assertNotEqual(origmessage.strip(),archivedmessage.strip()),'Archived message should have stored modified message' 
     
开发者ID:gryphius,项目名称:fuglu-travis-test,代码行数:29,代码来源:archive.py

示例2: type

# 需要导入模块: from fuglu.shared import Suspect [as 别名]
# 或者: from fuglu.shared.Suspect import getSource [as 别名]
    #now run examine
    logging.info("Running plugin: %s"%pluginstance)
    
    if opts.appender:
        #todo: maybe make DUNNO configurable? 2nd argument?
        pluginstance.process(suspect,DUNNO)
        
    else:
        ans = pluginstance.examine(suspect)
        message=""
        if type(ans) is tuple:
            result,message=ans
        else:
            result=ans
        
        if result==None:
            result=DUNNO
    
        logging.info("Result: %s %s",actioncode_to_string(result), message)
        logging.info(suspect)
        
        if suspect.is_modified():
            outfilename='/tmp/fuglu_dummy_message_out.eml'
            out=open(outfilename,'wb')
            out.write(suspect.getSource())
            out.close()
            logging.info("Plugin modified the source -> modified message available as %s"%outfilename)
        
    if opts.console:
        run_debugconsole(suspect=suspect, plugin=pluginstance, result=result, config=config)
开发者ID:gryphius,项目名称:fuglu-travis-test,代码行数:32,代码来源:plugdummy.py


注:本文中的fuglu.shared.Suspect.getSource方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。