comparison src/plugins/plugin_misc_xmllog.py @ 587:952322b1d490

Remove trailing whitespaces.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Fri, 18 Jan 2013 17:55:34 +0100
parents 2c4016921403
children beaf6bec2fcd
comparison
equal deleted inserted replaced
586:6a718ede8be1 587:952322b1d490
1 #!/usr/bin/python 1 #!/usr/bin/python
2 # -*- coding: utf-8 -*- 2 # -*- coding: utf-8 -*-
3 3
4 """ 4 """
5 SàT plugin for managing raw XML log 5 SàT plugin for managing raw XML log
6 Copyright (C) 2011 Jérôme Poisson (goffi@goffi.org) 6 Copyright (C) 2011 Jérôme Poisson (goffi@goffi.org)
7 7
8 This program is free software: you can redistribute it and/or modify 8 This program is free software: you can redistribute it and/or modify
9 it under the terms of the GNU Affero General Public License as published by 9 it under the terms of the GNU Affero General Public License as published by
10 the Free Software Foundation, either version 3 of the License, or 10 the Free Software Foundation, either version 3 of the License, or
48 return XmlStream.send(self, obj) 48 return XmlStream.send(self, obj)
49 49
50 def dataReceived(self, data): 50 def dataReceived(self, data):
51 self._host.bridge.xmlLog("IN", data.decode('utf-8'), self._profile) 51 self._host.bridge.xmlLog("IN", data.decode('utf-8'), self._profile)
52 return XmlStream.dataReceived(self, data) 52 return XmlStream.dataReceived(self, data)
53 53
54 54
55 class XmlLog(): 55 class XmlLog():
56 56
57 params = """ 57 params = """
58 <params> 58 <params>
59 <general> 59 <general>
60 <category name="Debug"> 60 <category name="Debug">
61 <param name="Xml log" label="%(label_xmllog)s" value="false" type="bool" /> 61 <param name="Xml log" label="%(label_xmllog)s" value="false" type="bool" />
65 """ % {"label_xmllog": _("Activate XML log")} 65 """ % {"label_xmllog": _("Activate XML log")}
66 66
67 def __init__(self, host): 67 def __init__(self, host):
68 info(_("Plugin XML Log initialization")) 68 info(_("Plugin XML Log initialization"))
69 self.host = host 69 self.host = host
70 70
71 #parameters 71 #parameters
72 host.memory.importParams(self.params) 72 host.memory.importParams(self.params)
73 73
74 #bridge 74 #bridge
75 host.bridge.addSignal("xmlLog", ".plugin", signature='sss') #args: direction("IN" or "OUT"), xml_data, profile 75 host.bridge.addSignal("xmlLog", ".plugin", signature='sss') #args: direction("IN" or "OUT"), xml_data, profile
76 76
77 do_log = self.host.memory.getParamA("Xml log", "Debug") 77 do_log = self.host.memory.getParamA("Xml log", "Debug")
78 if do_log: 78 if do_log:
79 info(_("XML log activated")) 79 info(_("XML log activated"))
80 host.trigger.add("XML Initialized", self.logXml) 80 host.trigger.add("XML Initialized", self.logXml)
81 81
82 def logXml(self, xmlstream, profile): 82 def logXml(self, xmlstream, profile):
83 xmlstream.__class__ = LoggingXmlStream 83 xmlstream.__class__ = LoggingXmlStream
84 xmlstream._profile = profile 84 xmlstream._profile = profile
85 xmlstream._host = self.host 85 xmlstream._host = self.host
86 return True 86 return True