<div dir="ltr"><br>Here is my patch: it checks if language code is not defined and use default values in that case.<br><br>[<a href="https://github.com/sugarlabs/sugar/pull/71">https://github.com/sugarlabs/sugar/pull/71</a>]<br>

<br>diff --git a/extensions/cpsection/modemconfiguration/model.py b/extensions/cpsection/modemconfiguration/model.py<br>index c4e354d..a87cb03 100755<br>--- a/extensions/cpsection/modemconfiguration/model.py<br>+++ b/extensions/cpsection/modemconfiguration/model.py<br>

@@ -119,10 +119,15 @@ class ServiceProvidersError(Exception):<br> <br> def _get_name(el):<br>     language_code = locale.getdefaultlocale()[0]<br>-    lang = language_code.split('_')[0]<br>-    lang_ns_attr = '{<a href="http://www.w3.org/XML/1998/namespace}lang">http://www.w3.org/XML/1998/namespace}lang</a>'<br>

 <br>-    tag = el.find('name[@%s="%s"]' % (lang_ns_attr, lang))<br>+    if language_code is None:<br>+        tag = None<br>+    else:<br>+        lang = language_code.split('_')[0]<br>+        lang_ns_attr = '{<a href="http://www.w3.org/XML/1998/namespace}lang">http://www.w3.org/XML/1998/namespace}lang</a>'<br>

+<br>+        tag = el.find('name[@%s="%s"]' % (lang_ns_attr, lang))<br>+<br>     if tag is None:<br>         tag = el.find('name')<br> <br>@@ -296,8 +301,11 @@ def __init__(self):<br>     def _guess_country_code(self):<br>

         """Return country based on locale lang attribute."""<br>         language_code = locale.getdefaultlocale()[0]<br>-        lc_list = language_code.split('_')<br>-        country_code = lc_list[1].lower() if len(lc_list) >= 2 else ''<br>

+        if language_code is None:<br>+            country_code = ''<br>+        else:<br>+            lc_list = language_code.split('_')<br>+            country_code = lc_list[1].lower() if len(lc_list) >= 2 else ''<br>

         return country_code<br> <br>     def _get_initials(self):<br><br><br><br><br><br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Jul 29, 2013 at 10:00 AM, Daniel Narvaez <span dir="ltr"><<a href="mailto:dwnarvaez@gmail.com" target="_blank">dwnarvaez@gmail.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Miguel,<div><br></div><div>I think I misunderstood your analysis of the issue. sugar-build sets LANG to C and I think that's something that should be supported... So I think we should go with 2 in your list of alternatives.<div>

<div class="h5"><span></span><br>
<br>On Monday, 29 July 2013, Miguel González  wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>Hi Daniel,<br><br></div>Could you give some hint on how to change locale for test runner in buildbolt? I was looking where to patch but I didn't find the correct place. I guess is sugar-build but I admit I'm completely lost.<br>




<div class="gmail_extra"><br></div><div class="gmail_extra">Sorry about not asking for help before.<br></div><div><br><div>On Sun, Jul 28, 2013 at 4:21 PM, Daniel Narvaez <span dir="ltr"><<a>dwnarvaez@gmail.com</a>></span> wrote:<br>




<blockquote style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Miguel,<br><br>can you please send a patch for this as soon as possible? The build has been broken for a few days now...<br>




</div><div><div><div><br><br><div>On 24 July 2013 08:59, Daniel Narvaez <span dir="ltr"><<a>dwnarvaez@gmail.com</a>></span> wrote:<br>


<blockquote style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Being shell code I think it's fine to assume the locale has been set. So I'd go <span></span>for 1.<div>
<div><br><br>On Wednesday, 24 July 2013, Miguel González  wrote:<br><blockquote style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr"><div><div><div><div><div><div>In this case in extensions/cpsection/modemconfiguration/model.py:299<br><br>language_code = locale.getdefaultlocale()[0]<br><br></div>returns None<br><br></div>so one of the test fails:<br>








<br>======================================================================<br>ERROR: test_go_trough_all_combo_options (test_modemconfiguration.ServiceProvidersTest)<br>----------------------------------------------------------------------<br>








Traceback (most recent call last):<br>  File "/home/broot/sugar-build/sugar/tests/test_modemconfiguration.py", line 128, in setUp<br>    self.db = ServiceProviders()<br>  File "/home/broot/sugar-build/build/out/install/share/sugar/extensions/cpsection/modemconfiguration/model.py", line 274, in __init__<br>








    country_code, provider_name, plan_idx = self._get_initials()<br>  File "/home/broot/sugar-build/build/out/install/share/sugar/extensions/cpsection/modemconfiguration/model.py", line 309, in _get_initials<br>








    country_code = self._guess_country_code()<br>  File "/home/broot/sugar-build/build/out/install/share/sugar/extensions/cpsection/modemconfiguration/model.py", line 299, in _guess_country_code<br>    lc_list = language_code.split('_')<br>








AttributeError: 'NoneType' object has no attribute 'split'<br><br>----------------------------------------------------------------------<br><br></div>So:<br><br></div>1) Must set a locale in test environment?<br>








