From: <fri...@us...> - 2011-03-18 08:38:23
|
Revision: 17310 http://translate.svn.sourceforge.net/translate/?rev=17310&view=rev Author: friedelwolff Date: 2011-03-18 08:38:16 +0000 (Fri, 18 Mar 2011) Log Message: ----------- Check the language code for validity before blindly returning it Modified Paths: -------------- src/trunk/translate/storage/poheader.py Modified: src/trunk/translate/storage/poheader.py =================================================================== --- src/trunk/translate/storage/poheader.py 2011-03-17 13:55:17 UTC (rev 17309) +++ src/trunk/translate/storage/poheader.py 2011-03-18 08:38:16 UTC (rev 17310) @@ -1,7 +1,7 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Copyright 2002-2009 Zuza Software Foundation +# Copyright 2002-2011 Zuza Software Foundation # # This file is part of the Translate Toolkit. # @@ -276,7 +276,11 @@ header = self.parseheader() lang = header.get('Language', None) if lang is not None: - return lang + from translate.lang.data import langcode_ire + if langcode_ire.match(lang): + return lang + else: + lang = None if 'X-Poedit-Language' in header: from translate.lang import poedit language = header.get('X-Poedit-Language') This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |