from __future__ import print_function

This commit is contained in:
j 2016-02-18 16:19:26 +05:30
commit 6b1ce30eb2
22 changed files with 109 additions and 81 deletions

View file

@ -1,5 +1,7 @@
# -*- coding: utf-8 -*-
# vi:si:et:sw=4:sts=4:ts=4
from __future__ import print_function
from django.core.management.base import BaseCommand
from django.conf import settings
from django.db import transaction
@ -19,4 +21,4 @@ class Command(BaseCommand):
i = models.Item.objects.get(public_id=id)
path = i.frame(position, height)
if path:
print path
print(path)

View file

@ -1,5 +1,7 @@
# -*- coding: utf-8 -*-
# vi:si:et:sw=4:sts=4:ts=4
from __future__ import print_function
from optparse import make_option
from django.core.management.base import BaseCommand
@ -26,7 +28,7 @@ class Command(BaseCommand):
try:
i = models.Item.objects.get(pk=id)
if options['debug']:
print i
print(i)
i.update_facets()
except:
pass

View file

@ -1,5 +1,6 @@
# -*- coding: utf-8 -*-
# vi:si:et:sw=4:sts=4:ts=4
from __future__ import print_function
from optparse import make_option
from django.core.management.base import BaseCommand
@ -25,7 +26,7 @@ class Command(BaseCommand):
for id in ids:
try:
i = models.Item.objects.get(pk=id)
print i
print(i)
i.update_find()
except:
pass

View file

@ -1,5 +1,7 @@
# -*- coding: utf-8 -*-
# vi:si:et:sw=4:sts=4:ts=4
from __future__ import print_function
from optparse import make_option
from django.core.management.base import BaseCommand
@ -26,7 +28,7 @@ class Command(BaseCommand):
try:
i = models.Item.objects.get(pk=id)
if options['debug']:
print i
print(i)
i.update_facets()
i.update_sort()
i.update_find()

View file

@ -1,5 +1,7 @@
# -*- coding: utf-8 -*-
# vi:si:et:sw=4:sts=4:ts=4
from __future__ import print_function
from optparse import make_option
from django.core.management.base import BaseCommand
@ -25,7 +27,7 @@ class Command(BaseCommand):
try:
i = models.Item.objects.get(pk=id)
if options['debug']:
print i
print(i)
i.update_sort()
except:
pass

View file

@ -1,5 +1,6 @@
# -*- coding: utf-8 -*-
# vi:si:et:sw=4:sts=4:ts=4
from __future__ import print_function
import os
from glob import glob
@ -25,6 +26,6 @@ class Command(BaseCommand):
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 \
not glob('%s/timelinekeyframes16p0.jpg'%i.timeline_prefix):
print i.public_id
print(i.public_id)
tasks.rebuild_timeline.delay(i.public_id)
offset += chunk

View file

@ -1,5 +1,7 @@
# -*- coding: utf-8 -*-
# vi:si:et:sw=4:sts=4:ts=4
from __future__ import print_function
from optparse import make_option
from django.core.management.base import BaseCommand
@ -27,7 +29,7 @@ class Command(BaseCommand):
def create_index(index, table, key):
sql = 'CREATE INDEX "%s" ON "%s" USING gin ("%s" gin_trgm_ops)' % (index, table, key)
if options['debug']:
print sql
print(sql)
cursor.execute(sql)
if settings.DB_GIN_TRGM:

View file

@ -1,5 +1,6 @@
# -*- coding: utf-8 -*-
# vi:si:et:sw=4:sts=4:ts=4
from __future__ import print_function
from optparse import make_option
from django.core.management.base import BaseCommand
@ -102,17 +103,17 @@ class Command(BaseCommand):
sql = 'BEGIN'
changes.append(sql)
if changes:
print "Updating database schema..."
print("Updating database schema...")
for sql in changes:
if options['debug']:
print sql
print(sql)
cursor.execute(sql)
transaction.commit_unless_managed()
if rebuild:
print "Updating sort values..."
print("Updating sort values...")
ids = [i['id'] for i in models.Item.objects.all().values('id')]
for id in ids:
i = models.Item.objects.get(pk=id)
if options['debug']:
print i
print(i)
i.update_sort()

View file

@ -1,5 +1,7 @@
# -*- coding: utf-8 -*-
# vi:si:et:sw=4:sts=4:ts=4
from __future__ import print_function
from optparse import make_option
from django.core.management.base import BaseCommand
@ -27,9 +29,9 @@ class Command(BaseCommand):
qs = models.Item.objects.exclude(public_id__startswith='0x')
count = pos = qs.count()
while (options['all'] and offset <= count) or offset < options['items']:
print offset, pos, count
print(offset, pos, count)
for i in qs.order_by('modified')[:chunk]:
print pos, i.public_id, i.modified
print(pos, i.public_id, i.modified)
i.update_external()
pos -= 1
offset += chunk