<br></div>2) Make code handle this scenario?<br><br></div>3) Both?<br><br><div><div><div><div><br></div></div></div></div></div><div><br><br><div>On Tue, Jul 23, 2013 at 11:56 PM, Daniel Narvaez <span dir="ltr"><<a>dwnarvaez@gmail.com</a>></span> wrote:<br>








<blockquote style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Still failing. Could that error be due to non functional gconf?<div><br></div><div><span style="font-family:Helvetica;white-space:nowrap"><a href="http://buildbot.sugarlabs.org/builders/quick/builds/46/steps/shell_2/logs/log" target="_blank">http://buildbot.sugarlabs.org/builders/quick/builds/46/steps/shell_2/logs/log</a></span><br>









</div><div><br></div><div><span></span>I see a gconf error earlier in the log. I haven't yet looked at what is going on with it. Maybe just a missing dependency.<div><div><br><br>On Tuesday, 23 July 2013, Miguel González  wrote:<br>









<blockquote style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><a href="https://github.com/sugarlabs/sugar-build/pull/22" target="_blank">https://github.com/sugarlabs/sugar-build/pull/22</a><br>









<pre>diff --git a/build/root.json b/build/root.json
index dd496e2..5a72922 100644
--- a/build/root.json
+++ b/build/root.json
@@ -67,6 +67,7 @@
             "gstreamer-plugins-espeak",
             "telepathy-salut",
             "telepathy-gabble",
+            "mobile-broadband-provider-info",
             "gnome-themes-standard",
             "xorg-x11-drv-evdev",
             "xorg-x11-drv-modesetting",
</pre><br></div><div><br><br><div>On Tue, Jul 23, 2013 at 12:53 PM, Daniel Narvaez <span dir="ltr"><<a>dwnarvaez@gmail.com</a>></span> wrote:<br>


<blockquote style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Yes!<div><span></span><br><br>On Tuesday, 23 July 2013, Miguel González  wrote:<br></div><div>

<div><blockquote style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>It fails again [1] because does not find /usr/share/mobile-broadband-provider-info/serviceproviders.xml. <br>





<br></div>It seems this file is included in package mobile-broadband-pro</div></blockquote></div></div></blockquote></div></div></blockquote></div></div></div></blockquote></div></div></blockquote></div></div></blockquote>


</div></div></div></div></blockquote></div></div></div>
</blockquote></div></div></div><span class="HOEnZb"><font color="#888888"><br><br>-- <br>Daniel Narvaez<br><br>
</font></span></blockquote></div><br><br clear="all"><br>-- <br><div dir="ltr">Miguel González<br>Activity Central: <a href="http://www.activitycentral.com" target="_blank">http://www.activitycentral.com</a><br></div>
</div>