forked from 0x2620/pandora
cleanup unused imports and unused variables
This commit is contained in:
parent
06f6a79b7b
commit
b1d83b0f93
42 changed files with 30 additions and 155 deletions
|
@ -12,14 +12,13 @@ from django.db.models.signals import pre_delete
|
||||||
|
|
||||||
import ox
|
import ox
|
||||||
|
|
||||||
from archive import extract
|
|
||||||
from clip.models import Clip
|
from clip.models import Clip
|
||||||
from changelog.models import Changelog
|
from changelog.models import Changelog
|
||||||
|
|
||||||
from item.utils import sort_string
|
from item.utils import sort_string
|
||||||
import managers
|
import managers
|
||||||
import utils
|
import utils
|
||||||
from tasks import update_matches, update_item
|
from tasks import update_matches
|
||||||
|
|
||||||
|
|
||||||
def get_super_matches(obj, model):
|
def get_super_matches(obj, model):
|
||||||
|
|
|
@ -4,13 +4,11 @@ from __future__ import division
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
|
||||||
import ox
|
|
||||||
from ox.utils import json
|
from ox.utils import json
|
||||||
from ox.django.decorators import login_required_json
|
from ox.django.decorators import login_required_json
|
||||||
from ox.django.shortcuts import render_to_json_response, get_object_or_404_json, json_response
|
from ox.django.shortcuts import render_to_json_response, get_object_or_404_json, json_response
|
||||||
|
|
||||||
|
|
||||||
from item.models import Item
|
|
||||||
from ox.django.api import actions
|
from ox.django.api import actions
|
||||||
|
|
||||||
from item import utils
|
from item import utils
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# vi:si:et:sw=4:sts=4:ts=4
|
# vi:si:et:sw=4:sts=4:ts=4
|
||||||
from django.core.management.base import BaseCommand
|
from django.core.management.base import BaseCommand
|
||||||
from django.db import connection, transaction
|
from django.db import connection
|
||||||
|
|
||||||
|
|
||||||
class Command(BaseCommand):
|
class Command(BaseCommand):
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
# vi:si:et:sw=4:sts=4:ts=4
|
# vi:si:et:sw=4:sts=4:ts=4
|
||||||
import datetime
|
import datetime
|
||||||
|
|
||||||
from celery.task import task, periodic_task
|
from celery.task import periodic_task
|
||||||
from celery.schedules import crontab
|
from celery.schedules import crontab
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,7 +0,0 @@
|
||||||
from django.conf import settings
|
|
||||||
from django import forms
|
|
||||||
|
|
||||||
import models
|
|
||||||
from item.models import Item
|
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,8 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# vi:si:et:sw=4:sts=4:ts=4
|
# vi:si:et:sw=4:sts=4:ts=4
|
||||||
import os
|
|
||||||
from optparse import make_option
|
from optparse import make_option
|
||||||
|
|
||||||
from django.core.management.base import BaseCommand
|
from django.core.management.base import BaseCommand
|
||||||
from django.conf import settings
|
|
||||||
|
|
||||||
import monkey_patch.models
|
import monkey_patch.models
|
||||||
from ... import models
|
from ... import models
|
||||||
|
|
|
@ -3,19 +3,16 @@
|
||||||
from __future__ import division, with_statement
|
from __future__ import division, with_statement
|
||||||
|
|
||||||
import os.path
|
import os.path
|
||||||
import re
|
|
||||||
import time
|
import time
|
||||||
import shutil
|
import shutil
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.contrib.auth.models import User
|
from django.contrib.auth.models import User
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.db.models import Q
|
|
||||||
from django.db.models.signals import pre_delete
|
from django.db.models.signals import pre_delete
|
||||||
|
|
||||||
from ox.django import fields
|
from ox.django import fields
|
||||||
import ox
|
import ox
|
||||||
import chardet
|
|
||||||
|
|
||||||
from item import utils
|
from item import utils
|
||||||
import item.models
|
import item.models
|
||||||
|
|
|
@ -3,12 +3,10 @@
|
||||||
from glob import glob
|
from glob import glob
|
||||||
|
|
||||||
from celery.task import task
|
from celery.task import task
|
||||||
import ox
|
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
|
||||||
from item.models import Item
|
from item.models import Item
|
||||||
import item.tasks
|
|
||||||
import models
|
import models
|
||||||
import extract
|
import extract
|
||||||
|
|
||||||
|
@ -107,7 +105,7 @@ def extract_derivatives(fileId, rebuild=False):
|
||||||
file = models.File.objects.get(id=fileId)
|
file = models.File.objects.get(id=fileId)
|
||||||
streams = file.streams.filter(source=None)
|
streams = file.streams.filter(source=None)
|
||||||
if streams.count() > 0:
|
if streams.count() > 0:
|
||||||
stream[0].extract_derivatives(rebuild)
|
streams[0].extract_derivatives(rebuild)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
@task(queue="encoding")
|
@task(queue="encoding")
|
||||||
|
|
|
@ -7,7 +7,7 @@ from datetime import datetime
|
||||||
from django import forms
|
from django import forms
|
||||||
from django.shortcuts import get_object_or_404, redirect
|
from django.shortcuts import get_object_or_404, redirect
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.db.models import Count, Q
|
from django.db.models import Count
|
||||||
|
|
||||||
import ox
|
import ox
|
||||||
from ox.utils import json
|
from ox.utils import json
|
||||||
|
@ -282,7 +282,6 @@ def firefogg_upload(request):
|
||||||
def taskStatus(request):
|
def taskStatus(request):
|
||||||
#FIXME: should check if user has permissions to get status
|
#FIXME: should check if user has permissions to get status
|
||||||
data = json.loads(request.POST['data'])
|
data = json.loads(request.POST['data'])
|
||||||
user = request.user
|
|
||||||
task_id = data['task_id']
|
task_id = data['task_id']
|
||||||
response = task_status(request, task_id)
|
response = task_status(request, task_id)
|
||||||
return render_to_json_response(response)
|
return render_to_json_response(response)
|
||||||
|
|
|
@ -2,12 +2,8 @@
|
||||||
# vi:si:et:sw=4:sts=4:ts=4
|
# vi:si:et:sw=4:sts=4:ts=4
|
||||||
from __future__ import division, with_statement
|
from __future__ import division, with_statement
|
||||||
|
|
||||||
import re
|
|
||||||
|
|
||||||
from django.db import models, transaction
|
from django.db import models, transaction
|
||||||
from django.contrib.auth.models import User
|
from django.contrib.auth.models import User
|
||||||
from django.db.models import Q
|
|
||||||
from django.conf import settings
|
|
||||||
import ox
|
import ox
|
||||||
from ox.django import fields
|
from ox.django import fields
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,7 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# vi:si:et:sw=4:sts=4:ts=4
|
# vi:si:et:sw=4:sts=4:ts=4
|
||||||
from datetime import timedelta
|
|
||||||
|
|
||||||
from celery.task import task, periodic_task
|
|
||||||
from celery.schedules import crontab
|
|
||||||
|
|
||||||
|
from celery.task import task
|
||||||
|
|
||||||
from models import Event
|
from models import Event
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
# vi:si:et:sw=4:sts=4:ts=4
|
# vi:si:et:sw=4:sts=4:ts=4
|
||||||
from __future__ import division
|
from __future__ import division
|
||||||
|
|
||||||
from django.db.models import Max, Min, Count
|
from django.db.models import Count
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
|
||||||
import ox
|
import ox
|
||||||
|
|
|
@ -1,2 +0,0 @@
|
||||||
from django.conf import settings
|
|
||||||
|
|
|
@ -2,12 +2,9 @@
|
||||||
# vi:si:et:sw=4:sts=4:ts=4
|
# vi:si:et:sw=4:sts=4:ts=4
|
||||||
|
|
||||||
import os
|
import os
|
||||||
from os.path import join, dirname, basename, splitext, exists
|
|
||||||
import time
|
|
||||||
from glob import glob
|
from glob import glob
|
||||||
|
|
||||||
from django.core.management.base import BaseCommand, CommandError
|
from django.core.management.base import BaseCommand
|
||||||
from django.conf import settings
|
|
||||||
|
|
||||||
import monkey_patch.models
|
import monkey_patch.models
|
||||||
from ... import models
|
from ... import models
|
||||||
|
@ -23,7 +20,7 @@ class Command(BaseCommand):
|
||||||
def handle(self, **options):
|
def handle(self, **options):
|
||||||
offset = 0
|
offset = 0
|
||||||
chunk = 100
|
chunk = 100
|
||||||
count = pos = models.Item.objects.count()
|
count = models.Item.objects.count()
|
||||||
while offset <= count:
|
while offset <= count:
|
||||||
for i in models.Item.objects.all().order_by('id')[offset:offset+chunk]:
|
for i in models.Item.objects.all().order_by('id')[offset:offset+chunk]:
|
||||||
if not os.path.exists(os.path.join(i.timeline_prefix, 'cuts.json')) or \
|
if not os.path.exists(os.path.join(i.timeline_prefix, 'cuts.json')) or \
|
||||||
|
|
|
@ -1,12 +1,9 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# vi:si:et:sw=4:sts=4:ts=4
|
# vi:si:et:sw=4:sts=4:ts=4
|
||||||
|
|
||||||
import os
|
|
||||||
from os.path import join, dirname, basename, splitext, exists
|
|
||||||
import time
|
import time
|
||||||
|
|
||||||
from django.core.management.base import BaseCommand, CommandError
|
from django.core.management.base import BaseCommand
|
||||||
from django.conf import settings
|
|
||||||
|
|
||||||
import monkey_patch.models
|
import monkey_patch.models
|
||||||
from ... import models
|
from ... import models
|
||||||
|
|
|
@ -8,7 +8,6 @@ from django.conf import settings
|
||||||
|
|
||||||
import monkey_patch.models
|
import monkey_patch.models
|
||||||
from ... import models
|
from ... import models
|
||||||
import time
|
|
||||||
|
|
||||||
|
|
||||||
class Command(BaseCommand):
|
class Command(BaseCommand):
|
||||||
|
|
|
@ -4,7 +4,6 @@ from optparse import make_option
|
||||||
|
|
||||||
from django.core.management.base import BaseCommand
|
from django.core.management.base import BaseCommand
|
||||||
from django.db import connection, transaction
|
from django.db import connection, transaction
|
||||||
from django.conf import settings
|
|
||||||
from django.db.models import fields
|
from django.db.models import fields
|
||||||
|
|
||||||
import monkey_patch.models
|
import monkey_patch.models
|
||||||
|
|
|
@ -3,9 +3,7 @@
|
||||||
from __future__ import division, with_statement
|
from __future__ import division, with_statement
|
||||||
|
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
import math
|
|
||||||
import os.path
|
import os.path
|
||||||
import re
|
|
||||||
import subprocess
|
import subprocess
|
||||||
from glob import glob
|
from glob import glob
|
||||||
import shutil
|
import shutil
|
||||||
|
@ -14,12 +12,10 @@ import unicodedata
|
||||||
from urllib import quote
|
from urllib import quote
|
||||||
|
|
||||||
from django.db import models, transaction
|
from django.db import models, transaction
|
||||||
from django.db.models import Count, Q, Sum, Max
|
from django.db.models import Q, Sum, Max
|
||||||
from django.core.files.base import ContentFile
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.contrib.auth.models import User, Group
|
from django.contrib.auth.models import User, Group
|
||||||
from django.db.models.signals import pre_delete
|
from django.db.models.signals import pre_delete
|
||||||
from django.contrib.sites.models import Site
|
|
||||||
|
|
||||||
import ox
|
import ox
|
||||||
from ox.django import fields
|
from ox.django import fields
|
||||||
|
|
|
@ -3,9 +3,8 @@
|
||||||
#
|
#
|
||||||
from decimal import Decimal
|
from decimal import Decimal
|
||||||
import re
|
import re
|
||||||
import unicodedata
|
|
||||||
import ox
|
import ox
|
||||||
from ox import sorted_strings, sort_string
|
from ox import sort_string
|
||||||
|
|
||||||
def safe_filename(filename):
|
def safe_filename(filename):
|
||||||
filename = filename.replace(': ', '_ ')
|
filename = filename.replace(': ', '_ ')
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
# vi:si:et:sw=4:sts=4:ts=4
|
# vi:si:et:sw=4:sts=4:ts=4
|
||||||
from __future__ import division
|
from __future__ import division
|
||||||
import os.path
|
import os.path
|
||||||
from datetime import datetime, timedelta
|
|
||||||
import mimetypes
|
import mimetypes
|
||||||
import random
|
import random
|
||||||
from urlparse import urlparse
|
from urlparse import urlparse
|
||||||
|
@ -10,7 +9,7 @@ from urllib import quote
|
||||||
import time
|
import time
|
||||||
|
|
||||||
import Image
|
import Image
|
||||||
from django.db.models import Count, Sum, Max
|
from django.db.models import Count, Sum
|
||||||
from django.template import RequestContext
|
from django.template import RequestContext
|
||||||
from django.http import HttpResponse, HttpResponseForbidden, Http404
|
from django.http import HttpResponse, HttpResponseForbidden, Http404
|
||||||
from django.shortcuts import get_object_or_404, redirect, render_to_response
|
from django.shortcuts import get_object_or_404, redirect, render_to_response
|
||||||
|
@ -21,7 +20,6 @@ from ox.utils import json, ET
|
||||||
from ox.django.decorators import login_required_json
|
from ox.django.decorators import login_required_json
|
||||||
from ox.django.shortcuts import render_to_json_response, get_object_or_404_json, json_response
|
from ox.django.shortcuts import render_to_json_response, get_object_or_404_json, json_response
|
||||||
from ox.django.http import HttpFileResponse
|
from ox.django.http import HttpFileResponse
|
||||||
from django.db.models import Q
|
|
||||||
import ox
|
import ox
|
||||||
|
|
||||||
import models
|
import models
|
||||||
|
@ -34,8 +32,6 @@ from clip.models import Clip
|
||||||
|
|
||||||
from ox.django.api import actions
|
from ox.django.api import actions
|
||||||
|
|
||||||
import utils
|
|
||||||
|
|
||||||
|
|
||||||
def _order_query(qs, sort, prefix='sort__'):
|
def _order_query(qs, sort, prefix='sort__'):
|
||||||
order_by = []
|
order_by = []
|
||||||
|
|
|
@ -1,11 +1,8 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# vi:si:et:sw=4:sts=4:ts=4
|
# vi:si:et:sw=4:sts=4:ts=4
|
||||||
from datetime import datetime
|
|
||||||
|
|
||||||
from django.db.models import Q, Manager
|
from django.db.models import Q, Manager
|
||||||
|
|
||||||
import models
|
|
||||||
|
|
||||||
|
|
||||||
def parseCondition(condition, user):
|
def parseCondition(condition, user):
|
||||||
'''
|
'''
|
||||||
|
|
|
@ -4,11 +4,8 @@ from __future__ import division
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
|
|
||||||
import ox
|
|
||||||
|
|
||||||
from django.db.models import Max, Sum
|
from django.db.models import Max, Sum
|
||||||
from django.db import transaction
|
from django.db import transaction
|
||||||
from django.http import HttpResponseForbidden, Http404
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from ox.utils import json
|
from ox.utils import json
|
||||||
from ox.django.decorators import login_required_json
|
from ox.django.decorators import login_required_json
|
||||||
|
|
|
@ -1,13 +1,10 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# vi:si:et:sw=4:sts=4:ts=4
|
# vi:si:et:sw=4:sts=4:ts=4
|
||||||
import os
|
|
||||||
from datetime import timedelta, datetime
|
from datetime import timedelta, datetime
|
||||||
import gzip
|
|
||||||
import random
|
import random
|
||||||
random
|
random
|
||||||
|
|
||||||
from django.conf import settings
|
from celery.task import periodic_task
|
||||||
from celery.task import task, periodic_task
|
|
||||||
|
|
||||||
import models
|
import models
|
||||||
|
|
||||||
|
|
|
@ -5,8 +5,8 @@ from __future__ import division
|
||||||
import ox
|
import ox
|
||||||
from ox.utils import json
|
from ox.utils import json
|
||||||
|
|
||||||
from ox.django.decorators import login_required_json, admin_required_json
|
from ox.django.decorators import admin_required_json
|
||||||
from ox.django.shortcuts import render_to_json_response, get_object_or_404_json, json_response
|
from ox.django.shortcuts import render_to_json_response, json_response
|
||||||
|
|
||||||
from ox.django.api import actions
|
from ox.django.api import actions
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
from __future__ import division, with_statement
|
from __future__ import division, with_statement
|
||||||
|
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.contrib.auth.models import User
|
|
||||||
import ox
|
import ox
|
||||||
|
|
||||||
from changelog.models import Changelog
|
from changelog.models import Changelog
|
||||||
|
|
|
@ -2,20 +2,14 @@
|
||||||
# vi:si:et:sw=4:sts=4:ts=4
|
# vi:si:et:sw=4:sts=4:ts=4
|
||||||
from __future__ import division
|
from __future__ import division
|
||||||
|
|
||||||
from django.conf import settings
|
|
||||||
|
|
||||||
import ox
|
import ox
|
||||||
from ox.utils import json
|
from ox.utils import json
|
||||||
from ox.django.decorators import login_required_json
|
from ox.django.decorators import login_required_json
|
||||||
from ox.django.shortcuts import render_to_json_response, get_object_or_404_json, json_response
|
from ox.django.shortcuts import render_to_json_response, get_object_or_404_json, json_response
|
||||||
|
|
||||||
|
|
||||||
from item.models import Item
|
|
||||||
from ox.django.api import actions
|
from ox.django.api import actions
|
||||||
|
|
||||||
from item import utils
|
|
||||||
from item.models import Item
|
|
||||||
|
|
||||||
import models
|
import models
|
||||||
|
|
||||||
def getNews(request):
|
def getNews(request):
|
||||||
|
|
|
@ -2,12 +2,10 @@
|
||||||
# vi:si:et:sw=4:sts=4:ts=4
|
# vi:si:et:sw=4:sts=4:ts=4
|
||||||
from __future__ import division
|
from __future__ import division
|
||||||
|
|
||||||
from django.db.models import Max, Min
|
|
||||||
|
|
||||||
import ox
|
import ox
|
||||||
from ox.utils import json
|
from ox.utils import json
|
||||||
|
|
||||||
from ox.django.decorators import login_required_json, admin_required_json
|
from ox.django.decorators import admin_required_json
|
||||||
from ox.django.shortcuts import render_to_json_response, get_object_or_404_json, json_response
|
from ox.django.shortcuts import render_to_json_response, get_object_or_404_json, json_response
|
||||||
|
|
||||||
from ox.django.api import actions
|
from ox.django.api import actions
|
||||||
|
|
|
@ -2,12 +2,8 @@
|
||||||
# vi:si:et:sw=4:sts=4:ts=4
|
# vi:si:et:sw=4:sts=4:ts=4
|
||||||
from __future__ import division, with_statement
|
from __future__ import division, with_statement
|
||||||
|
|
||||||
import re
|
|
||||||
|
|
||||||
from django.db import models, transaction
|
from django.db import models, transaction
|
||||||
from django.contrib.auth.models import User, Group
|
from django.contrib.auth.models import User
|
||||||
from django.db.models import Q
|
|
||||||
from django.conf import settings
|
|
||||||
import ox
|
import ox
|
||||||
from ox.django import fields
|
from ox.django import fields
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,7 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# vi:si:et:sw=4:sts=4:ts=4
|
# vi:si:et:sw=4:sts=4:ts=4
|
||||||
from datetime import timedelta
|
|
||||||
|
|
||||||
from celery.task import task, periodic_task
|
from celery.task import task
|
||||||
from celery.schedules import crontab
|
|
||||||
|
|
||||||
import models
|
import models
|
||||||
|
|
||||||
|
|
|
@ -2,20 +2,11 @@
|
||||||
# vi:si:et:sw=4:sts=4:ts=4
|
# vi:si:et:sw=4:sts=4:ts=4
|
||||||
from __future__ import division, with_statement
|
from __future__ import division, with_statement
|
||||||
|
|
||||||
import re
|
from django.db import models
|
||||||
|
|
||||||
from django.db import models, transaction
|
|
||||||
from django.contrib.auth.models import User, Group
|
|
||||||
from django.db.models import Q
|
|
||||||
from django.conf import settings
|
|
||||||
import ox
|
|
||||||
|
|
||||||
import managers
|
import managers
|
||||||
from annotation.models import Annotation, get_matches, get_super_matches
|
|
||||||
from item.models import Item, ItemSort
|
from item.models import Item, ItemSort
|
||||||
from changelog.models import Changelog
|
|
||||||
|
|
||||||
from django.db import models
|
|
||||||
|
|
||||||
class Sequence(models.Model):
|
class Sequence(models.Model):
|
||||||
class Meta:
|
class Meta:
|
||||||
|
|
|
@ -1,15 +1,7 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# vi:si:et:sw=4:sts=4:ts=4
|
# vi:si:et:sw=4:sts=4:ts=4
|
||||||
import os
|
|
||||||
from datetime import timedelta, datetime
|
|
||||||
import gzip
|
|
||||||
import random
|
|
||||||
random
|
|
||||||
|
|
||||||
from django.conf import settings
|
|
||||||
from django.db import connection, transaction
|
from django.db import connection, transaction
|
||||||
from ox.utils import ET
|
from celery.task import task
|
||||||
from celery.task import task, periodic_task
|
|
||||||
|
|
||||||
import models
|
import models
|
||||||
import extract
|
import extract
|
||||||
|
|
|
@ -2,18 +2,17 @@
|
||||||
# vi:si:et:sw=4:sts=4:ts=4
|
# vi:si:et:sw=4:sts=4:ts=4
|
||||||
from __future__ import division
|
from __future__ import division
|
||||||
|
|
||||||
from django.conf import settings
|
|
||||||
from ox.utils import json
|
from ox.utils import json
|
||||||
from ox.django.shortcuts import render_to_json_response, json_response
|
from ox.django.shortcuts import render_to_json_response, json_response
|
||||||
|
|
||||||
from ox.django.api import actions
|
from ox.django.api import actions
|
||||||
|
|
||||||
from annotation.models import Annotation
|
|
||||||
from item.models import Item
|
from item.models import Item
|
||||||
from item import utils
|
from item import utils
|
||||||
|
|
||||||
import models
|
import models
|
||||||
|
|
||||||
|
|
||||||
def parse_query(data, user):
|
def parse_query(data, user):
|
||||||
query = {}
|
query = {}
|
||||||
query['range'] = [0, 100]
|
query['range'] = [0, 100]
|
||||||
|
|
|
@ -1,11 +1,7 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# vi:si:et:sw=4:sts=4:ts=4
|
# vi:si:et:sw=4:sts=4:ts=4
|
||||||
from datetime import datetime
|
|
||||||
|
|
||||||
from django.db.models import Q, Manager
|
from django.db.models import Q, Manager
|
||||||
|
|
||||||
import models
|
|
||||||
|
|
||||||
|
|
||||||
def parseCondition(condition, user):
|
def parseCondition(condition, user):
|
||||||
'''
|
'''
|
||||||
|
|
|
@ -4,7 +4,6 @@ from __future__ import division, with_statement
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
import subprocess
|
import subprocess
|
||||||
from datetime import datetime
|
|
||||||
from glob import glob
|
from glob import glob
|
||||||
|
|
||||||
from django.db import models
|
from django.db import models
|
||||||
|
|
|
@ -1,23 +0,0 @@
|
||||||
"""
|
|
||||||
This file demonstrates two different styles of tests (one doctest and one
|
|
||||||
unittest). These will both pass when you run "manage.py test".
|
|
||||||
|
|
||||||
Replace these with more appropriate tests for your application.
|
|
||||||
"""
|
|
||||||
|
|
||||||
from django.test import TestCase
|
|
||||||
|
|
||||||
class SimpleTest(TestCase):
|
|
||||||
def test_basic_addition(self):
|
|
||||||
"""
|
|
||||||
Tests that 1 + 1 always equals 2.
|
|
||||||
"""
|
|
||||||
self.failUnlessEqual(1 + 1, 2)
|
|
||||||
|
|
||||||
__test__ = {"doctest": """
|
|
||||||
Another way to test that 1 + 1 is equal to 2.
|
|
||||||
|
|
||||||
>>> 1 + 1 == 2
|
|
||||||
True
|
|
||||||
"""}
|
|
||||||
|
|
|
@ -4,14 +4,13 @@ from __future__ import division
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
|
|
||||||
import ox
|
|
||||||
from ox.utils import json
|
from ox.utils import json
|
||||||
from ox.django.api import actions
|
from ox.django.api import actions
|
||||||
from ox.django.decorators import login_required_json
|
from ox.django.decorators import login_required_json
|
||||||
from ox.django.http import HttpFileResponse
|
from ox.django.http import HttpFileResponse
|
||||||
from ox.django.shortcuts import render_to_json_response, get_object_or_404_json, json_response
|
from ox.django.shortcuts import render_to_json_response, get_object_or_404_json, json_response
|
||||||
from django import forms
|
from django import forms
|
||||||
from django.db.models import Count, Q, Sum, Max
|
from django.db.models import Sum, Max
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
|
||||||
from item import utils
|
from item import utils
|
||||||
|
@ -397,6 +396,7 @@ def pdf(request, id):
|
||||||
if text.type == 'pdf' and text.file and not text.uploading:
|
if text.type == 'pdf' and text.file and not text.uploading:
|
||||||
return HttpFileResponse(text.file.path, content_type='application/pdf')
|
return HttpFileResponse(text.file.path, content_type='application/pdf')
|
||||||
response = json_response(status=404, text='file not found')
|
response = json_response(status=404, text='file not found')
|
||||||
|
return render_to_json_response(response)
|
||||||
|
|
||||||
@login_required_json
|
@login_required_json
|
||||||
def upload(request):
|
def upload(request):
|
||||||
|
|
|
@ -3,8 +3,6 @@
|
||||||
from __future__ import division
|
from __future__ import division
|
||||||
import unicodedata
|
import unicodedata
|
||||||
|
|
||||||
from django.db.models import Max, Min
|
|
||||||
|
|
||||||
import ox
|
import ox
|
||||||
from ox.utils import json
|
from ox.utils import json
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# vi:si:et:sw=4:sts=4:ts=4
|
# vi:si:et:sw=4:sts=4:ts=4
|
||||||
from datetime import timedelta, datetime
|
from datetime import timedelta
|
||||||
|
|
||||||
from celery.task import task, periodic_task
|
from celery.task import periodic_task
|
||||||
from django.contrib.auth.models import User
|
|
||||||
|
|
||||||
import models
|
import models
|
||||||
|
|
||||||
|
|
||||||
@periodic_task(run_every=timedelta(days=1), queue='encoding')
|
@periodic_task(run_every=timedelta(days=1), queue='encoding')
|
||||||
def update_program(**kwargs):
|
def update_program(**kwargs):
|
||||||
for c in models.Channel.objects.all():
|
for c in models.Channel.objects.all():
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# vi:si:et:sw=4:sts=4:ts=4
|
# vi:si:et:sw=4:sts=4:ts=4
|
||||||
from optparse import make_option
|
|
||||||
|
|
||||||
from django.core.management.base import BaseCommand
|
from django.core.management.base import BaseCommand
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
import copy
|
import copy
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
|
||||||
from django.contrib.auth.models import User, Group
|
from django.contrib.auth.models import User
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.db.models import Max
|
from django.db.models import Max
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
@ -273,7 +273,7 @@ def get_ui(user_ui, user=None):
|
||||||
pos = P.objects.get(text=t, section=section)
|
pos = P.objects.get(text=t, section=section)
|
||||||
created = False
|
created = False
|
||||||
except P.DoesNotExist:
|
except P.DoesNotExist:
|
||||||
pos = P(text=t, section=section, user=l.user)
|
pos = P(text=t, section=section, user=t.user)
|
||||||
pos.save()
|
pos.save()
|
||||||
created = True
|
created = True
|
||||||
else:
|
else:
|
||||||
|
@ -303,7 +303,7 @@ def get_ui(user_ui, user=None):
|
||||||
|
|
||||||
def init_user(user, request=None):
|
def init_user(user, request=None):
|
||||||
if request:
|
if request:
|
||||||
data = SessionData.get_or_create(request)
|
SessionData.get_or_create(request)
|
||||||
if user.is_anonymous():
|
if user.is_anonymous():
|
||||||
result = settings.CONFIG['user'].copy()
|
result = settings.CONFIG['user'].copy()
|
||||||
result['ui'] = get_ui(json.loads(request.session.get('ui', '{}')))
|
result['ui'] = get_ui(json.loads(request.session.get('ui', '{}')))
|
||||||
|
|
|
@ -1,11 +1,6 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# vi:si:et:sw=4:sts=4:ts=4
|
# vi:si:et:sw=4:sts=4:ts=4
|
||||||
import os
|
|
||||||
from datetime import timedelta, datetime
|
|
||||||
import gzip
|
|
||||||
|
|
||||||
|
|
||||||
from django.conf import settings
|
|
||||||
from celery.task import task
|
from celery.task import task
|
||||||
|
|
||||||
import models
|
import models
|
||||||
|
|
|
@ -2,14 +2,12 @@
|
||||||
# vi:si:et:sw=4:sts=4:ts=4
|
# vi:si:et:sw=4:sts=4:ts=4
|
||||||
import random
|
import random
|
||||||
random.seed()
|
random.seed()
|
||||||
import re
|
|
||||||
|
|
||||||
from django.contrib.auth import authenticate, login, logout
|
from django.contrib.auth import authenticate, login, logout
|
||||||
from django.template import RequestContext, loader
|
from django.template import RequestContext, loader
|
||||||
from django.utils import simplejson as json
|
from django.utils import simplejson as json
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.core.mail import send_mail, BadHeaderError, EmailMessage
|
from django.core.mail import send_mail, BadHeaderError, EmailMessage
|
||||||
from django.db.models import Sum
|
|
||||||
from django.shortcuts import redirect
|
from django.shortcuts import redirect
|
||||||
|
|
||||||
from ox.django.shortcuts import render_to_json_response, json_response, get_object_or_404_json
|
from ox.django.shortcuts import render_to_json_response, json_response, get_object_or_404_json
|
||||||
|
@ -729,7 +727,6 @@ actions.register(editPreferences, cache=False)
|
||||||
|
|
||||||
|
|
||||||
def reset_ui(request):
|
def reset_ui(request):
|
||||||
response = json_response()
|
|
||||||
if request.user.is_authenticated():
|
if request.user.is_authenticated():
|
||||||
profile = request.user.get_profile()
|
profile = request.user.get_profile()
|
||||||
profile.ui = {}
|
profile.ui = {}
|
||||||
|
|
Loading…
Reference in a new issue