Ticket #761: 0001-fixes-a-python2.6-specific-issue-related-to-OrderedD.patch

File 0001-fixes-a-python2.6-specific-issue-related-to-OrderedD.patch, 1.4 KB (added by rsd, 11 years ago)
  • mediagoblin/processing/__init__.py

    From 6c9f40ff24f860077e5722bf9ad845e0c0be9518 Mon Sep 17 00:00:00 2001
    From: rsiddharth <rsiddharth@ninthfloor.org>
    Date: Mon, 2 Sep 2013 18:22:31 +0530
    Subject: [PATCH] fixes a python2.6 specific issue related to OrderedDict.
    In Python 2.6, OrderedDict is not part of `collections', by virtue of
    which an ImportError is throw when
    `mediagoblin/processing/__init__.py' imports OrderedDict from
    'collections'. To fix this, we try importing OrderedDict from
    collections, if it throws an ImportError (meaning python2.6 is in
    use), we import OrderedDict from 'ordereddict'.
     mediagoblin/processing/__init__.py | 8 ++++++--
     1 file changed, 6 insertions(+), 2 deletions(-)
    diff --git a/mediagoblin/processing/__init__.py b/mediagoblin/processing/__init__.py
    index 361a973..7a9603b 100644
    a b  
    1212# GNU Affero General Public License for more details.
    1414# You should have received a copy of the GNU Affero General Public License
    15 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
     15# along with this program.  If not, see <http://www.gnu.org/licenses/>
    17 from collections import OrderedDict
     18    from collections import OrderedDict
     19except ImportError:
     20    # Python 2.6 in use.
     21    from ordereddict import OrderedDict
    1822import logging
    1923import os