[Sugar-devel] [PATCH browse] Adopt to WebKit API for title of the browser widget

Sascha Silbe sascha-ml-reply-to-2012-1 at silbe.org
Mon Jan 9 05:45:14 EST 2012


Excerpts from Simon Schampijer's message of 2012-01-04 14:34:29 +0100:

[webactivity.py]
> @@ -426,7 +426,7 @@ class WebActivity(activity.Activity):
>              browser = self._tabbed_view.current_browser
>  
>              if not self._jobject.metadata['title_set_by_user'] == '1':
> -                if browser.props.title == '':
> +                if browser.props.title == None:
>                      self.metadata['title'] = _('Untitled')
>                  else:
>                      self.metadata['title'] = browser.props.title


PEP 8, section "Programming Recommendations":

    - Comparisons to singletons like None should always be done with
      'is' or 'is not', never the equality operators.


IMO it would make sense to replace the empty string with Untitled as
well. I.e.:

                if not browser.props.title:
                    self.metadata['title'] = _('Untitled')
                else:
                    self.metadata['title'] = browser.props.title

Sascha

-- 
http://sascha.silbe.org/
http://www.infra-silbe.de/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 490 bytes
Desc: not available
URL: <http://lists.sugarlabs.org/archive/sugar-devel/attachments/20120109/8efc17e8/attachment.pgp>


More information about the Sugar-devel mailing list