--- a/.settings/org.eclipse.core.resources.prefs Fri Mar 01 18:08:11 2013 +0100
+++ b/.settings/org.eclipse.core.resources.prefs Wed May 15 10:05:17 2013 +0200
@@ -41,6 +41,7 @@
encoding//src/ldt/ldt/management/utils.py=utf-8
encoding//src/ldt/ldt/test/test_runner.py=utf-8
encoding//src/ldt/ldt/text/migrations/0001_initial.py=utf-8
+encoding//src/ldt/ldt/text/migrations/0002_auto__chg_field_annotation_external_id.py=utf-8
encoding//src/ldt/ldt/user/migrations/0001_initial.py=utf-8
encoding//src/ldt/ldt/user/migrations/0008_auto__chg_field_groupprofile_image__chg_field_groupprofile_group__chg_.py=utf-8
encoding//virtualenv/web/env/guardianenv/Lib/site-packages/guardian/migrations/0001_initial.py=utf-8
--- a/src/ldt/ldt/api/ldt/authentication.py Fri Mar 01 18:08:11 2013 +0100
+++ b/src/ldt/ldt/api/ldt/authentication.py Wed May 15 10:05:17 2013 +0200
@@ -197,5 +197,5 @@
This implementation returns the user's username.
"""
- username, api_key = self.extract_credentials(request)
+ username, _ = self.extract_credentials(request)
return username or 'nouser'
\ No newline at end of file
--- a/src/ldt/ldt/api/ldt/resources/annotation.py Fri Mar 01 18:08:11 2013 +0100
+++ b/src/ldt/ldt/api/ldt/resources/annotation.py Wed May 15 10:05:17 2013 +0200
@@ -1,17 +1,15 @@
+from ldt.ldt_utils.contentindexer import add_segment
from ldt.ldt_utils.models import Project, Content
-from ldt.ldt_utils.stat import add_annotation_to_stat
from ldt.ldt_utils.utils import LdtAnnotation
from ldt.security import protect_models, unprotect_models
from tastypie import fields
from tastypie.authorization import Authorization
from tastypie.exceptions import NotFound, BadRequest
from tastypie.resources import Resource
-import logging #@UnresolvedImport
-from ldt.ldt_utils.contentindexer import add_segment
class AnnotationObject(object):
- def __init__(self, id="", project = "", type = "", type_title = "", ensemble="", media = "", begin = 0, end = 0, content = {"title":"", "description":""}, tags = [], meta = {"creator":"","created":""}):
+ def __init__(self, id="", project = "", type = "", type_title = "", ensemble="", media = "", begin = 0, end = 0, content = {"title":"", "description":""}, tags = [], meta = {"creator":"","created":""}): # @ReservedAssignment
self.id = id
self.project = project
self.type = type
--- a/src/ldt/ldt/api/ldt/serializers/cinelabserializer.py Fri Mar 01 18:08:11 2013 +0100
+++ b/src/ldt/ldt/api/ldt/serializers/cinelabserializer.py Wed May 15 10:05:17 2013 +0200
@@ -5,12 +5,10 @@
from ldt.ldt_utils.models import Content, Project
from ldt.ldt_utils.projectserializer import ProjectJsonSerializer
from ldt.ldt_utils.utils import generate_uuid
+from tastypie.exceptions import NotFound, BadRequest
from tastypie.serializers import Serializer
-from tastypie.exceptions import NotFound, BadRequest
+import lxml.etree
import math
-import lxml.etree
-import logging
-import tastypie
class CinelabSerializer(Serializer):
--- a/src/ldt/ldt/api/middleware/pistonput.py Fri Mar 01 18:08:11 2013 +0100
+++ b/src/ldt/ldt/api/middleware/pistonput.py Wed May 15 10:05:17 2013 +0200
@@ -3,8 +3,6 @@
piston does not like 'charset=UTF-8" in PUT request
"""
-from django.conf import settings
-
class PistonPutMiddleware(object):
def process_request(self, request):
--- a/src/ldt/ldt/core/handlers/modpython.py Fri Mar 01 18:08:11 2013 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,8 +0,0 @@
-
-def handler(req):
- activate_this = req.get_options().get("virtualenv.activate_path")
- execfile(activate_this, dict(__file__=activate_this))
-
- import django.core.handlers.modpython
-
- return django.core.handlers.modpython.handler(req)
--- a/src/ldt/ldt/forms/fields.py Fri Mar 01 18:08:11 2013 +0100
+++ b/src/ldt/ldt/forms/fields.py Wed May 15 10:05:17 2013 +0200
@@ -3,11 +3,9 @@
"""
from django import forms
+from django.core.exceptions import ValidationError
from django.utils.translation import ugettext_lazy as _
-from django.core.exceptions import ValidationError
-import logging
import time
-import math
__all__ = (
'LdtDurationField'
@@ -29,9 +27,9 @@
def to_python(self, value):
dur = value
- for format in self.formats:
+ for f in self.formats:
try:
- dur = time.strptime(dur, format)
+ dur = time.strptime(dur, f)
dur = dur.tm_hour*3600 + dur.tm_min*60 + dur.tm_sec
dur = dur*1000
break
--- a/src/ldt/ldt/forms/widgets.py Fri Mar 01 18:08:11 2013 +0100
+++ b/src/ldt/ldt/forms/widgets.py Wed May 15 10:05:17 2013 +0200
@@ -3,12 +3,8 @@
"""
from django.contrib.admin.widgets import AdminSplitDateTime
-from django.forms.widgets import TimeInput
from django.utils.safestring import mark_safe
from django.utils.translation import ugettext as _
-import time
-import math
-import logging
class LdtSplitDateTime(AdminSplitDateTime):
--- a/src/ldt/ldt/indexation/backends/elasticsearch_backend.py Fri Mar 01 18:08:11 2013 +0100
+++ b/src/ldt/ldt/indexation/backends/elasticsearch_backend.py Wed May 15 10:05:17 2013 +0200
@@ -4,14 +4,11 @@
@author: ymh
'''
-from django.db.models.loading import get_model
-from haystack.backends import BaseEngine, SearchResult, elasticsearch_backend
-from haystack.constants import DJANGO_CT, DJANGO_ID
+from haystack.backends import BaseEngine, elasticsearch_backend
from haystack.exceptions import MissingDependency
from haystack.utils import get_identifier
from ldt.ldt_utils.models import Segment
import collections
-import datetime
try:
import requests
except ImportError:
--- a/src/ldt/ldt/ldt_utils/admin.py Fri Mar 01 18:08:11 2013 +0100
+++ b/src/ldt/ldt/ldt_utils/admin.py Wed May 15 10:05:17 2013 +0200
@@ -1,17 +1,16 @@
+from StringIO import StringIO
from django.conf.urls.defaults import patterns, url
from django.contrib import admin
+from django.core.management import call_command
+from django.http import HttpResponse
from django.shortcuts import render_to_response
from django.template import RequestContext
+from guardian.admin import GuardedModelAdmin
from ldt.ldt_utils.contentindexer import ContentIndexer, ProjectIndexer
from ldt.ldt_utils.fileimport import FileImport, FileImportError
from ldt.ldt_utils.forms import LdtImportForm, ReindexForm, StatAnnotationForm
from ldt.ldt_utils.models import Content, Project, Media, Author
from ldt.ldt_utils.stat import update_stat_content
-from guardian.admin import GuardedModelAdmin
-from django.http import HttpResponse
-from StringIO import StringIO
-from django.core.management import call_command
-import logging
class ProjectAdmin(GuardedModelAdmin):
--- a/src/ldt/ldt/ldt_utils/migrations/0006_auto__add_field_media_image.py Fri Mar 01 18:08:11 2013 +0100
+++ b/src/ldt/ldt/ldt_utils/migrations/0006_auto__add_field_media_image.py Wed May 15 10:05:17 2013 +0200
@@ -1,21 +1,19 @@
# encoding: utf-8
-import datetime
from south.db import db
from south.v2 import SchemaMigration
-from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'Media.image'
- db.add_column('ldt_utils_media', 'image', self.gf('sorl.thumbnail.fields.ImageField')(default='thumbnails/contents/drive.jpg', max_length=100), keep_default=False)
+ db.add_column('ldt_utils_media', 'image', self.gf('sorl.thumbnail.fields.ImageField')(default='thumbnails/contents/drive.jpg', max_length=100), keep_default=False) # @UndefinedVariable
def backwards(self, orm):
# Deleting field 'Media.image'
- db.delete_column('ldt_utils_media', 'image')
+ db.delete_column('ldt_utils_media', 'image') # @UndefinedVariable
models = {
--- a/src/ldt/ldt/ldt_utils/migrations/0007_auto__add_field_content_image__del_field_media_image.py Fri Mar 01 18:08:11 2013 +0100
+++ b/src/ldt/ldt/ldt_utils/migrations/0007_auto__add_field_content_image__del_field_media_image.py Wed May 15 10:05:17 2013 +0200
@@ -1,28 +1,26 @@
# encoding: utf-8
-import datetime
from django.conf import settings
from south.db import db
from south.v2 import SchemaMigration
-from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'Content.image'
- db.add_column('ldt_utils_content', 'image', self.gf('sorl.thumbnail.fields.ImageField')(default=settings.DEFAULT_CONTENT_ICON, max_length=100), keep_default=False)
+ db.add_column('ldt_utils_content', 'image', self.gf('sorl.thumbnail.fields.ImageField')(default=settings.DEFAULT_CONTENT_ICON, max_length=100), keep_default=False) # @UndefinedVariable
# Deleting field 'Media.image'
- db.delete_column('ldt_utils_media', 'image')
+ db.delete_column('ldt_utils_media', 'image') # @UndefinedVariable
def backwards(self, orm):
# Deleting field 'Content.image'
- db.delete_column('ldt_utils_content', 'image')
+ db.delete_column('ldt_utils_content', 'image') # @UndefinedVariable
# Adding field 'Media.image'
- db.add_column('ldt_utils_media', 'image', self.gf('sorl.thumbnail.fields.ImageField')(default='thumbnails/media/drive.jpg', max_length=100), keep_default=False)
+ db.add_column('ldt_utils_media', 'image', self.gf('sorl.thumbnail.fields.ImageField')(default='thumbnails/media/drive.jpg', max_length=100), keep_default=False) # @UndefinedVariable
models = {
--- a/src/ldt/ldt/ldt_utils/migrations/0008_auto__add_field_project_image.py Fri Mar 01 18:08:11 2013 +0100
+++ b/src/ldt/ldt/ldt_utils/migrations/0008_auto__add_field_project_image.py Wed May 15 10:05:17 2013 +0200
@@ -1,21 +1,19 @@
# encoding: utf-8
-import datetime
from south.db import db
from south.v2 import SchemaMigration
-from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'Project.image'
- db.add_column('ldt_utils_project', 'image', self.gf('sorl.thumbnail.fields.ImageField')(default='thumbnails/projects/project_default_icon.png', max_length=100), keep_default=False)
+ db.add_column('ldt_utils_project', 'image', self.gf('sorl.thumbnail.fields.ImageField')(default='thumbnails/projects/project_default_icon.png', max_length=100), keep_default=False) # @UndefinedVariable
def backwards(self, orm):
# Deleting field 'Project.image'
- db.delete_column('ldt_utils_project', 'image')
+ db.delete_column('ldt_utils_project', 'image') # @UndefinedVariable
models = {
--- a/src/ldt/ldt/ldt_utils/migrations/0009_auto__chg_field_content_image__chg_field_project_image.py Fri Mar 01 18:08:11 2013 +0100
+++ b/src/ldt/ldt/ldt_utils/migrations/0009_auto__chg_field_content_image__chg_field_project_image.py Wed May 15 10:05:17 2013 +0200
@@ -1,27 +1,25 @@
# encoding: utf-8
-import datetime
from south.db import db
from south.v2 import SchemaMigration
-from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Changing field 'Content.image'
- db.alter_column('ldt_utils_content', 'image', self.gf('sorl.thumbnail.fields.ImageField')(max_length=200))
+ db.alter_column('ldt_utils_content', 'image', self.gf('sorl.thumbnail.fields.ImageField')(max_length=200)) # @UndefinedVariable
# Changing field 'Project.image'
- db.alter_column('ldt_utils_project', 'image', self.gf('sorl.thumbnail.fields.ImageField')(max_length=200))
+ db.alter_column('ldt_utils_project', 'image', self.gf('sorl.thumbnail.fields.ImageField')(max_length=200)) # @UndefinedVariable
def backwards(self, orm):
# Changing field 'Content.image'
- db.alter_column('ldt_utils_content', 'image', self.gf('sorl.thumbnail.fields.ImageField')(max_length=100))
+ db.alter_column('ldt_utils_content', 'image', self.gf('sorl.thumbnail.fields.ImageField')(max_length=100)) # @UndefinedVariable
# Changing field 'Project.image'
- db.alter_column('ldt_utils_project', 'image', self.gf('sorl.thumbnail.fields.ImageField')(max_length=100))
+ db.alter_column('ldt_utils_project', 'image', self.gf('sorl.thumbnail.fields.ImageField')(max_length=100)) # @UndefinedVariable
models = {
--- a/src/ldt/ldt/ldt_utils/migrations/0015_auto__add_contentstat__del_field_content_last_annotated__del_field_con.py Fri Mar 01 18:08:11 2013 +0100
+++ b/src/ldt/ldt/ldt_utils/migrations/0015_auto__add_contentstat__del_field_content_last_annotated__del_field_con.py Wed May 15 10:05:17 2013 +0200
@@ -1,15 +1,14 @@
# encoding: utf-8
-import datetime
from south.db import db
from south.v2 import SchemaMigration
-from django.db import models
+import datetime
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'ContentStat'
- db.create_table('ldt_utils_contentstat', (
+ db.create_table('ldt_utils_contentstat', ( # @UndefinedVariable
('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
('content', self.gf('django.db.models.fields.related.ForeignKey')(related_name='stat_annotation', unique=True, to=orm['ldt_utils.Content'])),
('annotation_volume_str', self.gf('django.db.models.fields.CommaSeparatedIntegerField')(max_length=1024, null=True, blank=True)),
@@ -17,31 +16,31 @@
('nb_annotations', self.gf('django.db.models.fields.IntegerField')(default=0, db_index=True)),
('last_annotated', self.gf('django.db.models.fields.DateTimeField')(default=datetime.datetime.now, null=True, blank=True)),
))
- db.send_create_signal('ldt_utils', ['ContentStat'])
+ db.send_create_signal('ldt_utils', ['ContentStat']) # @UndefinedVariable
# Deleting field 'Content.last_annotated'
- db.delete_column('ldt_utils_content', 'last_annotated')
+ db.delete_column('ldt_utils_content', 'last_annotated') # @UndefinedVariable
# Deleting field 'Content.nb_annotation'
- db.delete_column('ldt_utils_content', 'nb_annotation')
+ db.delete_column('ldt_utils_content', 'nb_annotation') # @UndefinedVariable
# Deleting field 'Content.stat_annotation'
- db.delete_column('ldt_utils_content', 'stat_annotation')
+ db.delete_column('ldt_utils_content', 'stat_annotation') # @UndefinedVariable
def backwards(self, orm):
# Deleting model 'ContentStat'
- db.delete_table('ldt_utils_contentstat')
+ db.delete_table('ldt_utils_contentstat') # @UndefinedVariable
# Adding field 'Content.last_annotated'
- db.add_column('ldt_utils_content', 'last_annotated', self.gf('django.db.models.fields.DateTimeField')(default=datetime.datetime.now, null=True, blank=True), keep_default=False)
+ db.add_column('ldt_utils_content', 'last_annotated', self.gf('django.db.models.fields.DateTimeField')(default=datetime.datetime.now, null=True, blank=True), keep_default=False) # @UndefinedVariable
# Adding field 'Content.nb_annotation'
- db.add_column('ldt_utils_content', 'nb_annotation', self.gf('django.db.models.fields.IntegerField')(null=True, blank=True), keep_default=False)
+ db.add_column('ldt_utils_content', 'nb_annotation', self.gf('django.db.models.fields.IntegerField')(null=True, blank=True), keep_default=False) # @UndefinedVariable
# Adding field 'Content.stat_annotation'
- db.add_column('ldt_utils_content', 'stat_annotation', self.gf('django.db.models.fields.CommaSeparatedIntegerField')(max_length=1024, null=True, blank=True), keep_default=False)
+ db.add_column('ldt_utils_content', 'stat_annotation', self.gf('django.db.models.fields.CommaSeparatedIntegerField')(max_length=1024, null=True, blank=True), keep_default=False) # @UndefinedVariable
models = {
--- a/src/ldt/ldt/ldt_utils/migrations/0016_one_to_one_stat_annotation.py Fri Mar 01 18:08:11 2013 +0100
+++ b/src/ldt/ldt/ldt_utils/migrations/0016_one_to_one_stat_annotation.py Wed May 15 10:05:17 2013 +0200
@@ -1,19 +1,19 @@
# encoding: utf-8
-from south.db import db #@UnresolvedImport
-from south.v2 import SchemaMigration #@UnresolvedImport
+from south.db import db
+from south.v2 import SchemaMigration
class Migration(SchemaMigration):
def forwards(self, orm):
# Changing field 'ContentStat.content'
- db.alter_column('ldt_utils_contentstat', 'content_id', self.gf('django.db.models.fields.related.OneToOneField')(unique=True, to=orm['ldt_utils.Content']))
+ db.alter_column('ldt_utils_contentstat', 'content_id', self.gf('django.db.models.fields.related.OneToOneField')(unique=True, to=orm['ldt_utils.Content'])) # @UndefinedVariable
def backwards(self, orm):
# Changing field 'ContentStat.content'
- db.alter_column('ldt_utils_contentstat', 'content_id', self.gf('django.db.models.fields.related.ForeignKey')(unique=True, to=orm['ldt_utils.Content']))
+ db.alter_column('ldt_utils_contentstat', 'content_id', self.gf('django.db.models.fields.related.ForeignKey')(unique=True, to=orm['ldt_utils.Content'])) # @UndefinedVariable
models = {
--- a/src/ldt/ldt/ldt_utils/migrations/0018_auto__chg_field_content_iri_id__chg_field_project_ldt_id__chg_field_au.py Fri Mar 01 18:08:11 2013 +0100
+++ b/src/ldt/ldt/ldt_utils/migrations/0018_auto__chg_field_content_iri_id__chg_field_project_ldt_id__chg_field_au.py Wed May 15 10:05:17 2013 +0200
@@ -1,8 +1,6 @@
# -*- coding: utf-8 -*-
-import datetime
from south.db import db
from south.v2 import SchemaMigration
-from django.db import models
import hashlib
import uuid
@@ -15,15 +13,15 @@
# Changing field 'Content.iri_id'
- db.alter_column('ldt_utils_content', 'iri_id', self.gf('django.db.models.fields.CharField')(unique=True, max_length=255))
+ db.alter_column('ldt_utils_content', 'iri_id', self.gf('django.db.models.fields.CharField')(unique=True, max_length=255)) # @UndefinedVariable
# Changing field 'Project.ldt_id'
- db.alter_column('ldt_utils_project', 'ldt_id', self.gf('django.db.models.fields.CharField')(unique=True, max_length=255))
+ db.alter_column('ldt_utils_project', 'ldt_id', self.gf('django.db.models.fields.CharField')(unique=True, max_length=255)) # @UndefinedVariable
# Changing field 'Author.handle'
- db.alter_column('ldt_utils_author', 'handle', self.gf('django.db.models.fields.CharField')(max_length=255, unique=True, null=True))
+ db.alter_column('ldt_utils_author', 'handle', self.gf('django.db.models.fields.CharField')(max_length=255, unique=True, null=True)) # @UndefinedVariable
# Adding field 'Media.src_hash'
- db.add_column('ldt_utils_media', 'src_hash',
+ db.add_column('ldt_utils_media', 'src_hash', # @UndefinedVariable
self.gf('django.db.models.fields.CharField')(default=lambda : hashlib.sha512(str(uuid.uuid1())).hexdigest(), unique=False, max_length=128),
keep_default=False)
@@ -31,15 +29,15 @@
def backwards(self, orm):
# Changing field 'Content.iri_id'
- db.alter_column('ldt_utils_content', 'iri_id', self.gf('django.db.models.fields.CharField')(max_length=255, unique=True))
+ db.alter_column('ldt_utils_content', 'iri_id', self.gf('django.db.models.fields.CharField')(max_length=255, unique=True)) # @UndefinedVariable
# Changing field 'Project.ldt_id'
- db.alter_column('ldt_utils_project', 'ldt_id', self.gf('django.db.models.fields.CharField')(max_length=255, unique=True))
+ db.alter_column('ldt_utils_project', 'ldt_id', self.gf('django.db.models.fields.CharField')(max_length=255, unique=True)) # @UndefinedVariable
# Changing field 'Author.handle'
- db.alter_column('ldt_utils_author', 'handle', self.gf('django.db.models.fields.CharField')(unique=True, max_length=255, null=True))
+ db.alter_column('ldt_utils_author', 'handle', self.gf('django.db.models.fields.CharField')(unique=True, max_length=255, null=True)) # @UndefinedVariable
# Deleting field 'Media.src_hash'
- db.delete_column('ldt_utils_media', 'src_hash')
+ db.delete_column('ldt_utils_media', 'src_hash') # @UndefinedVariable
# Adding unique constraint on 'Media', fields ['src']
#db.create_unique('ldt_utils_media', ['src'])
--- a/src/ldt/ldt/ldt_utils/migrations/0020_auto__add_field_segment_id_hash__chg_field_segment_iri_id__chg_field_s.py Fri Mar 01 18:08:11 2013 +0100
+++ b/src/ldt/ldt/ldt_utils/migrations/0020_auto__add_field_segment_id_hash__chg_field_segment_iri_id__chg_field_s.py Wed May 15 10:05:17 2013 +0200
@@ -1,8 +1,6 @@
# -*- coding: utf-8 -*-
-import datetime
from south.db import db
from south.v2 import SchemaMigration
-from django.db import models
import hashlib
import uuid
@@ -14,73 +12,73 @@
#db.delete_unique('ldt_utils_segment', ['ensemble_id', 'element_id', 'project_id', 'iri_id', 'cutting_id'])
# Changing field 'Segment.iri_id'
- db.alter_column('ldt_utils_segment', 'iri_id', self.gf('django.db.models.fields.CharField')(max_length=255))
+ db.alter_column('ldt_utils_segment', 'iri_id', self.gf('django.db.models.fields.CharField')(max_length=255)) # @UndefinedVariable
# Changing field 'Segment.project_id'
- db.alter_column('ldt_utils_segment', 'project_id', self.gf('django.db.models.fields.CharField')(max_length=255, null=True))
+ db.alter_column('ldt_utils_segment', 'project_id', self.gf('django.db.models.fields.CharField')(max_length=255, null=True)) # @UndefinedVariable
# Adding field 'Segment.id_hash'
- db.add_column('ldt_utils_segment', 'id_hash',
+ db.add_column('ldt_utils_segment', 'id_hash', # @UndefinedVariable
self.gf('django.db.models.fields.CharField')(default=lambda : hashlib.sha512(str(uuid.uuid1())).hexdigest(), max_length=128),
keep_default=False)
# Changing field 'Segment.iri_id'
- db.alter_column('ldt_utils_segment', 'iri_id', self.gf('django.db.models.fields.CharField')(max_length=255))
+ db.alter_column('ldt_utils_segment', 'iri_id', self.gf('django.db.models.fields.CharField')(max_length=255)) # @UndefinedVariable
# Adding index on 'Segment', fields ['iri_id']
- db.create_index('ldt_utils_segment', ['iri_id'])
+ db.create_index('ldt_utils_segment', ['iri_id']) # @UndefinedVariable
# Changing field 'Segment.project_id'
- db.alter_column('ldt_utils_segment', 'project_id', self.gf('django.db.models.fields.CharField')(max_length=255, null=True))
+ db.alter_column('ldt_utils_segment', 'project_id', self.gf('django.db.models.fields.CharField')(max_length=255, null=True)) # @UndefinedVariable
# Adding index on 'Segment', fields ['project_id']
- db.create_index('ldt_utils_segment', ['project_id'])
+ db.create_index('ldt_utils_segment', ['project_id']) # @UndefinedVariable
# Changing field 'Segment.cutting_id'
- db.alter_column('ldt_utils_segment', 'cutting_id', self.gf('django.db.models.fields.CharField')(max_length=512))
+ db.alter_column('ldt_utils_segment', 'cutting_id', self.gf('django.db.models.fields.CharField')(max_length=512)) # @UndefinedVariable
# Changing field 'Segment.ensemble_id'
- db.alter_column('ldt_utils_segment', 'ensemble_id', self.gf('django.db.models.fields.CharField')(max_length=512))
+ db.alter_column('ldt_utils_segment', 'ensemble_id', self.gf('django.db.models.fields.CharField')(max_length=512)) # @UndefinedVariable
# Changing field 'Segment.element_id'
- db.alter_column('ldt_utils_segment', 'element_id', self.gf('django.db.models.fields.CharField')(max_length=512))
+ db.alter_column('ldt_utils_segment', 'element_id', self.gf('django.db.models.fields.CharField')(max_length=512)) # @UndefinedVariable
def backwards(self, orm):
# Removing index on 'Segment', fields ['project_id']
- db.delete_index('ldt_utils_segment', ['project_id'])
+ db.delete_index('ldt_utils_segment', ['project_id']) # @UndefinedVariable
# Removing index on 'Segment', fields ['iri_id']
- db.delete_index('ldt_utils_segment', ['iri_id'])
+ db.delete_index('ldt_utils_segment', ['iri_id']) # @UndefinedVariable
# Deleting field 'Segment.id_hash'
- db.delete_column('ldt_utils_segment', 'id_hash')
+ db.delete_column('ldt_utils_segment', 'id_hash') # @UndefinedVariable
# Changing field 'Segment.iri_id'
- db.alter_column('ldt_utils_segment', 'iri_id', self.gf('django.db.models.fields.CharField')(max_length=1024))
+ db.alter_column('ldt_utils_segment', 'iri_id', self.gf('django.db.models.fields.CharField')(max_length=1024)) # @UndefinedVariable
# Changing field 'Segment.project_id'
- db.alter_column('ldt_utils_segment', 'project_id', self.gf('django.db.models.fields.CharField')(max_length=1024, null=True))
+ db.alter_column('ldt_utils_segment', 'project_id', self.gf('django.db.models.fields.CharField')(max_length=1024, null=True)) # @UndefinedVariable
# Adding unique constraint on 'Segment', fields ['ensemble_id', 'element_id', 'project_id', 'iri_id', 'cutting_id']
#db.create_unique('ldt_utils_segment', ['ensemble_id', 'element_id', 'project_id', 'iri_id', 'cutting_id'])
# Changing field 'Segment.iri_id'
- db.alter_column('ldt_utils_segment', 'iri_id', self.gf('django.db.models.fields.CharField')(max_length=1024))
+ db.alter_column('ldt_utils_segment', 'iri_id', self.gf('django.db.models.fields.CharField')(max_length=1024)) # @UndefinedVariable
# Changing field 'Segment.project_id'
- db.alter_column('ldt_utils_segment', 'project_id', self.gf('django.db.models.fields.CharField')(max_length=1024, null=True))
+ db.alter_column('ldt_utils_segment', 'project_id', self.gf('django.db.models.fields.CharField')(max_length=1024, null=True)) # @UndefinedVariable
# Changing field 'Segment.cutting_id'
- db.alter_column('ldt_utils_segment', 'cutting_id', self.gf('django.db.models.fields.CharField')(max_length=1024))
+ db.alter_column('ldt_utils_segment', 'cutting_id', self.gf('django.db.models.fields.CharField')(max_length=1024)) # @UndefinedVariable
# Changing field 'Segment.ensemble_id'
- db.alter_column('ldt_utils_segment', 'ensemble_id', self.gf('django.db.models.fields.CharField')(max_length=1024))
+ db.alter_column('ldt_utils_segment', 'ensemble_id', self.gf('django.db.models.fields.CharField')(max_length=1024)) # @UndefinedVariable
# Changing field 'Segment.element_id'
- db.alter_column('ldt_utils_segment', 'element_id', self.gf('django.db.models.fields.CharField')(max_length=1024))
+ db.alter_column('ldt_utils_segment', 'element_id', self.gf('django.db.models.fields.CharField')(max_length=1024)) # @UndefinedVariable
--- a/src/ldt/ldt/ldt_utils/migrations/0022_auto__add_unique_media_src_hash__chg_field_segment_cutting_id__chg_fie.py Fri Mar 01 18:08:11 2013 +0100
+++ b/src/ldt/ldt/ldt_utils/migrations/0022_auto__add_unique_media_src_hash__chg_field_segment_cutting_id__chg_fie.py Wed May 15 10:05:17 2013 +0200
@@ -1,45 +1,43 @@
# -*- coding: utf-8 -*-
-import datetime
from south.db import db
from south.v2 import SchemaMigration
-from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding unique constraint on 'Media', fields ['src_hash']
- db.create_unique('ldt_utils_media', ['src_hash'])
+ db.create_unique('ldt_utils_media', ['src_hash']) # @UndefinedVariable
# Changing field 'Segment.cutting_id'
- db.alter_column('ldt_utils_segment', 'cutting_id', self.gf('django.db.models.fields.CharField')(max_length=512))
+ db.alter_column('ldt_utils_segment', 'cutting_id', self.gf('django.db.models.fields.CharField')(max_length=512)) # @UndefinedVariable
# Changing field 'Segment.ensemble_id'
- db.alter_column('ldt_utils_segment', 'ensemble_id', self.gf('django.db.models.fields.CharField')(max_length=512))
+ db.alter_column('ldt_utils_segment', 'ensemble_id', self.gf('django.db.models.fields.CharField')(max_length=512)) # @UndefinedVariable
# Adding unique constraint on 'Segment', fields ['id_hash']
- db.create_unique('ldt_utils_segment', ['id_hash'])
+ db.create_unique('ldt_utils_segment', ['id_hash']) # @UndefinedVariable
# Changing field 'Segment.element_id'
- db.alter_column('ldt_utils_segment', 'element_id', self.gf('django.db.models.fields.CharField')(max_length=512))
+ db.alter_column('ldt_utils_segment', 'element_id', self.gf('django.db.models.fields.CharField')(max_length=512)) # @UndefinedVariable
def backwards(self, orm):
# Removing unique constraint on 'Segment', fields ['id_hash']
- db.delete_unique('ldt_utils_segment', ['id_hash'])
+ db.delete_unique('ldt_utils_segment', ['id_hash']) # @UndefinedVariable
# Removing unique constraint on 'Media', fields ['src_hash']
- db.delete_unique('ldt_utils_media', ['src_hash'])
+ db.delete_unique('ldt_utils_media', ['src_hash']) # @UndefinedVariable
# Changing field 'Segment.cutting_id'
- db.alter_column('ldt_utils_segment', 'cutting_id', self.gf('django.db.models.fields.CharField')(max_length=1024))
+ db.alter_column('ldt_utils_segment', 'cutting_id', self.gf('django.db.models.fields.CharField')(max_length=1024)) # @UndefinedVariable
# Changing field 'Segment.ensemble_id'
- db.alter_column('ldt_utils_segment', 'ensemble_id', self.gf('django.db.models.fields.CharField')(max_length=1024))
+ db.alter_column('ldt_utils_segment', 'ensemble_id', self.gf('django.db.models.fields.CharField')(max_length=1024)) # @UndefinedVariable
# Changing field 'Segment.element_id'
- db.alter_column('ldt_utils_segment', 'element_id', self.gf('django.db.models.fields.CharField')(max_length=1024))
+ db.alter_column('ldt_utils_segment', 'element_id', self.gf('django.db.models.fields.CharField')(max_length=1024)) # @UndefinedVariable
models = {
'auth.group': {
--- a/src/ldt/ldt/ldt_utils/migrations/0023_auto__add_field_segment_audio_src__add_field_segment_audio_href.py Fri Mar 01 18:08:11 2013 +0100
+++ b/src/ldt/ldt/ldt_utils/migrations/0023_auto__add_field_segment_audio_src__add_field_segment_audio_href.py Wed May 15 10:05:17 2013 +0200
@@ -1,21 +1,19 @@
# -*- coding: utf-8 -*-
-import datetime
+from django.core.management import call_command
from south.db import db
from south.v2 import SchemaMigration
-from django.core.management import call_command
-from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'Segment.audio_src'
- db.add_column('ldt_utils_segment', 'audio_src',
+ db.add_column('ldt_utils_segment', 'audio_src', # @UndefinedVariable
self.gf('django.db.models.fields.CharField')(max_length=255, null=True, blank=True),
keep_default=False)
# Adding field 'Segment.audio_href'
- db.add_column('ldt_utils_segment', 'audio_href',
+ db.add_column('ldt_utils_segment', 'audio_href', # @UndefinedVariable
self.gf('django.db.models.fields.CharField')(max_length=512, null=True, blank=True),
keep_default=False)
@@ -25,10 +23,10 @@
def backwards(self, orm):
# Deleting field 'Segment.audio_src'
- db.delete_column('ldt_utils_segment', 'audio_src')
+ db.delete_column('ldt_utils_segment', 'audio_src') # @UndefinedVariable
# Deleting field 'Segment.audio_href'
- db.delete_column('ldt_utils_segment', 'audio_href')
+ db.delete_column('ldt_utils_segment', 'audio_href') # @UndefinedVariable
--- a/src/ldt/ldt/ldt_utils/migrations/0025_chg_site_domain.py Fri Mar 01 18:08:11 2013 +0100
+++ b/src/ldt/ldt/ldt_utils/migrations/0025_chg_site_domain.py Wed May 15 10:05:17 2013 +0200
@@ -1,9 +1,6 @@
# -*- coding: utf-8 -*-
-import datetime
-from south.db import db
+from django.conf import settings
from south.v2 import DataMigration
-from django.conf import settings
-from django.db import models
class Migration(DataMigration):
--- a/src/ldt/ldt/ldt_utils/segmentserializer.py Fri Mar 01 18:08:11 2013 +0100
+++ b/src/ldt/ldt/ldt_utils/segmentserializer.py Wed May 15 10:05:17 2013 +0200
@@ -1,5 +1,4 @@
from django.conf import settings
-from ldt.ldt_utils.models import Project
from ldt.ldt_utils.stat import get_string_from_buckets
from ldt.security.utils import use_forbidden_url
from tagging.utils import parse_tag_input
--- a/src/ldt/ldt/ldt_utils/views/content.py Fri Mar 01 18:08:11 2013 +0100
+++ b/src/ldt/ldt/ldt_utils/views/content.py Wed May 15 10:05:17 2013 +0200
@@ -230,7 +230,7 @@
img_temp.write(r.content)
img_temp.flush()
picture_form.cleaned_data["image"]=File(img_temp)
- except Exception as inst:
+ except Exception:
logging.debug("couldn't download video thumbnail from image_link : " + str(image_link))
if media_valid and content_valid and picture_valid:
@@ -443,7 +443,6 @@
@transaction.commit_manually
def delete_content(request, iri_id=None):
#Delete the project, the media if exists, and the content
- errors_transaction=[]
if not iri_id:
iri_id = request.REQUEST.get("iri_id", None)
if iri_id:
--- a/src/ldt/ldt/ldt_utils/views/group.py Fri Mar 01 18:08:11 2013 +0100
+++ b/src/ldt/ldt/ldt_utils/views/group.py Wed May 15 10:05:17 2013 +0200
@@ -164,12 +164,12 @@
@login_required
-def groups_filter(request, filter):
- if filter and len(filter) > 0 and filter[0] == '_':
- filter = filter[1:]
+def groups_filter(request, g_filter):
+ if g_filter and len(g_filter) > 0 and g_filter[0] == '_':
+ g_filter = g_filter[1:]
if filter:
- group_list = request.user.groups.filter(name__icontains=filter)
+ group_list = request.user.groups.filter(name__icontains=g_filter)
search_active = True
else:
group_list = request.user.groups.all()
--- a/src/ldt/ldt/ldt_utils/views/json.py Fri Mar 01 18:08:11 2013 +0100
+++ b/src/ldt/ldt/ldt_utils/views/json.py Wed May 15 10:05:17 2013 +0200
@@ -17,21 +17,21 @@
logger = logging.getLogger(__name__)
-def project_json_id(request, id):
+def project_json_id(request, id): # @ReservedAssignment
project = get_object_or_404(Project.safe_objects, ldt_id=id)
return project_json(request, project, False)
-def project_json_cutting_id(request, id, cutting_id):
+def project_json_cutting_id(request, id, cutting_id): # @ReservedAssignment
project = get_object_or_404(Project.safe_objects, ldt_id=id)
return project_json(request, project, first_cutting=cutting_id)
-def project_json_externalid(request, id):
+def project_json_externalid(request, id): # @ReservedAssignment
- res_proj = get_list_or_404(Project.safe_objects.order_by('-modification_date'), contents__external_id=id) #@UndefinedVariable
+ res_proj = get_list_or_404(Project.safe_objects.order_by('-modification_date'), contents__external_id=id)
return project_json(request, res_proj[0], False)
--- a/src/ldt/ldt/ldt_utils/views/lignesdetemps.py Fri Mar 01 18:08:11 2013 +0100
+++ b/src/ldt/ldt/ldt_utils/views/lignesdetemps.py Wed May 15 10:05:17 2013 +0200
@@ -12,7 +12,7 @@
from ldt.security.permissionchecker import check_object_perm_for_user
from ldt.security.utils import set_forbidden_stream
from ldt.utils.projectldt_parser import absolute_src_xml, relative_src_xml
-from ldt.utils.url import static, absurl
+from ldt.utils.url import static, absurl, absstatic
from ldt.utils.web_url_management import get_web_url
import base64
import logging
@@ -186,7 +186,7 @@
@login_required
-def index_project(request, id, full=False):
+def index_project(request, id, full=False): # @ReservedAssignment
urlStr = absurl(request, "ldt.ldt_utils.views.lignesdetemps.init", args=['ldt_project', id])
posturl = absurl(request, "ldt.ldt_utils.views.lignesdetemps.save_ldt_project")
@@ -218,11 +218,11 @@
return render_to_response(template_path,
{'colorurl': colorurl, 'i18nurl': i18nurl, 'language': language_code,
'baseurl': baseurl, 'url': urlStr, 'posturl': posturl,
- 'id': id, 'readonly': readonly},
+ 'id': id, 'readonly': readonly, 'audio_record_url': audio_record_url},
context_instance=RequestContext(request))
-def embed_ldt(request, id):
+def embed_ldt(request, id): # @ReservedAssignment
# Almost identical to index_project but without login_required and less parameters
urlStr = absurl(request, "ldt.ldt_utils.views.lignesdetemps.init", args=['ldt_project', id])
posturl = ""
@@ -235,7 +235,7 @@
template_path = 'ldt/ldt_utils/embed_ldt.html'
try:
- ldt = Project.safe_objects.get(ldt_id=id)
+ _ = Project.safe_objects.get(ldt_id=id)
except Project.DoesNotExist:
return HttpResponseRedirect(reverse("ldt.ldt_utils.views.workspace.home"))
@@ -268,7 +268,7 @@
resp.write(lxml.etree.tostring(doc, pretty_print=True, xml_declaration=True, encoding="utf-8"))
return resp
-def ldt_project(request, id):
+def ldt_project(request, id): # @ReservedAssignment
resp = HttpResponse(mimetype="text/xml")
resp['Cache-Control'] = 'no-cache, must-revalidate'
resp['Pragma'] = 'no-cache'
--- a/src/ldt/ldt/ldt_utils/views/project.py Fri Mar 01 18:08:11 2013 +0100
+++ b/src/ldt/ldt/ldt_utils/views/project.py Wed May 15 10:05:17 2013 +0200
@@ -3,17 +3,18 @@
from django.contrib.auth.models import Group
from django.core.urlresolvers import reverse
from django.db.models import Q
-from django.http import HttpResponse, HttpResponseRedirect, HttpResponseServerError
+from django.http import (HttpResponse, HttpResponseRedirect,
+ HttpResponseServerError)
from django.shortcuts import render_to_response, get_object_or_404
from django.template import RequestContext
from django.utils import simplejson
from django.utils.translation import ugettext as _
+from guardian.shortcuts import get_objects_for_group, get_objects_for_user
from ldt.ldt_utils.forms import LdtAddForm, AddProjectForm, CopyProjectForm
-from guardian.shortcuts import get_objects_for_group, get_objects_for_user
from ldt.ldt_utils.models import Content, Project
from ldt.ldt_utils.utils import boolean_convert
-from ldt.security.utils import (assign_perm_to_obj, add_change_attr, get_userlist,
- get_userlist_model)
+from ldt.security.utils import (assign_perm_to_obj, add_change_attr, get_userlist,
+ get_userlist_model)
from ldt.user.forms import PictureForm
import lxml.etree
import math
@@ -201,7 +202,7 @@
@login_required
-def projects_filter(request, filter, is_owner=False, status=0, id_group=0):
+def projects_filter(request, filter, is_owner=False, status=0, id_group=0): # @ReservedAssignment
is_owner = boolean_convert(is_owner)
status = int(status)
id_group = int(id_group)
@@ -220,7 +221,7 @@
if filter:
if len(filter) > 0 and filter[0] == '_':
- filter = filter[1:]
+ filter = filter[1:] # @ReservedAssignment
query &= Q(title__icontains=filter)
is_gecko = ((request.META['HTTP_USER_AGENT'].lower().find("firefox")) > -1);
@@ -262,13 +263,13 @@
context_instance=RequestContext(request))
@login_required
-def publish(request, id):
+def publish(request, id): # @ReservedAssignment
ldt = get_object_or_404(Project.safe_objects, ldt_id=id)
ldt.publish()
return HttpResponse(simplejson.dumps({'res':True, 'ldt': {'id': ldt.id, 'state':ldt.state, 'ldt_id': ldt.ldt_id}}, ensure_ascii=False), mimetype='application/json')
@login_required
-def unpublish(request, id):
+def unpublish(request, id): # @ReservedAssignment
ldt = get_object_or_404(Project.safe_objects, ldt_id=id)
ldt.unpublish()
return HttpResponse(simplejson.dumps({'res':True, 'ldt': {'id': ldt.id, 'state':ldt.state, 'ldt_id': ldt.ldt_id}}, ensure_ascii=False), mimetype='application/json')
--- a/src/ldt/ldt/ldt_utils/views/workspace.py Fri Mar 01 18:08:11 2013 +0100
+++ b/src/ldt/ldt/ldt_utils/views/workspace.py Wed May 15 10:05:17 2013 +0200
@@ -256,12 +256,12 @@
-def share_filter(request, filter, use_groups=False):
+def share_filter(request, filter, use_groups=False): # @ReservedAssignment
use_groups = boolean_convert(use_groups)
if not filter or len(filter) == 0:
raise AttributeError("filter should be a string")
- filter = filter[1:]
+ filter = filter[1:] # @ReservedAssignment
resp = get_userlist(request.user, filter=filter)
if use_groups:
--- a/src/ldt/ldt/management/commands/testrunserver.py Fri Mar 01 18:08:11 2013 +0100
+++ b/src/ldt/ldt/management/commands/testrunserver.py Wed May 15 10:05:17 2013 +0200
@@ -23,7 +23,8 @@
class Command(RunserverCommand):
def handle(self, addrport='', keep_running=None, ready_event=None, *args, **options):
import django
- from django.core.servers.basehttp import AdminMediaHandler, WSGIServerException
+ from django.core.servers.basehttp import WSGIServerException
+ from django.contrib.staticfiles.handlers import StaticFilesHandler
from django.core.handlers.wsgi import WSGIHandler
if args:
raise CommandError('Usage is testrunserver %s' % self.args)
@@ -56,7 +57,7 @@
translation.activate(settings.LANGUAGE_CODE)
try:
- handler = AdminMediaHandler(WSGIHandler(), admin_media_path)
+ handler = StaticFilesHandler(WSGIHandler(), admin_media_path)
run(addr, int(port), handler, keep_running, ready_event)
except WSGIServerException, e:
# Use helpful error messages instead of ugly tracebacks.
--- a/src/ldt/ldt/management/commands/updateiriurlinprojects.py Fri Mar 01 18:08:11 2013 +0100
+++ b/src/ldt/ldt/management/commands/updateiriurlinprojects.py Wed May 15 10:05:17 2013 +0200
@@ -6,13 +6,12 @@
'''
from ..utils import show_progress
-from django.core.management import call_command
-from django.core.management.base import BaseCommand, CommandError
+from django.core.management.base import BaseCommand
from django.db import transaction
from django.db.models import signals
from ldt.ldt_utils.contentindexer import index_project
-from ldt.ldt_utils.models import Content, Project
-import lxml.etree #@UnresolvedImport
+from ldt.ldt_utils.models import Project
+import lxml.etree
class Command(BaseCommand):
--- a/src/ldt/ldt/security/command.py Fri Mar 01 18:08:11 2013 +0100
+++ b/src/ldt/ldt/security/command.py Wed May 15 10:05:17 2013 +0200
@@ -1,7 +1,7 @@
from django.conf import settings
from django.contrib.auth.models import Group, User
+from guardian.shortcuts import assign, remove_perm
from ldt.ldt_utils.models import Project, Content
-from guardian.shortcuts import assign, remove_perm
from ldt.management.utils import show_progress
def set_default_permissions(verbose=False, is_migration=False, orm=None):
@@ -21,7 +21,7 @@
'Group': Group
}
- everyone, created = Group.objects.get_or_create(name=settings.PUBLIC_GROUP_NAME)
+ everyone, _ = Group.objects.get_or_create(name=settings.PUBLIC_GROUP_NAME)
if verbose:
total = list_model['Project'].objects.count()
--- a/src/ldt/ldt/security/forms.py Fri Mar 01 18:08:11 2013 +0100
+++ b/src/ldt/ldt/security/forms.py Wed May 15 10:05:17 2013 +0200
@@ -31,14 +31,14 @@
users = User.objects.filter(id__in=users)
groups = Group.objects.filter(id__in=groups)
- def create_real_lists(list, users, groups):
+ def create_real_lists(r_list, users, groups):
new_list = []
- for e in list:
- id, cls_name = e.split('-')
+ for e in r_list:
+ obj_id, cls_name = e.split('-')
if cls_name == 'user':
- new_list.append(users.get(id=id))
+ new_list.append(users.get(id=obj_id))
elif cls_name == 'group':
- new_list.append(groups.get(id=id))
+ new_list.append(groups.get(id=obj_id))
return new_list
new_read_list = create_real_lists(read_list, users, groups)
--- a/src/ldt/ldt/security/utils.py Fri Mar 01 18:08:11 2013 +0100
+++ b/src/ldt/ldt/security/utils.py Wed May 15 10:05:17 2013 +0200
@@ -1,8 +1,9 @@
+from cache import get_cached_userlist, cached_assign
from django.conf import settings
from django.contrib.contenttypes.models import ContentType
from django.core.cache import cache
-from guardian.shortcuts import remove_perm, get_users_with_perms, get_groups_with_perms, get_objects_for_user
-from cache import get_cached_userlist, cached_assign
+from guardian.shortcuts import (remove_perm, get_users_with_perms,
+ get_groups_with_perms, get_objects_for_user)
from ldt.security import change_security
import types
@@ -79,38 +80,38 @@
return obj_list
-def assign_perm_to_obj(object, read_list, write_list, owner):
- name = object.__class__.__name__.lower()
+def assign_perm_to_obj(obj, read_list, write_list, owner):
+ name = obj.__class__.__name__.lower()
- old_users = get_users_with_perms(object).exclude(id=owner.id)
- old_groups = get_groups_with_perms(object)
+ old_users = get_users_with_perms(obj).exclude(id=owner.id)
+ old_groups = get_groups_with_perms(obj)
for elem in read_list:
- cached_assign('view_%s' % name, elem, object)
+ cached_assign('view_%s' % name, elem, obj)
if elem in write_list:
- cached_assign('change_%s' % name, elem, object)
+ cached_assign('change_%s' % name, elem, obj)
else:
- remove_perm('change_%s' % name, elem, object)
+ remove_perm('change_%s' % name, elem, obj)
- def remove_perms(new_list, old_list, obj, name):
+ def remove_perms(new_list, old_list, o, name):
for e in old_list:
if e not in new_list:
- remove_perm('view_%s' % name, e, obj)
- remove_perm('change_%s' % name, e, obj)
+ remove_perm('view_%s' % name, e, o)
+ remove_perm('change_%s' % name, e, o)
- remove_perms(read_list, old_users, object, name)
- remove_perms(read_list, old_groups, object, name)
+ remove_perms(read_list, old_users, obj, name)
+ remove_perms(read_list, old_groups, obj, name)
cache.delete('userlist')
-def get_userlist(user, filter=None):
+def get_userlist(user, filter=None): # @ReservedAssignment
user_list = get_cached_userlist().exclude(id=user.id)
if filter:
user_list = user_list.filter(username__icontains=filter)
elem_list = [{'name': u.username, 'id': u.id, 'type': 'user'} for u in user_list[0:settings.MAX_USERS_SEARCH]]
return elem_list
-def get_userlist_model(object, owner):
+def get_userlist_model(object, owner): # @ReservedAssignment
if hasattr(object, 'is_public') and object.is_public:
return [None, None]
--- a/src/ldt/ldt/templatetags/absstatic.py Fri Mar 01 18:08:11 2013 +0100
+++ b/src/ldt/ldt/templatetags/absstatic.py Wed May 15 10:05:17 2013 +0200
@@ -1,8 +1,6 @@
from django import template
-from django.contrib.staticfiles.storage import staticfiles_storage
from django.contrib.sites.models import Site
-from django.template import Library
-import logging
+from django.contrib.staticfiles.storage import staticfiles_storage
import urlparse
register = template.Library()
--- a/src/ldt/ldt/templatetags/absurl.py Fri Mar 01 18:08:11 2013 +0100
+++ b/src/ldt/ldt/templatetags/absurl.py Wed May 15 10:05:17 2013 +0200
@@ -1,8 +1,7 @@
-import urlparse
+from django.contrib.sites.models import Site
from django.template import Library
from django.template.defaulttags import URLNode, url
-from django.contrib.sites.models import Site
-import logging
+import urlparse
register = Library()
--- a/src/ldt/ldt/templatetags/analytics.py Fri Mar 01 18:08:11 2013 +0100
+++ b/src/ldt/ldt/templatetags/analytics.py Wed May 15 10:05:17 2013 +0200
@@ -11,10 +11,10 @@
register = template.Library()
-def __clean_token(str, tag_name):
- if not (str[0] == str[-1] and str[0] in ('"', "'")):
+def __clean_token(str_t, tag_name):
+ if not (str_t[0] == str_t[-1] and str_t[0] in ('"', "'")):
raise template.TemplateSyntaxError, "%r tag's argument should be in quotes" % tag_name
- return str[1:-1]
+ return str_t[1:-1]
def do_get_analytics(parser, token):
code = None
--- a/src/ldt/ldt/templatetags/front_tags.py Fri Mar 01 18:08:11 2013 +0100
+++ b/src/ldt/ldt/templatetags/front_tags.py Wed May 15 10:05:17 2013 +0200
@@ -22,18 +22,18 @@
arg = "::"
if arg=="::" or arg=="h" or arg==":" :
hours = sec//3600
- min = (sec - (hours * 3600))//60
- if min<10:
- min_str = "0" + str(min)
+ minute = (sec - (hours * 3600))//60
+ if minute<10:
+ min_str = "0" + str(minute)
else:
- min_str = str(min)
+ min_str = str(minute)
if (arg=="::" or arg==":") and hours<10 :
hours_str = "0" + str(hours)
else :
hours_str = str(hours)
if arg=="h" or arg==":" :
return hours_str + arg + min_str
- sec = (sec - (hours * 3600) - (min*60))
+ sec = (sec - (hours * 3600) - (minute*60))
if sec<10:
sec_str = "0" + str(sec)
else:
--- a/src/ldt/ldt/text/migrations/0001_initial.py Fri Mar 01 18:08:11 2013 +0100
+++ b/src/ldt/ldt/text/migrations/0001_initial.py Wed May 15 10:05:17 2013 +0200
@@ -1,15 +1,13 @@
# encoding: utf-8
-import datetime
from south.db import db
from south.v2 import SchemaMigration
-from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'Annotation'
- db.create_table('text_annotation', (
+ db.create_table('text_annotation', ( # @UndefinedVariable
('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
('external_id', self.gf('django.db.models.fields.CharField')(default=u'5393f930-c975-11e0-bf36-58b035f6b93d', unique=True, max_length=255)),
('uri', self.gf('django.db.models.fields.CharField')(max_length=1024)),
@@ -23,13 +21,13 @@
('creation_date', self.gf('django.db.models.fields.DateTimeField')(auto_now_add=True, blank=True)),
('update_date', self.gf('django.db.models.fields.DateTimeField')(auto_now=True, blank=True)),
))
- db.send_create_signal('text', ['Annotation'])
+ db.send_create_signal('text', ['Annotation']) # @UndefinedVariable
def backwards(self, orm):
# Deleting model 'Annotation'
- db.delete_table('text_annotation')
+ db.delete_table('text_annotation') # @UndefinedVariable
models = {
--- a/src/ldt/ldt/text/migrations/0002_auto__chg_field_annotation_external_id.py Fri Mar 01 18:08:11 2013 +0100
+++ b/src/ldt/ldt/text/migrations/0002_auto__chg_field_annotation_external_id.py Wed May 15 10:05:17 2013 +0200
@@ -1,8 +1,6 @@
# -*- coding: utf-8 -*-
-import datetime
from south.db import db
from south.v2 import SchemaMigration
-from django.db import models
class Migration(SchemaMigration):
@@ -10,12 +8,12 @@
def forwards(self, orm):
# Changing field 'Annotation.external_id'
- db.alter_column('text_annotation', 'external_id', self.gf('django.db.models.fields.CharField')(unique=True, max_length=255))
+ db.alter_column('text_annotation', 'external_id', self.gf('django.db.models.fields.CharField')(unique=True, max_length=255)) # @UndefinedVariable
def backwards(self, orm):
# Changing field 'Annotation.external_id'
- db.alter_column('text_annotation', 'external_id', self.gf('django.db.models.fields.CharField')(max_length=255, unique=True))
+ db.alter_column('text_annotation', 'external_id', self.gf('django.db.models.fields.CharField')(max_length=255, unique=True)) # @UndefinedVariable
models = {
'text.annotation': {
--- a/src/ldt/ldt/text/tests/oauth_tests.py Fri Mar 01 18:08:11 2013 +0100
+++ b/src/ldt/ldt/text/tests/oauth_tests.py Wed May 15 10:05:17 2013 +0200
@@ -8,7 +8,7 @@
from oauth_provider.consts import OUT_OF_BAND
from oauth_provider.models import Consumer, Token
import datetime
-import lxml
+import lxml.etree
import time
import urlparse
--- a/src/ldt/ldt/text/utils.py Fri Mar 01 18:08:11 2013 +0100
+++ b/src/ldt/ldt/text/utils.py Wed May 15 10:05:17 2013 +0200
@@ -1,6 +1,5 @@
-from django.conf import settings
+import ldt.indexation
import uuid
-import ldt.indexation
__BOOLEAN_DICT = {
'false':False,
@@ -11,12 +10,12 @@
'f':False
}
-def boolean_convert(bool):
- if bool is None:
+def boolean_convert(b):
+ if b is None:
return False
- if bool is True or bool is False:
- return bool
- key = str(bool).lower()
+ if b is True or b is False:
+ return b
+ key = str(b).lower()
return __BOOLEAN_DICT.get(key, False)
--- a/src/ldt/ldt/text/views.py Fri Mar 01 18:08:11 2013 +0100
+++ b/src/ldt/ldt/text/views.py Wed May 15 10:05:17 2013 +0200
@@ -6,12 +6,12 @@
from ldt.text.utils import TextSearch, generate_uuid
from oauth_provider.decorators import oauth_required
from urllib2 import urlparse
-import lxml
+import lxml.etree
## Filters the annotation depending on the request parameters
## Returns an xml containing the resulting annotations
-def filter_annotation(request, uri=None, filter=None, limit=None, creator=None):
+def filter_annotation(request, uri=None, filter=None, limit=None, creator=None): # @ReservedAssignment
query = Q()
if request.GET.get('uri'):
@@ -53,9 +53,9 @@
id_nodes = doc.xpath("/iri/text-annotation/id/text()")
if id_nodes:
- id = unicode(id_nodes[0])
+ id_n = unicode(id_nodes[0])
else:
- id = generate_uuid()
+ id_n = generate_uuid()
uri = unicode(doc.xpath("/iri/text-annotation/uri/text()")[0])
@@ -98,7 +98,7 @@
contributor = None
try:
- annotation = Annotation.create_annotation(external_id=id, uri=uri, tags=tags, title=title, description=desc, text=text, color=color, creator=creator, contributor=contributor)
+ annotation = Annotation.create_annotation(external_id=id_n, uri=uri, tags=tags, title=title, description=desc, text=text, color=color, creator=creator, contributor=contributor)
annotation.save()
return HttpResponse(lxml.etree.tostring(annotation.serialize(), pretty_print=True), mimetype="text/xml;charset=utf-8")
except IntegrityError:
@@ -108,7 +108,7 @@
## Gets an annotation from its id
## Returns the xml-structured annotation
-def get_annotation(request, id):
+def get_annotation(request, id): # @ReservedAssignment
try:
annot = Annotation.objects.get(external_id=id)
except Annotation.DoesNotExist:
@@ -123,7 +123,7 @@
## Returns an empty xml-structured annotation
@oauth_required
@csrf_exempt
-def delete_annotation(request, id):
+def delete_annotation(request, id): # @ReservedAssignment
try:
annot = Annotation.objects.get(external_id=id)
annot.delete()
@@ -137,7 +137,7 @@
## Returns the xml-structured updated annotation
@oauth_required
@csrf_exempt
-def update_annotation(request, id):
+def update_annotation(request, id): # @ReservedAssignment
put_data = {}
if request.GET != {}:
--- a/src/ldt/ldt/user/admin.py Fri Mar 01 18:08:11 2013 +0100
+++ b/src/ldt/ldt/user/admin.py Wed May 15 10:05:17 2013 +0200
@@ -7,7 +7,6 @@
from guardian.admin import GuardedModelAdmin
from models import Ldt, UserProfile, GroupProfile
from tastypie.admin import ApiKeyInline
-from tastypie.models import ApiAccess, ApiKey
class GroupProfileInline(admin.StackedInline):
--- a/src/ldt/ldt/user/templatetags/logintag.py Fri Mar 01 18:08:11 2013 +0100
+++ b/src/ldt/ldt/user/templatetags/logintag.py Wed May 15 10:05:17 2013 +0200
@@ -2,7 +2,7 @@
register = template.Library()
-def login_ajax(user, reload=None):
+def login_ajax(user, reload=None): # @ReservedAssignment
return {'user': user, 'reload': reload}
register.inclusion_tag('ldt/user/login_form.html')(login_ajax)
--- a/src/ldt/ldt/utils/zipfileext.py Fri Mar 01 18:08:11 2013 +0100
+++ b/src/ldt/ldt/utils/zipfileext.py Wed May 15 10:05:17 2013 +0200
@@ -2,7 +2,7 @@
import os.path
class ZipFileExt(zipfile.ZipFile):
- def unzip_into_dir(self, dir):
+ def unzip_into_dir(self, dir): # @ReservedAssignment
if not os.path.exists(dir):
os.mkdir(dir, 0777)
for name in self.namelist():