PEP8 cleanups, unused imports cleanups

This commit is contained in:
Roberto Rosario
2014-06-29 14:14:27 -04:00
parent 904ff92cf1
commit ecb6733cd4
53 changed files with 92 additions and 189 deletions

View File

@@ -92,7 +92,8 @@ register_diagnostic('documents', _(u'Documents'), document_missing_list)
register_maintenance_links([document_find_all_duplicates, document_update_page_count, document_clear_image_cache], namespace='documents', title=_(u'documents'))
register_model_list_columns(Document, [
{'name': _(u'thumbnail'), 'attribute':
{
'name': _(u'thumbnail'), 'attribute':
encapsulate(lambda x: document_thumbnail(x))
},
])

View File

@@ -1,13 +1,12 @@
# 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 'DocumentType'
db.create_table('documents_documenttype', (
('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
@@ -70,9 +69,7 @@ class Migration(SchemaMigration):
))
db.send_create_signal('documents', ['RecentDocument'])
def backwards(self, orm):
# Deleting model 'DocumentType'
db.delete_table('documents_documenttype')
@@ -91,7 +88,6 @@ class Migration(SchemaMigration):
# Deleting model 'RecentDocument'
db.delete_table('documents_recentdocument')
models = {
'auth.group': {
'Meta': {'object_name': 'Group'},

View File

@@ -1,10 +1,10 @@
# encoding: utf-8
import os
import datetime
from south.db import db
from south.v2 import DataMigration
from django.db import models
class Migration(DataMigration):
def forwards(self, orm):
@@ -18,7 +18,7 @@ class Migration(DataMigration):
for document in orm.Document.objects.all():
document.file_filename, document.file_extension = document.file_filename.split(os.extsep)
document.save()
models = {
'auth.group': {
'Meta': {'object_name': 'Group'},

View File

@@ -4,20 +4,17 @@ from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Deleting field 'Document.file_extension'
db.delete_column('documents_document', 'file_extension')
def backwards(self, orm):
# Adding field 'Document.file_extension'
db.add_column('documents_document', 'file_extension', self.gf('django.db.models.fields.CharField')(default=u'', max_length=16, db_index=True), keep_default=False)
models = {
'auth.group': {
'Meta': {'object_name': 'Group'},

View File

@@ -1,13 +1,12 @@
# 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 'DocumentVersion'
db.create_table('documents_documentversion', (
('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
@@ -32,9 +31,7 @@ class Migration(SchemaMigration):
# Adding field 'DocumentPage.document_version'
db.add_column('documents_documentpage', 'document_version', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['documents.DocumentVersion'], null=True, blank=True), keep_default=False)
def backwards(self, orm):
# Removing unique constraint on 'DocumentVersion', fields ['document', 'mayor', 'minor', 'micro', 'release_level', 'serial']
db.delete_unique('documents_documentversion', ['document_id', 'mayor', 'minor', 'micro', 'release_level', 'serial'])
@@ -44,7 +41,6 @@ class Migration(SchemaMigration):
# Deleting field 'DocumentPage.document_version'
db.delete_column('documents_documentpage', 'document_version_id')
models = {
'auth.group': {
'Meta': {'object_name': 'Group'},

View File

@@ -1,21 +1,20 @@
# encoding: utf-8
import datetime
from south.db import db
from south.v2 import DataMigration
from django.db import models
class Migration(DataMigration):
def forwards(self, orm):
for document in orm.Document.objects.all():
document_version = document.versions.create(
document = document,
timestamp = document.date_added,
file = document.file,
mimetype = document.file_mimetype,
encoding = document.file_mime_encoding,
filename = document.file_filename,
checksum = document.checksum,
document=document,
timestamp=document.date_added,
file=document.file,
mimetype=document.file_mimetype,
encoding=document.file_mime_encoding,
filename=document.file_filename,
checksum=document.checksum,
)
document_version.save()
for document_page in document.pages.all():

View File

@@ -1,9 +1,8 @@
# encoding: utf-8
import datetime
from south.db import db
from south.v2 import DataMigration
from django.db import models
class Migration(DataMigration):
def forwards(self, orm):

View File

@@ -4,10 +4,10 @@ from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Changing field 'DocumentVersion.document'
db.alter_column('documents_documentversion', 'document_id', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['documents.Document']))
@@ -35,9 +35,7 @@ class Migration(SchemaMigration):
# Changing field 'DocumentPage.document_version'
db.alter_column('documents_documentpage', 'document_version_id', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['documents.DocumentVersion']))
def backwards(self, orm):
# Changing field 'DocumentVersion.document'
db.alter_column('documents_documentversion', 'document_id', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['documents.Document'], null=True))
@@ -65,7 +63,6 @@ class Migration(SchemaMigration):
# Changing field 'DocumentPage.document_version'
db.alter_column('documents_documentpage', 'document_version_id', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['documents.DocumentVersion'], null=True))
models = {
'auth.group': {
'Meta': {'object_name': 'Group'},

View File

@@ -1,13 +1,12 @@
# 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):
# Removing unique constraint on 'DocumentVersion', fields ['release_level', 'micro', 'serial', 'document', 'mayor', 'minor']
db.delete_unique('documents_documentversion', ['release_level', 'micro', 'serial', 'document_id', 'mayor', 'minor'])
@@ -20,9 +19,7 @@ class Migration(SchemaMigration):
# Adding unique constraint on 'DocumentVersion', fields ['major', 'release_level', 'micro', 'serial', 'document', 'minor']
db.create_unique('documents_documentversion', ['major', 'release_level', 'micro', 'serial', 'document_id', 'minor'])
def backwards(self, orm):
# Removing unique constraint on 'DocumentVersion', fields ['major', 'release_level', 'micro', 'serial', 'document', 'minor']
db.delete_unique('documents_documentversion', ['major', 'release_level', 'micro', 'serial', 'document_id', 'minor'])
@@ -35,7 +32,6 @@ class Migration(SchemaMigration):
# Adding unique constraint on 'DocumentVersion', fields ['release_level', 'micro', 'serial', 'document', 'mayor', 'minor']
db.create_unique('documents_documentversion', ['release_level', 'micro', 'serial', 'document_id', 'mayor', 'minor'])
models = {
'auth.group': {
'Meta': {'object_name': 'Group'},

View File

@@ -4,20 +4,17 @@ from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'DocumentVersion.comment'
db.add_column('documents_documentversion', 'comment', self.gf('django.db.models.fields.TextField')(default='', blank=True), keep_default=False)
def backwards(self, orm):
# Deleting field 'DocumentVersion.comment'
db.delete_column('documents_documentversion', 'comment')
models = {
'auth.group': {
'Meta': {'object_name': 'Group'},

View File

@@ -4,20 +4,17 @@ from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Changing field 'Document.date_added'
db.alter_column('documents_document', 'date_added', self.gf('django.db.models.fields.DateTimeField')())
def backwards(self, orm):
# Changing field 'Document.date_added'
db.alter_column('documents_document', 'date_added', self.gf('django.db.models.fields.DateTimeField')(auto_now_add=True))
models = {
'auth.group': {
'Meta': {'object_name': 'Group'},

View File

@@ -4,20 +4,17 @@ from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'DocumentVersion.signature_state'
db.add_column('documents_documentversion', 'signature_state', self.gf('django.db.models.fields.CharField')(max_length=16, null=True, blank=True), keep_default=False)
def backwards(self, orm):
# Deleting field 'DocumentVersion.signature_state'
db.delete_column('documents_documentversion', 'signature_state')
models = {
'auth.group': {
'Meta': {'object_name': 'Group'},

View File

@@ -1,23 +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 'DocumentVersion.signature_file'
db.add_column('documents_documentversion', 'signature_file', self.gf('django.db.models.fields.files.FileField')(max_length=100, null=True, blank=True), keep_default=False)
def backwards(self, orm):
# Deleting field 'DocumentVersion.signature_file'
db.delete_column('documents_documentversion', 'signature_file')
models = {
'auth.group': {
'Meta': {'object_name': 'Group'},

View File

@@ -1,33 +1,29 @@
# encoding: utf-8
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
depends_on = (
('document_signatures', '0002_move_signatures_to_new_app'),
)
)
def forwards(self, orm):
# Deleting field 'DocumentVersion.signature_file'
db.delete_column('documents_documentversion', 'signature_file')
# Deleting field 'DocumentVersion.signature_state'
db.delete_column('documents_documentversion', 'signature_state')
def backwards(self, orm):
# Adding field 'DocumentVersion.signature_file'
db.add_column('documents_documentversion', 'signature_file', self.gf('django.db.models.fields.files.FileField')(max_length=100, null=True, blank=True), keep_default=False)
# Adding field 'DocumentVersion.signature_state'
db.add_column('documents_documentversion', 'signature_state', self.gf('django.db.models.fields.CharField')(max_length=16, null=True, blank=True), keep_default=False)
models = {
'auth.group': {
'Meta': {'object_name': 'Group'},

View File

@@ -8,7 +8,6 @@ from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Changing field 'DocumentVersion.mimetype'
db.alter_column('documents_documentversion', 'mimetype', self.gf('django.db.models.fields.CharField')(max_length=64, null=True))
@@ -16,7 +15,6 @@ class Migration(SchemaMigration):
db.alter_column('documents_documentversion', 'encoding', self.gf('django.db.models.fields.CharField')(max_length=64, null=True))
def backwards(self, orm):
# Changing field 'DocumentVersion.mimetype'
db.alter_column('documents_documentversion', 'mimetype', self.gf('django.db.models.fields.CharField')(max_length=64))
@@ -157,4 +155,4 @@ class Migration(SchemaMigration):
}
}
complete_apps = ['documents']
complete_apps = ['documents']

View File

@@ -11,12 +11,10 @@ class Migration(SchemaMigration):
# Adding unique constraint on 'DocumentType', fields ['name']
db.create_unique('documents_documenttype', ['name'])
def backwards(self, orm):
# Removing unique constraint on 'DocumentType', fields ['name']
db.delete_unique('documents_documenttype', ['name'])
models = {
'auth.group': {
'Meta': {'object_name': 'Group'},
@@ -151,4 +149,4 @@ class Migration(SchemaMigration):
}
}
complete_apps = ['documents']
complete_apps = ['documents']

View File

@@ -8,12 +8,10 @@ from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Changing field 'DocumentVersion.mimetype'
db.alter_column('documents_documentversion', 'mimetype', self.gf('django.db.models.fields.CharField')(max_length=255, null=True))
def backwards(self, orm):
# Changing field 'DocumentVersion.mimetype'
db.alter_column('documents_documentversion', 'mimetype', self.gf('django.db.models.fields.CharField')(max_length=64, null=True))
@@ -151,4 +149,4 @@ class Migration(SchemaMigration):
}
}
complete_apps = ['documents']
complete_apps = ['documents']

View File

@@ -2,8 +2,6 @@ from django.template import Library, Node, Variable
from converter.api import get_dimensions
from documents.conf.settings import PRINT_SIZE
register = Library()