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

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

    From e4c74c98ada7e224238fbc844a2464156a6701e3 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 | 6 +++++-
     1 file changed, 5 insertions(+), 1 deletion(-)
    
    diff --git a/mediagoblin/processing/__init__.py b/mediagoblin/processing/__init__.py
    index bdbe044..070e582 100644
    a b  
    1414# You should have received a copy of the GNU Affero General Public License
    1515# along with this program.  If not, see <http://www.gnu.org/licenses/>.
    1616
    17 from collections import OrderedDict
     17try:
     18    from collections import OrderedDict
     19except ImportError:
     20    # Python 2.6 in use.
     21    from ordereddict import OrderedDict
    1822import logging
    1923import os
    2024