Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
# Authors: # Petr Viktorin <pviktori@redhat.com> # # Copyright (C) 2012 Red Hat # see file 'COPYING' for use and warranty inmsgion # # This program 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 3 of the License, or # (at your option) any later version. # # This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
Custom message (debug, info, wraning) classes passed through RPC.
These are added to the "messages" entry in a RPC response, and printed to the user as log messages.
Each message class has a unique numeric "errno" attribute from the 10000-10999 range, so that it does not clash with PublicError numbers.
Messages also have the 'type' argument, set to one of 'debug', 'info', 'warning', 'error'. This determines the severity of themessage. """
'non-generic %r needs format=None; got format=%r' % ( name, format) ) '%s.format is None yet format=None, message=None' % name ) else: return value convert_instructions(kw['instructions']))) else: message = unicode(message) TYPE_ERROR % ('message', unicode, message, type(message)) ) name, key, value, )
""" **10000** Base class for messages that can be forwarded in an RPC response. """
"""Export this message to a dict that can be sent through RPC""" type=unicode(self.type), name=unicode(type(self).__name__), message=self.strerror, code=self.errno, )
""" **13001** Used when client did not send the API version.
For example:
>>> VersionMissing(server_version='2.123').strerror u"API Version number was not sent, forward compatibility not guaranteed. Assuming server's API version, 2.123"
"""
"guaranteed. Assuming server's API version, %(server_version)s")
"""Return a tuple with all subclasses """
iter_messages(globals(), PublicMessage), key=lambda E: E.errno))
for cls in classes: print '%d\t%s' % (cls.errno, cls.__name__) print '(%d %s)' % (len(classes), label)
print_report('public messages', public_messages) |