Mercurial > libervia-backend
comparison src/plugins/plugin_misc_text_commands.py @ 1409:3265a2639182
massive (preventive) addition of 'u' (unicode) before the strings passed to logging functions
author | souliane <souliane@mailoo.org> |
---|---|
date | Thu, 16 Apr 2015 14:57:57 +0200 |
parents | 069ad98b360d |
children | 244a605623d6 |
comparison
equal
deleted
inserted
replaced
1408:8a7145138330 | 1409:3265a2639182 |
---|---|
136 """ | 136 """ |
137 for attr in dir(instance): | 137 for attr in dir(instance): |
138 if attr.startswith('cmd_'): | 138 if attr.startswith('cmd_'): |
139 cmd = getattr(instance, attr) | 139 cmd = getattr(instance, attr) |
140 if not callable(cmd): | 140 if not callable(cmd): |
141 log.warning(_("Skipping not callable [%s] attribute") % attr) | 141 log.warning(_(u"Skipping not callable [%s] attribute") % attr) |
142 continue | 142 continue |
143 cmd_name = attr[4:] | 143 cmd_name = attr[4:] |
144 if not cmd_name: | 144 if not cmd_name: |
145 log.warning(_("Skipping cmd_ method")) | 145 log.warning(_("Skipping cmd_ method")) |
146 if cmd_name in self._commands: | 146 if cmd_name in self._commands: |
147 suff=2 | 147 suff=2 |
148 while (cmd_name + str(suff)) in self._commands: | 148 while (cmd_name + str(suff)) in self._commands: |
149 suff+=1 | 149 suff+=1 |
150 new_name = cmd_name + str(suff) | 150 new_name = cmd_name + str(suff) |
151 log.warning(_("Conflict for command [%(old_name)s], renaming it to [%(new_name)s]") % {'old_name': cmd_name, 'new_name': new_name}) | 151 log.warning(_(u"Conflict for command [%(old_name)s], renaming it to [%(new_name)s]") % {'old_name': cmd_name, 'new_name': new_name}) |
152 cmd_name = new_name | 152 cmd_name = new_name |
153 self._commands[cmd_name] = cmd_data = OrderedDict({'callback':cmd}) # We use an Ordered dict to keep documenation order | 153 self._commands[cmd_name] = cmd_data = OrderedDict({'callback':cmd}) # We use an Ordered dict to keep documenation order |
154 cmd_data.update(self._parseDocString(cmd, cmd_name)) | 154 cmd_data.update(self._parseDocString(cmd, cmd_name)) |
155 log.info(_("Registered text command [%s]") % cmd_name) | 155 log.info(_("Registered text command [%s]") % cmd_name) |
156 | 156 |