Ticket #1213: 0001-let-the-logger-do-the-formatting.patch

File 0001-let-the-logger-do-the-formatting.patch, 26.0 KB (added by sascha_silbe, 15 years ago)

let the logger do the formatting

  • po/sugar-toolkit.pot

    From cc65ad1df867aa9bc781c64d94f1b8bb6ba748cf Mon Sep 17 00:00:00 2001
    From: Sascha Silbe <sascha@silbe.org>
    Date: Wed, 19 Aug 2009 21:06:53 +0200
    Subject: [PATCH] let the logger do the formatting
    
    ---
     po/sugar-toolkit.pot                  |  113 +++++++++++++++++++++------------
     src/sugar/activity/activity.py        |   32 +++++-----
     src/sugar/activity/activityfactory.py |   18 +++---
     src/sugar/activity/activityservice.py |    2 +-
     src/sugar/bundle/activitybundle.py    |   16 +++---
     src/sugar/bundle/bundle.py            |    2 +-
     src/sugar/datastore/datastore.py      |    2 +-
     src/sugar/datastore/dbus_helpers.py   |   12 ++--
     src/sugar/graphics/icon.py            |    4 +-
     src/sugar/graphics/objectchooser.py   |    4 +-
     src/sugar/graphics/palette.py         |    2 +-
     src/sugar/graphics/palettewindow.py   |    9 ++-
     src/sugar/graphics/toolbarbox.py      |    2 +-
     src/sugar/presence/presenceservice.py |    4 +-
     src/sugar/profile.py                  |    8 +-
     src/sugar/util.py                     |    6 +-
     16 files changed, 133 insertions(+), 103 deletions(-)
    
    diff --git a/po/sugar-toolkit.pot b/po/sugar-toolkit.pot
    index aad88d1..519beb2 100644
    a b msgid "" 
    88msgstr ""
    99"Project-Id-Version: PACKAGE VERSION\n"
    1010"Report-Msgid-Bugs-To: \n"
    11 "POT-Creation-Date: 2008-06-24 00:07+0530\n"
     11"POT-Creation-Date: 2009-08-19 20:54+0200\n"
    1212"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
    1313"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
    1414"Language-Team: LANGUAGE <LL@li.org>\n"
    msgstr "" 
    1717"Content-Transfer-Encoding: 8bit\n"
    1818"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
    1919
    20 #: ../src/sugar/activity/activity.py:120
    21 msgid "Share with:"
     20#: ../src/sugar/activity/activity.py:322
     21#, python-format
     22msgid "%s Activity"
    2223msgstr ""
    2324
    24 #: ../src/sugar/activity/activity.py:122
    25 msgid "Private"
     25#: ../src/sugar/activity/activity.py:703
     26msgid "Keep error"
    2627msgstr ""
    2728
    28 #: ../src/sugar/activity/activity.py:123
    29 msgid "My Neighborhood"
     29#: ../src/sugar/activity/activity.py:704
     30msgid "Keep error: all changes will be lost"
     31msgstr ""
     32
     33#: ../src/sugar/activity/activity.py:707
     34msgid "Don't stop"
     35msgstr ""
     36
     37#: ../src/sugar/activity/activity.py:710
     38msgid "Stop anyway"
    3039msgstr ""
    3140
    32 #: ../src/sugar/activity/activity.py:130
     41#: ../src/sugar/activity/namingalert.py:79
     42msgid "Name this entry"
     43msgstr ""
     44
     45#: ../src/sugar/activity/namingalert.py:84
     46#: ../src/sugar/activity/widgets.py:143
    3347msgid "Keep"
    3448msgstr ""
    3549
    36 #: ../src/sugar/activity/activity.py:136
     50#: ../src/sugar/activity/namingalert.py:275
     51msgid "Untitled"
     52msgstr ""
     53
     54#: ../src/sugar/activity/namingalert.py:282
     55msgid "Description:"
     56msgstr ""
     57
     58#: ../src/sugar/activity/namingalert.py:306
     59msgid "Tags:"
     60msgstr ""
     61
     62#: ../src/sugar/activity/widgets.py:72
    3763msgid "Stop"
    3864msgstr ""
    3965
    40 #: ../src/sugar/activity/activity.py:251
     66#: ../src/sugar/activity/widgets.py:82
    4167msgid "Undo"
    4268msgstr ""
    4369
    44 #: ../src/sugar/activity/activity.py:256
     70#: ../src/sugar/activity/widgets.py:88
    4571msgid "Redo"
    4672msgstr ""
    4773
    48 #: ../src/sugar/activity/activity.py:266
     74#: ../src/sugar/activity/widgets.py:93
    4975msgid "Copy"
    5076msgstr ""
    5177
    52 #: ../src/sugar/activity/activity.py:271
     78#: ../src/sugar/activity/widgets.py:98
    5379msgid "Paste"
    5480msgstr ""
    5581
    56 #: ../src/sugar/activity/activity.py:297
    57 msgid "Activity"
     82#: ../src/sugar/activity/widgets.py:106
     83msgid "Private"
    5884msgstr ""
    5985
    60 #: ../src/sugar/activity/activity.py:469
    61 #, python-format
    62 msgid "%s Activity"
     86#: ../src/sugar/activity/widgets.py:113
     87msgid "My Neighborhood"
    6388msgstr ""
    6489
    65 #: ../src/sugar/activity/activity.py:856
    66 msgid "Keep error"
     90#: ../src/sugar/activity/widgets.py:314
     91msgid "Activity"
    6792msgstr ""
    6893
    69 #: ../src/sugar/activity/activity.py:857
    70 msgid "Keep error: all changes will be lost"
     94#: ../src/sugar/graphics/alert.py:288 ../src/sugar/graphics/alert.py:367
     95msgid "Cancel"
    7196msgstr ""
    7297
    73 #: ../src/sugar/activity/activity.py:860
    74 msgid "Don't stop"
     98#: ../src/sugar/graphics/alert.py:292 ../src/sugar/graphics/alert.py:426
     99msgid "Ok"
    75100msgstr ""
    76101
    77 #: ../src/sugar/activity/activity.py:863
    78 msgid "Stop anyway"
     102#: ../src/sugar/graphics/alert.py:377
     103msgid "Continue"
    79104msgstr ""
    80105
    81 #: ../src/sugar/graphics/alert.py:166 ../src/sugar/graphics/alert.py:209
    82 msgid "Cancel"
     106#: ../src/sugar/graphics/colorbutton.py:49
     107msgid "Choose a color"
    83108msgstr ""
    84109
    85 #: ../src/sugar/graphics/alert.py:170 ../src/sugar/graphics/alert.py:247
    86 msgid "Ok"
     110#: ../src/sugar/graphics/colorbutton.py:267
     111msgid "Red"
    87112msgstr ""
    88113
    89 #: ../src/sugar/graphics/alert.py:219
    90 msgid "Continue"
     114#: ../src/sugar/graphics/colorbutton.py:269
     115msgid "Green"
     116msgstr ""
     117
     118#: ../src/sugar/graphics/colorbutton.py:271
     119msgid "Blue"
    91120msgstr ""
    92121
    93 #: ../src/sugar/util.py:181
     122#: ../src/sugar/util.py:196
    94123msgid " and "
    95124msgstr ""
    96125
    97 #: ../src/sugar/util.py:182
     126#: ../src/sugar/util.py:197
    98127msgid ", "
    99128msgstr ""
    100129
    101130#. TRANS: Indicating something that just happened, eg. "just now", "moments ago"
    102 #: ../src/sugar/util.py:185
     131#: ../src/sugar/util.py:200
    103132msgid "Seconds ago"
    104133msgstr ""
    105134
    106135#. TRANS: Indicating time passed, eg. "[10 day, 5 hours] ago",
    107136#. "[2 minutes] in the past", or "[3 years, 1 month] earlier"
    108 #: ../src/sugar/util.py:189
     137#: ../src/sugar/util.py:204
    109138#, python-format
    110139msgid "%s ago"
    111140msgstr ""
    112141
    113142#. TRANS: Relative dates (eg. 1 month and 5 days).
    114 #: ../src/sugar/util.py:202
     143#: ../src/sugar/util.py:217
    115144#, python-format
    116145msgid "%d year"
    117146msgid_plural "%d years"
    118147msgstr[0] ""
    119148msgstr[1] ""
    120149
    121 #: ../src/sugar/util.py:203
     150#: ../src/sugar/util.py:218
    122151#, python-format
    123152msgid "%d month"
    124153msgid_plural "%d months"
    125154msgstr[0] ""
    126155msgstr[1] ""
    127156
    128 #: ../src/sugar/util.py:204
     157#: ../src/sugar/util.py:219
    129158#, python-format
    130159msgid "%d week"
    131160msgid_plural "%d weeks"
    132161msgstr[0] ""
    133162msgstr[1] ""
    134163
    135 #: ../src/sugar/util.py:205
     164#: ../src/sugar/util.py:220
    136165#, python-format
    137166msgid "%d day"
    138167msgid_plural "%d days"
    139168msgstr[0] ""
    140169msgstr[1] ""
    141170
    142 #: ../src/sugar/util.py:206
     171#: ../src/sugar/util.py:221
    143172#, python-format
    144173msgid "%d hour"
    145174msgid_plural "%d hours"
    146175msgstr[0] ""
    147176msgstr[1] ""
    148177
    149 #: ../src/sugar/util.py:207
     178#: ../src/sugar/util.py:222
    150179#, python-format
    151180msgid "%d minute"
    152181msgid_plural "%d minutes"
  • src/sugar/activity/activity.py

    diff --git a/src/sugar/activity/activity.py b/src/sugar/activity/activity.py
    index f20d402..05c5b00 100644
    a b class Activity(Window, gtk.Container): 
    305305            else:
    306306                self.__joined_cb(self.shared_activity, True, None)
    307307        elif share_scope != SCOPE_PRIVATE:
    308             logging.debug("*** Act %s no existing mesh instance, but used to " \
    309                           "be shared, will share" % self._activity_id)
     308            logging.debug('*** Act %s no existing mesh instance, but used to '
     309                'be shared, will share', self._activity_id)
    310310            # no existing mesh instance, but activity used to be shared, so
    311311            # restart the share
    312312            if share_scope == SCOPE_INVITE_ONLY:
    class Activity(Window, gtk.Container): 
    314314            elif share_scope == SCOPE_NEIGHBORHOOD:
    315315                self.share(private=False)
    316316            else:
    317                 logging.debug("Unknown share scope %r" % share_scope)
     317                logging.debug('Unknown share scope %r', share_scope)
    318318
    319319        if handle.object_id is None and create_jobject:
    320320            logging.debug('Creating a jobject.')
    class Activity(Window, gtk.Container): 
    409409        pass
    410410
    411411    def __jobject_error_cb(self, err):
    412         logging.debug("Error creating activity datastore object: %s" % err)
     412        logging.debug('Error creating activity datastore object: %s', err)
    413413
    414414    def get_activity_root(self):
    415415        """ FIXME: Deprecated. This part of the API has been moved
    class Activity(Window, gtk.Container): 
    486486        if self._closing:
    487487            self._show_keep_failed_dialog()
    488488            self._closing = False
    489         logging.debug("Error saving activity object to datastore: %s" % err)
     489        logging.debug('Error saving activity object to datastore: %s', err)
    490490
    491491    def _cleanup_jobject(self):
    492492        if self._jobject:
    493493            if self._owns_file and os.path.isfile(self._jobject.file_path):
    494                 logging.debug('_cleanup_jobject: removing %r' %
    495                               self._jobject.file_path)
     494                logging.debug('_cleanup_jobject: removing %r',
     495                    self._jobject.file_path)
    496496                os.remove(self._jobject.file_path)
    497497            self._owns_file = False
    498498            self._jobject.destroy()
    class Activity(Window, gtk.Container): 
    550550            logging.debug('Cannot save, no journal object.')
    551551            return
    552552
    553         logging.debug('Activity.save: %r' % self._jobject.object_id)
     553        logging.debug('Activity.save: %r', self._jobject.object_id)
    554554
    555555        if self._updating_jobject:
    556556            logging.info('Activity.save: still processing a previous request.')
    class Activity(Window, gtk.Container): 
    594594        Activities should not override this method. Instead, like save() do any
    595595        copy work that needs to be done in write_file()
    596596        """
    597         logging.debug('Activity.copy: %r' % self._jobject.object_id)
     597        logging.debug('Activity.copy: %r', self._jobject.object_id)
    598598        self.save()
    599599        self._jobject.object_id = None
    600600
    class Activity(Window, gtk.Container): 
    609609        self.shared_activity.disconnect(self._join_id)
    610610        self._join_id = None
    611611        if not success:
    612             logging.debug("Failed to join activity: %s" % err)
     612            logging.debug('Failed to join activity: %s', err)
    613613            return
    614614
    615615        self.present()
    class Activity(Window, gtk.Container): 
    633633        self._pservice.disconnect(self._share_id)
    634634        self._share_id = None
    635635        if not success:
    636             logging.debug('Share of activity %s failed: %s.' %
    637                           (self._activity_id, err))
     636            logging.debug('Share of activity %s failed: %s.',
     637                self._activity_id, err)
    638638            return
    639639
    640640        logging.debug('Share of activity %s successful, PS activity is %r.',
    class Activity(Window, gtk.Container): 
    652652
    653653    def _invite_response_cb(self, error):
    654654        if error:
    655             logging.error('Invite failed: %s' % error)
     655            logging.error('Invite failed: %s', error)
    656656
    657657    def _send_invites(self):
    658658        while self._invites_queue:
    class Activity(Window, gtk.Container): 
    662662                self.shared_activity.invite(
    663663                            buddy, '', self._invite_response_cb)
    664664            else:
    665                 logging.error('Cannot invite %s, no such buddy.' % buddy_key)
     665                logging.error('Cannot invite %s, no such buddy.', buddy_key)
    666666
    667667    def invite(self, buddy_key):
    668668        """Invite a buddy to join this Activity.
    class Activity(Window, gtk.Container): 
    692692            raise RuntimeError("Activity %s already shared." %
    693693                               self._activity_id)
    694694        verb = private and 'private' or 'public'
    695         logging.debug('Requesting %s share of activity %s.' %
    696                       (verb, self._activity_id))
     695        logging.debug('Requesting %s share of activity %s.', verb,
     696            self._activity_id)
    697697        self._share_id = self._pservice.connect("activity-shared",
    698698                                                self.__share_cb)
    699699        self._pservice.share_activity(self, private=private)
  • src/sugar/activity/activityfactory.py

    diff --git a/src/sugar/activity/activityfactory.py b/src/sugar/activity/activityfactory.py
    index dcd840f..d731c3a 100644
    a b def get_command(activity, activity_id=None, object_id=None, uri=None): 
    143143        if os.path.exists(absolute_path):
    144144            command[0] = absolute_path
    145145
    146     logging.debug('launching: %r' % command)
     146    logging.debug('launching: %r', command)
    147147
    148148    return command
    149149
    class ActivityCreationHandler(gobject.GObject): 
    300300        pass
    301301
    302302    def _notify_launch_failure_error_handler(self, err):
    303         logging.error('Notify launch failure failed %s' % err)
     303        logging.error('Notify launch failure failed %s', err)
    304304
    305305    def _notify_launch_error_handler(self, err):
    306         logging.debug('Notify launch failed %s' % err)
     306        logging.debug('Notify launch failed %s', err)
    307307
    308308    def _activate_reply_handler(self, activated):
    309309        if not activated:
    310310            self._create_activity()
    311311
    312312    def _activate_error_handler(self, err):
    313         logging.error("Activity activation request failed %s" % err)
     313        logging.error('Activity activation request failed %s', err)
    314314
    315315    def _create_reply_handler(self):
    316         logging.debug("Activity created %s (%s)." %
    317             (self._handle.activity_id, self._service_name))
     316        logging.debug('Activity created %s (%s).',
     317            self._handle.activity_id, self._service_name)
    318318
    319319    def _create_error_handler(self, err):
    320         logging.error("Couldn't create activity %s (%s): %s" %
    321             (self._handle.activity_id, self._service_name, err))
     320        logging.error("Couldn't create activity %s (%s): %s",
     321            self._handle.activity_id, self._service_name, err)
    322322        self._shell.NotifyLaunchFailure(
    323323            self._handle.activity_id, reply_handler=self._no_reply_handler,
    324324            error_handler=self._notify_launch_failure_error_handler)
    class ActivityCreationHandler(gobject.GObject): 
    331331        self._launch_activity()
    332332
    333333    def _find_object_error_handler(self, err):
    334         logging.error("Datastore find failed %s" % err)
     334        logging.error('Datastore find failed %s', err)
    335335        self._launch_activity()
    336336
    337337def create(bundle, activity_handle=None):
  • src/sugar/activity/activityservice.py

    diff --git a/src/sugar/activity/activityservice.py b/src/sugar/activity/activityservice.py
    index ff806f3..20cf7fe 100644
    a b class ActivityService(dbus.service.Object): 
    6161
    6262    @dbus.service.method(_ACTIVITY_INTERFACE)
    6363    def SetActive(self, active):
    64         logging.debug('ActivityService.set_active: %s.' % active)
     64        logging.debug('ActivityService.set_active: %s.', active)
    6565        self._activity.props.active = active
    6666
    6767    @dbus.service.method(_ACTIVITY_INTERFACE)
  • src/sugar/bundle/activitybundle.py

    diff --git a/src/sugar/bundle/activitybundle.py b/src/sugar/bundle/activitybundle.py
    index 7877229..6f4f578 100644
    a b class ActivityBundle(Bundle): 
    110110            # Remove duplicates
    111111            if line in lines[0:num]:
    112112                lines[num] = ""
    113                 logging.warning("Bundle %s: duplicate entry in MANIFEST: %s"
    114                                 % (self._name,line))
     113                logging.warning('Bundle %s: duplicate entry in MANIFEST: %s',
     114                    self._name, line)
    115115                continue
    116116           
    117117            # Remove MANIFEST
    118118            if line == "MANIFEST":
    119119                lines[num] = ""
    120                 logging.warning("Bundle %s: MANIFEST includes itself: %s"
    121                                 % (self._name,line))
     120                logging.warning('Bundle %s: MANIFEST includes itself: %s',
     121                    self._name, line)
    122122               
    123123            # Remove invalid files
    124124            if not self.is_file(line):
    125125                lines[num] = ""
    126                 logging.warning("Bundle %s: invalid entry in MANIFEST: %s"
    127                                 % (self._name,line))
     126                logging.warning('Bundle %s: invalid entry in MANIFEST: %s',
     127                    self._name, line)
    128128
    129129        return lines
    130130   
    class ActivityBundle(Bundle): 
    311311            if path in manifestfiles:
    312312                manifestfiles.remove(path)
    313313            elif path != "MANIFEST":
    314                 logging.warning("Bundle %s: %s not in MANIFEST"%
    315                                 (self._name,path))
     314                logging.warning('Bundle %s: %s not in MANIFEST', self._name,
     315                    path)
    316316                if strict_manifest:
    317317                    os.remove(os.path.join(install_path, path))
    318318                   
  • src/sugar/bundle/bundle.py

    diff --git a/src/sugar/bundle/bundle.py b/src/sugar/bundle/bundle.py
    index a1b2686..5979d5b 100644
    a b class Bundle(object): 
    121121                data = self._zip_file.read(path)
    122122                f = StringIO.StringIO(data)
    123123            except KeyError:
    124                 logging.debug('%s not found.' % filename)
     124                logging.debug('%s not found.', filename)
    125125
    126126        return f
    127127   
  • src/sugar/datastore/datastore.py

    diff --git a/src/sugar/datastore/datastore.py b/src/sugar/datastore/datastore.py
    index 80d5936..1217c6a 100644
    a b def write(ds_object, update_mtime=True, transfer_ownership=False, 
    183183                                                  transfer_ownership)
    184184        ds_object.metadata['uid'] = ds_object.object_id
    185185        # TODO: register the object for updates
    186     logging.debug('Written object %s to the datastore.' % ds_object.object_id)
     186    logging.debug('Written object %s to the datastore.', ds_object.object_id)
    187187
    188188def delete(object_id):
    189189    logging.debug('datastore.delete')
  • src/sugar/datastore/dbus_helpers.py

    diff --git a/src/sugar/datastore/dbus_helpers.py b/src/sugar/datastore/dbus_helpers.py
    index 9115382..94bf68a 100644
    a b def update(uid, properties, filename, transfer_ownership=False, 
    5252    debug_props = properties.copy()
    5353    if debug_props.has_key("preview"):
    5454        debug_props["preview"] = "<omitted>"
    55     logging.debug('dbus_helpers.update: %s, %s, %s, %s' %
    56                   (uid, filename, debug_props, transfer_ownership))
     55    logging.debug('dbus_helpers.update: %s, %s, %s, %s', uid, filename,
     56        debug_props, transfer_ownership)
    5757    if reply_handler and error_handler:
    5858        _get_data_store().update(uid, dbus.Dictionary(properties), filename,
    5959                transfer_ownership,
    def update(uid, properties, filename, transfer_ownership=False, 
    6565                                 filename, transfer_ownership)
    6666
    6767def delete(uid):
    68     logging.debug('dbus_helpers.delete: %r' % uid)
     68    logging.debug('dbus_helpers.delete: %r', uid)
    6969    _get_data_store().delete(uid)
    7070       
    7171def get_properties(uid):
    72     logging.debug('dbus_helpers.get_properties: %s' % uid)
     72    logging.debug('dbus_helpers.get_properties: %s', uid)
    7373    return _get_data_store().get_properties(uid, byte_arrays=True)
    7474
    7575def get_filename(uid):
    7676    filename = _get_data_store().get_filename(uid)
    77     logging.debug('dbus_helpers.get_filename: %s, %s' % (uid, filename))
     77    logging.debug('dbus_helpers.get_filename: %s, %s', uid, filename)
    7878    return filename
    7979
    8080def find(query, properties, reply_handler, error_handler):
    81     logging.debug('dbus_helpers.find: %r %r' % (query, properties))
     81    logging.debug('dbus_helpers.find: %r %r', query, properties)
    8282    if reply_handler and error_handler:
    8383        return _get_data_store().find(query, properties,
    8484                reply_handler=reply_handler, error_handler=error_handler,
  • src/sugar/graphics/icon.py

    diff --git a/src/sugar/graphics/icon.py b/src/sugar/graphics/icon.py
    index 2790775..51bb584 100644
    a b class _IconBuffer(object): 
    143143
    144144                del info
    145145            else:
    146                 logging.warning('No icon with the name %s '
    147                                 'was found in the theme.' % self.icon_name)
     146                logging.warning('No icon with the name %s was found in the '
     147                    'theme.', self.icon_name)
    148148
    149149        return icon_info
    150150
  • src/sugar/graphics/objectchooser.py

    diff --git a/src/sugar/graphics/objectchooser.py b/src/sugar/graphics/objectchooser.py
    index fb3703d..aa46738 100644
    a b class ObjectChooser(object): 
    110110    def __chooser_response_cb(self, chooser_id, object_id):
    111111        if chooser_id != self._chooser_id:
    112112            return
    113         logging.debug('ObjectChooser.__chooser_response_cb: %r' % object_id)
     113        logging.debug('ObjectChooser.__chooser_response_cb: %r', object_id)
    114114        self._response_code = gtk.RESPONSE_ACCEPT
    115115        self._object_id = object_id
    116116        self._cleanup()
    class ObjectChooser(object): 
    118118    def __chooser_cancelled_cb(self, chooser_id):
    119119        if chooser_id != self._chooser_id:
    120120            return
    121         logging.debug('ObjectChooser.__chooser_cancelled_cb: %r' % chooser_id)
     121        logging.debug('ObjectChooser.__chooser_cancelled_cb: %r', chooser_id)
    122122        self._response_code = gtk.RESPONSE_CANCEL
    123123        self._cleanup()
    124124
  • src/sugar/graphics/palette.py

    diff --git a/src/sugar/graphics/palette.py b/src/sugar/graphics/palette.py
    index 42d2beb..f0cf87a 100644
    a b class Palette(PaletteWindow): 
    180180        return self._full_request
    181181
    182182    def popup(self, immediate=False, state=None):
    183         logging.debug('Palette.popup immediate %r' % immediate)
     183        logging.debug('Palette.popup immediate %r', immediate)
    184184
    185185        if self._invoker is not None:
    186186            self._update_full_request()
  • src/sugar/graphics/palettewindow.py

    diff --git a/src/sugar/graphics/palettewindow.py b/src/sugar/graphics/palettewindow.py
    index 53b5f7c..6d95bac 100644
    a b class PaletteWindow(gtk.Window): 
    197197            self._invoker_hids.append(self._invoker.connect(
    198198                'right-click', self._invoker_right_click_cb))
    199199
    200         logging.debug('         Invoker set to %r' % self._invoker)
     200        logging.debug('         Invoker set to %r', self._invoker)
    201201
    202202    def get_invoker(self):
    203203        return self._invoker
    class PaletteWindow(gtk.Window): 
    296296        gtk.Bin.do_expose_event(self, event)
    297297
    298298    def update_position(self):
    299         logging.debug('    update_position    1 %r %r' % (self._invoker, self._alignment))
     299        logging.debug('    update_position    1 %r %r', self._invoker,
     300            self._alignment)
    300301        invoker = self._invoker
    301302        if invoker is None or self._alignment is None:
    302303            logging.error('Cannot update the palette position.')
    class PaletteWindow(gtk.Window): 
    307308        if position is None:
    308309            position = invoker.get_position(rect)
    309310
    310         logging.debug('    update_position    %r %r' % (position.x, position.y))
     311        logging.debug('    update_position    %r %r', position.x, position.y)
    311312        self.move(position.x, position.y)
    312313
    313314    def get_full_size_request(self):
    class PaletteWindow(gtk.Window): 
    329330            self.show()
    330331
    331332    def popdown(self, immediate=False):
    332         logging.debug('Palette.popdown immediate %r' % immediate)
     333        logging.debug('Palette.popdown immediate %r', immediate)
    333334        self._popup_anim.stop()
    334335
    335336        self._mouse_detector.stop()
  • src/sugar/graphics/toolbarbox.py

    diff --git a/src/sugar/graphics/toolbarbox.py b/src/sugar/graphics/toolbarbox.py
    index f3d624d..48b5e1a 100644
    a b class _ToolbarPalette(PaletteWindow): 
    205205    def _handle_focus(self, delta):
    206206        self._focus += delta
    207207        if self._focus not in (0, 1):
    208             logging.error('_Palette._focus=%s not in (0, 1)' % self._focus)
     208            logging.error('_Palette._focus=%s not in (0, 1)', self._focus)
    209209
    210210        if self._focus == 0:
    211211            group = palettegroup.get_group('default')
  • src/sugar/presence/presenceservice.py

    diff --git a/src/sugar/presence/presenceservice.py b/src/sugar/presence/presenceservice.py
    index a7fd1a4..cc72800 100644
    a b class PresenceService(gobject.GObject): 
    473473
    474474    def _share_activity_error_cb(self, activity, err):
    475475        """Notify with GObject event of unsuccessful sharing of activity"""
    476         _logger.debug("Error sharing activity %s: %s" %
    477                       (activity.get_id(), err))
     476        _logger.debug('Error sharing activity %s: %s', activity.get_id(),
     477            err)
    478478        self.emit("activity-shared", False, None, err)
    479479
    480480    def share_activity(self, activity, properties=None, private=True):
  • src/sugar/profile.py

    diff --git a/src/sugar/profile.py b/src/sugar/profile.py
    index d5012bd..9d897ba 100644
    a b class Profile(object): 
    6666            f = open(key_path, "r")
    6767            lines = f.readlines()
    6868            f.close()
    69         except IOError, e:
    70             logging.error("Error reading public key: %s" % e)
     69        except IOError:
     70            logging.exception('Error reading public key')
    7171            return None
    7272
    7373        magic = "ssh-dss "
    class Profile(object): 
    9292            f = open(key_path, "r")
    9393            lines = f.readlines()
    9494            f.close()
    95         except IOError, e:
    96             logging.error("Error reading private key: %s" % e)
     95        except IOError:
     96            logging.exception('Error reading private key')
    9797            return None
    9898
    9999        key = ""
  • src/sugar/util.py

    diff --git a/src/sugar/util.py b/src/sugar/util.py
    index 26bbe83..034038b 100644
    a b class TempFilePath(str): 
    272272        if path is None:
    273273            fd, path = tempfile.mkstemp()
    274274            os.close(fd)
    275         logging.debug('TempFilePath created %r' % path)
     275        logging.debug('TempFilePath created %r', path)
    276276
    277277        if path in _tracked_paths:
    278278            _tracked_paths[path] += 1
    class TempFilePath(str): 
    287287           
    288288            if os.path.exists(self):
    289289                os.unlink(self)
    290                 logging.debug('TempFilePath deleted %r' % self)
     290                logging.debug('TempFilePath deleted %r', self)
    291291            else:
    292                 logging.warning('TempFilePath already deleted %r' % self)
     292                logging.warning('TempFilePath already deleted %r', self)
    293293        else:
    294294            _tracked_paths[self] -= 1
    295295