<div dir="ltr"><div class="gmail_default" style="font-family:tahoma,sans-serif">Thank you for spotting this,<br><br>New patch will be sent with the next submission.<br><br>Thanks,<br>Alex<br></div></div><div class="gmail_extra">
<br><br><div class="gmail_quote">On Fri, Apr 4, 2014 at 4:20 PM, Paul Eggleton <span dir="ltr"><<a href="mailto:paul.eggleton@linux.intel.com" target="_blank">paul.eggleton@linux.intel.com</a>></span> wrote:<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 Friday 04 April 2014 15:10:42 Alex DAMIAN wrote:<br>
> From: Alexandru DAMIAN <<a href="mailto:alexandru.damian@intel.com">alexandru.damian@intel.com</a>><br>
><br>
> This patch makes sure that we only load pytz-recognized<br>
> timezones. Pytz is used to transform the timezone information<br>
> for the database queries, and needs to be able to deal with<br>
> the TIME_ZONE value that we set up.<br>
><br>
> [YOCTO #6093]<br>
><br>
> Signed-off-by: Alexandru DAMIAN <<a href="mailto:alexandru.damian@intel.com">alexandru.damian@intel.com</a>><br>
> ---<br>
> lib/toaster/toastermain/settings.py | 8 +++++++-<br>
> 1 file changed, 7 insertions(+), 1 deletion(-)<br>
><br>
> diff --git a/lib/toaster/toastermain/settings.py<br>
> b/lib/toaster/toastermain/settings.py index e26ee3c..e39b4cb 100644<br>
> --- a/lib/toaster/toastermain/settings.py<br>
> +++ b/lib/toaster/toastermain/settings.py<br>
> @@ -64,7 +64,13 @@ else:<br>
> for dirpath, dirnames, filenames in os.walk(ZONEINFOPATH):<br>
> for fn in filenames:<br>
> filepath = os.path.join(dirpath, fn)<br>
> - zonefilelist[hashlib.md5(open(filepath).read()).hexdigest()] =<br>
> filepath.lstrip(ZONEINFOPATH).strip() + try:<br>
> + import pytz<br>
> + zonename = filepath.lstrip(ZONEINFOPATH).strip()<br>
> + if pytz.timezone(zonename) is not None:<br>
> +<br>
> zonefilelist[hashlib.md5(open(filepath).read()).hexdigest()] = zonename<br>
> + except Exception:<br>
> + pass<br>
<br>
</div></div>Please do not do blanket exception catching like this. You need to catch the<br>
exact class of exception you expect to receive.<br>
<br>
Cheers,<br>
Paul<br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
<br>
Paul Eggleton<br>
Intel Open Source Technology Centre<br>
</font></span></blockquote></div><br><br clear="all"><br>-- <br><div dir="ltr">Alex Damian<div>Yocto Project<br></div><div>SSG / OTC </div></div>
</div>