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,12 +1,13 @@
# -*- 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 os
import re
import subprocess
from glob import glob
from urllib import quote
from six.moves.urllib.parse import quote
from django.db import models
from django.db.models import Max
from django.contrib.auth.models import User
@ -18,7 +19,7 @@ from oxdjango.fields import TupleField
from archive import extract
from archive.chunk import save_chunk
import managers
from . import managers
def get_path(i, x): return i.path(x)
@ -217,7 +218,7 @@ class Text(models.Model):
else:
response['names'] = re.compile('<[^<>]*?data-name="(.+?)"').findall(self.text)
for key in response.keys():
for key in list(response):
if key not in keys + default_keys:
del response[key]
return response

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
@ -17,7 +18,7 @@ from django.shortcuts import render
from item import utils
from archive.chunk import process_chunk
import models
from . import models
from changelog.models import add_changelog
def get_text_or_404_json(id):