towards supporting python 2 and 3

- use absolute_imports
- make use of six.moves
- use exec instead of execfile
- use list(dict) instead if dict.keys()
This commit is contained in:
j 2016-08-23 12:27:06 +02:00
commit 1468ddbecb
89 changed files with 400 additions and 265 deletions

View file

@ -1,15 +1,15 @@
# -*- coding: utf-8 -*-
# vi:si:et:sw=4:sts=4:ts=4
from __future__ import division, with_statement
from __future__ import division, print_function, absolute_import
import re
import os
import shutil
from glob import glob
import subprocess
from urllib import quote
import tempfile
from six.moves.urllib.parse import quote
import ox
from oxdjango.fields import DictField, TupleField
from django.conf import settings
@ -24,7 +24,7 @@ import clip.models
from archive import extract
import managers
from . import managers
def get_path(f, x): return f.path(x)
def get_icon_path(f, x): return get_path(f, 'icon.jpg')

View file

@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-
# vi:si:et:sw=4:sts=4:ts=4
from __future__ import division
from __future__ import division, print_function, absolute_import
import os
import re
@ -16,7 +17,7 @@ from django.conf import settings
from item import utils
from changelog.models import add_changelog
import models
from . import models
def get_edit_or_404_json(id):
id = id.split(':')
@ -400,7 +401,7 @@ def findEdits(request, data):
x['value'] == 'featured' and \
x['operator'] in ('=', '==')
is_featured = len(filter(is_featured_condition, data.get('query', {}).get('conditions', []))) > 0
is_featured = any(filter(is_featured_condition, data.get('query', {}).get('conditions', [])))
if is_section_request:
qs = query['qs']