/mandos/trunk

To get this branch, use:
bzr branch http://bzr.recompile.se/loggerhead/mandos/trunk

« back to all changes in this revision

Viewing changes to mandos

  • Committer: Teddy Hogeborn
  • Date: 2008-12-28 10:35:32 UTC
  • Revision ID: teddy@fukt.bsnet.se-20081228103532-rsh0y9slgh9jc3vo
* mandos (AvahiError): Converted to use unicode.  All users changed.
  (AvahiError.__init__): Take *args and **kwargs and pass on all
                         arguments to super() call.
  (AvahiError.__str__): Removed.
  (AvahiError.__unicode__): New.
  (entry_group_state_changed): Bug fix: Raise AvahiGroupError with one
                               argument, not two.
  (main): Bug fix: on AvahiError, removed "%s" from log message.

Show diffs side-by-side

added added

removed removed

Lines of Context:
82
82
logger.addHandler(console)
83
83
 
84
84
class AvahiError(Exception):
85
 
    def __init__(self, value):
 
85
    def __init__(self, value, *args, **kwargs):
86
86
        self.value = value
87
 
        super(AvahiError, self).__init__()
88
 
    def __str__(self):
89
 
        return repr(self.value)
 
87
        super(AvahiError, self).__init__(value, *args, **kwargs)
 
88
    def __unicode__(self):
 
89
        return unicode(repr(self.value))
90
90
 
91
91
class AvahiServiceError(AvahiError):
92
92
    pass
129
129
            logger.critical(u"No suitable Zeroconf service name found"
130
130
                            u" after %i retries, exiting.",
131
131
                            self.rename_count)
132
 
            raise AvahiServiceError("Too many renames")
 
132
            raise AvahiServiceError(u"Too many renames")
133
133
        self.name = server.GetAlternativeServiceName(self.name)
134
134
        logger.info(u"Changing Zeroconf service name to %r ...",
135
135
                    str(self.name))
833
833
    elif state == avahi.ENTRY_GROUP_FAILURE:
834
834
        logger.critical(u"Avahi: Error in group state changed %s",
835
835
                        unicode(error))
836
 
        raise AvahiGroupError("State changed: %s", str(error))
 
836
        raise AvahiGroupError(u"State changed: %s" % unicode(error))
837
837
 
838
838
def if_nametoindex(interface):
839
839
    """Call the C function if_nametoindex(), or equivalent"""
1150
1150
        logger.debug(u"Starting main loop")
1151
1151
        main_loop.run()
1152
1152
    except AvahiError, error:
1153
 
        logger.critical(u"AvahiError: %s" + unicode(error))
 
1153
        logger.critical(u"AvahiError: %s", error)
1154
1154
        sys.exit(1)
1155
1155
    except KeyboardInterrupt:
1156
1156
        if debug: