Package Peach :: Package Publishers :: Module stdout
[hide private]

Source Code for Module Peach.Publishers.stdout

 1   
 2  ''' 
 3  Output to STDOUT stuffs. 
 4   
 5  @author: Michael Eddington 
 6  @version: $Id: Peach.Publishers.stdout-pysrc.html 1138 2008-08-16 19:39:03Z meddingt $ 
 7  ''' 
 8   
 9  # 
10  # Copyright (c) 2005-2008 Michael Eddington 
11  # Copyright (c) 2004-2005 IOActive Inc. 
12  # 
13  # Permission is hereby granted, free of charge, to any person obtaining a copy  
14  # of this software and associated documentation files (the "Software"), to deal 
15  # in the Software without restriction, including without limitation the rights  
16  # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell  
17  # copies of the Software, and to permit persons to whom the Software is  
18  # furnished to do so, subject to the following conditions: 
19  # 
20  # The above copyright notice and this permission notice shall be included in     
21  # all copies or substantial portions of the Software. 
22  # 
23  # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR  
24  # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,  
25  # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE  
26  # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER  
27  # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 
28  # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 
29  # SOFTWARE. 
30  # 
31   
32  # Authors: 
33  #   Michael Eddington (mike@phed.org) 
34   
35  # $Id: Peach.Publishers.stdout-pysrc.html 1138 2008-08-16 19:39:03Z meddingt $ 
36   
37   
38  from Peach.publisher import Publisher 
39   
40 -class Stdout(Publisher):
41 ''' 42 Basic stdout publisher. All data is written to stdout. No input 43 is available from this publisher. Excelent for testing. 44 ''' 45
46 - def accept(self):
47 pass
48
49 - def connect(self):
50 pass
51
52 - def close(self):
53 pass
54
55 - def send(self, data):
56 print data
57
58 - def receive(self, size = None):
59 return ''
60
61 - def call(self, method, args):
62 str = "" 63 for a in args: 64 str += "%s, " % repr(a) 65 66 print "%s(%s)" % (method, str[:-2]) 67 68 return ''
69
70 -class Null(Publisher):
71 ''' 72 Basic stdout publisher. All data is written to stdout. No input 73 is available from this publisher. Excelent for testing. 74 ''' 75
76 - def accept(self):
77 pass
78
79 - def connect(self):
80 pass
81
82 - def close(self):
83 pass
84
85 - def send(self, data):
86 pass
87
88 - def receive(self):
89 return ''
90
91 - def call(self, method, args):
92 return ''
93 94 # end 95