<br><br><div class="gmail_quote">2011/11/30 Anish Mangal <span dir="ltr"><<a href="mailto:anish@activitycentral.org">anish@activitycentral.org</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

<div class="HOEnZb"><div class="h5">On Wed 30 Nov 2011 10:11:43 AM IST, Manuel Quiñones wrote:<br>
> Signed-off-by: Manuel Quiñones <<a href="mailto:manuq@laptop.org">manuq@laptop.org</a>><br>
> ---<br>
>  browser.py |   14 ++++++--------<br>
>  1 files changed, 6 insertions(+), 8 deletions(-)<br>
><br>
> diff --git a/browser.py b/browser.py<br>
> index 320cb62..789988d 100644<br>
> --- a/browser.py<br>
> +++ b/browser.py<br>
> @@ -39,7 +39,11 @@ import sessionstore<br>
>  from widgets import BrowserNotebook<br>
><br>
>  _ZOOM_AMOUNT = 0.1<br>
> -_LIBRARY_PATH = '/usr/share/library-common/index.html'<br>
> +if os.path.isfile('/usr/share/library-common/index.html'):<br>
> +    _HOMEPAGE_PATH = '/usr/share/library-common/index.html'<br>
> +else:<br>
> +    _HOMEPAGE_PATH = os.path.join(activity.get_bundle_path(),<br>
> +                                        "data/index.html")<br>
><br>
><br>
>  class SaveListener(object):<br>
> @@ -272,13 +276,7 @@ class TabbedView(BrowserNotebook):<br>
><br>
>      def load_homepage(self):<br>
>          browser = self.current_browser<br>
> -<br>
> -        if os.path.isfile(_LIBRARY_PATH):<br>
> -            browser.load_uri('file://' + _LIBRARY_PATH)<br>
> -        else:<br>
> -            default_page = os.path.join(activity.get_bundle_path(),<br>
> -                                        "data/index.html")<br>
> -            browser.load_uri(default_page)<br>
> +        browser.load_uri('file://' + _HOMEPAGE_PATH)<br>
><br>
>      def _get_current_browser(self):<br>
>          return self.get_nth_page(self.get_current_page()).get_child()<br>
<br>
</div></div><nitpicky><br>
IMO, moving the code from here to above is probably fine, but removing<br>
_LIBRARY_PATH would be adding that extra bit of complexity to the code.<br>
Having the variable makes it clear that:<br>
<br>
if LIBRARY_PATH:<br>
   load it<br>
else<br>
   load HOMEPAGE_PATH<br>
<br>
Also, maybe having an else-if instead of else for the HOMEPAGE_PATH<br>
check and having all this in a try..except would be safer<br>
</nitpicky><br>
<br></blockquote><div><br></div><div>+1.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Reviewed-by: Anish Mangal <<a href="mailto:anish@activitycentral.com">anish@activitycentral.com</a>><br>
<div class="HOEnZb"><div class="h5"><br>
_______________________________________________<br>
Sugar-devel mailing list<br>
<a href="mailto:Sugar-devel@lists.sugarlabs.org">Sugar-devel@lists.sugarlabs.org</a><br>
<a href="http://lists.sugarlabs.org/listinfo/sugar-devel" target="_blank">http://lists.sugarlabs.org/listinfo/sugar-devel</a><br>
</div></div></blockquote></div><br>