forked from 0x2620/pandora
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:
parent
728ed14499
commit
1468ddbecb
89 changed files with 400 additions and 265 deletions
|
|
@ -1,9 +1,10 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# vi:si:et:sw=4:sts=4:ts=4
|
||||
from __future__ import division, print_function, absolute_import
|
||||
|
||||
from django.contrib import admin
|
||||
|
||||
import models
|
||||
from . import models
|
||||
|
||||
|
||||
class EventAdmin(admin.ModelAdmin):
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
# vi:si:et:sw=4:sts=4:ts=4
|
||||
import unicodedata
|
||||
|
||||
from six import string_types
|
||||
from django.db.models import Q, Manager
|
||||
|
||||
from oxdjango.query import QuerySet
|
||||
|
|
@ -30,7 +31,7 @@ def parseCondition(condition, user):
|
|||
|
||||
key = k + get_operator(op, 'istr')
|
||||
key = str(key)
|
||||
if isinstance(v, unicode):
|
||||
if isinstance(v, string_types):
|
||||
v = unicodedata.normalize('NFKD', v).lower()
|
||||
if exclude:
|
||||
q = ~Q(**{k: v})
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
# -*- 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
|
||||
|
||||
from django.db import models, transaction
|
||||
from django.contrib.auth.models import User
|
||||
|
|
@ -13,7 +13,7 @@ from item import utils
|
|||
from person.models import get_name_sort
|
||||
from title.models import get_title_sort
|
||||
|
||||
import managers
|
||||
from . import managers
|
||||
|
||||
|
||||
class Event(models.Model):
|
||||
|
|
|
|||
|
|
@ -1,9 +1,10 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# vi:si:et:sw=4:sts=4:ts=4
|
||||
from __future__ import division, print_function, absolute_import
|
||||
|
||||
from celery.task import task
|
||||
|
||||
from models import Event
|
||||
from .models import Event
|
||||
|
||||
|
||||
'''
|
||||
|
|
|
|||
|
|
@ -1,10 +1,11 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# vi:si:et:sw=4:sts=4:ts=4
|
||||
from __future__ import division
|
||||
from __future__ import division, print_function, absolute_import
|
||||
|
||||
from django.db.models import Count
|
||||
from django.conf import settings
|
||||
|
||||
from six import string_types
|
||||
import ox
|
||||
from ox.utils import json
|
||||
from oxdjango.decorators import login_required_json
|
||||
|
|
@ -14,7 +15,7 @@ from oxdjango.api import actions
|
|||
from item import utils
|
||||
from changelog.models import add_changelog
|
||||
|
||||
import models
|
||||
from . import models
|
||||
|
||||
@login_required_json
|
||||
def addEvent(request, data):
|
||||
|
|
@ -47,7 +48,7 @@ def addEvent(request, data):
|
|||
'type', 'alternativeNames'):
|
||||
if key in data and data[key]:
|
||||
value = data[key]
|
||||
if isinstance(value, basestring):
|
||||
if isinstance(value, string_types):
|
||||
value = ox.escape_html(value)
|
||||
if key == 'alternativeNames':
|
||||
value = tuple([ox.escape_html(v) for v in value])
|
||||
|
|
@ -101,7 +102,7 @@ def editEvent(request, data):
|
|||
'type', 'alternativeNames'):
|
||||
if key in data:
|
||||
value = data[key]
|
||||
if isinstance(value, basestring):
|
||||
if isinstance(value, string_types):
|
||||
value = ox.escape_html(value)
|
||||
if key == 'alternativeNames':
|
||||
value = tuple([ox.escape_html(v) for v in value])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue