dongsh...@apache.org wrote on Tue, Jul 02, 2013 at 14:12:44 -0000:
> Author: dongsheng
> Date: Tue Jul  2 14:12:44 2013
> New Revision: 1498947
> 
> URL: http://svn.apache.org/r1498947
> Log:
> Make sure msgstr is not None before do iteration.
> 
> Obvious fix.
> 

No, it's not an obvious fix.  It's a code change, and one which is not
obvious, so it requires review.

>   Since parse_translation maybe return (comments, None, None, None),

When does that happen?  Why is that not a bug?  Why no translator run
into it until today?

Thanks,

Daniel

> * tools/dev/po-merge.py
>   we should not do iteration without check msgstr is not None. Otherwise,
>   we may encounter the following TypeError:
> 
>     Traceback (most recent call last):
>       File "../../../../trunk/tools/dev/po-merge.py", line 196, in <module>
>         main(sys.argv)
>       File "../../../../trunk/tools/dev/po-merge.py", line 181, in main
>         for m in msgstr:
>     TypeError: 'NoneType' object is not iterable
> 
> Modified:
>     subversion/trunk/tools/dev/po-merge.py
> 
> Modified: subversion/trunk/tools/dev/po-merge.py
> URL: 
> http://svn.apache.org/viewvc/subversion/trunk/tools/dev/po-merge.py?rev=1498947&r1=1498946&r2=1498947&view=diff
> ==============================================================================
> --- subversion/trunk/tools/dev/po-merge.py (original)
> +++ subversion/trunk/tools/dev/po-merge.py Tue Jul  2 14:12:44 2013
> @@ -178,9 +178,10 @@ def main(argv):
>                  for i in msgstr:
>                      outfile.write('msgstr[%s] %s\n' % (n, msgstr[n]))
>                      n += 1
> -        for m in msgstr:
> -            if m == '""':
> -                untranslated += 1
> +        if msgstr is not None:
> +            for m in msgstr:
> +                if m == '""':
> +                    untranslated += 1
>          for c in comments:
>              if c.startswith('#,') and 'fuzzy' in c.split(', '):
>                  fuzzy += 1
> 
> 

Reply via email to