# HG changeset patch # User ymh # Date 1344172733 -7200 # Node ID aba6c30b6d2a943b60df69d62a7fe655948bfbc0 # Parent 0e91e924b9457c300d7760844ca3391ce609abbb first step of mysql migration diff -r 0e91e924b945 -r aba6c30b6d2a .settings/org.eclipse.core.resources.prefs --- a/.settings/org.eclipse.core.resources.prefs Thu Aug 02 11:16:36 2012 +0200 +++ b/.settings/org.eclipse.core.resources.prefs Sun Aug 05 15:18:53 2012 +0200 @@ -18,6 +18,11 @@ encoding//src/ldt/ldt/ldt_utils/migrations/0011_gen_stat_annotation.py=utf-8 encoding//src/ldt/ldt/ldt_utils/migrations/0015_auto__add_contentstat__del_field_content_last_annotated__del_field_con.py=utf-8 encoding//src/ldt/ldt/ldt_utils/migrations/0017_correct_image_path.py=utf-8 +encoding//src/ldt/ldt/ldt_utils/migrations/0018_auto__chg_field_content_iri_id__chg_field_project_ldt_id__chg_field_au.py=utf-8 +encoding//src/ldt/ldt/ldt_utils/migrations/0019_recalculate_media_hash_src.py=utf-8 +encoding//src/ldt/ldt/ldt_utils/migrations/0020_auto__add_field_segment_id_hash__chg_field_segment_iri_id__chg_field_s.py=utf-8 +encoding//src/ldt/ldt/ldt_utils/migrations/0021_recalculate_segment_id_hash_script.py=utf-8 +encoding//src/ldt/ldt/ldt_utils/migrations/0022_auto__chg_field_segment_cutting_id__chg_field_segment_ensemble_id__chg.py=utf-8 encoding//src/ldt/ldt/ldt_utils/views/json.py=utf-8 encoding//src/ldt/ldt/management/utils.py=utf-8 encoding//src/ldt/ldt/test/test_runner.py=utf-8 diff -r 0e91e924b945 -r aba6c30b6d2a src/ldt/ldt/ldt_utils/admin.py --- a/src/ldt/ldt/ldt_utils/admin.py Thu Aug 02 11:16:36 2012 +0200 +++ b/src/ldt/ldt/ldt_utils/admin.py Sun Aug 05 15:18:53 2012 +0200 @@ -17,7 +17,7 @@ pass class MediaAdmin(GuardedModelAdmin): - pass + readonly_fields = ['src_hash'] class ContentAdmin(GuardedModelAdmin): diff -r 0e91e924b945 -r aba6c30b6d2a src/ldt/ldt/ldt_utils/migrations/0001_initial.py --- a/src/ldt/ldt/ldt_utils/migrations/0001_initial.py Thu Aug 02 11:16:36 2012 +0200 +++ b/src/ldt/ldt/ldt_utils/migrations/0001_initial.py Sun Aug 05 15:18:53 2012 +0200 @@ -4,6 +4,7 @@ from south.db import db from south.v2 import SchemaMigration from django.db import models +import uuid class Migration(SchemaMigration): @@ -16,7 +17,7 @@ # Adding model 'Author' db.create_table('ldt_utils_author', ( ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), - ('handle', self.gf('django.db.models.fields.CharField')(max_length=512, unique=True, null=True, blank=True)), + ('handle', self.gf('django.db.models.fields.CharField')(max_length=255, unique=True, null=True, blank=True)), #this does not match modeldefinition because of mysql limitations ('email', self.gf('django.db.models.fields.EmailField')(max_length=75, null=True, blank=True)), ('firstname', self.gf('django.db.models.fields.CharField')(max_length=512, null=True, blank=True)), ('lastname', self.gf('django.db.models.fields.CharField')(max_length=512, null=True, blank=True)), @@ -38,14 +39,14 @@ ('creator', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['auth.User'], null=True, blank=True)), ('description', self.gf('django.db.models.fields.TextField')(null=True, blank=True)), ('title', self.gf('django.db.models.fields.CharField')(max_length=1024, null=True, blank=True)), - ('src', self.gf('django.db.models.fields.CharField')(unique=True, max_length=1024)), + ('src', self.gf('django.db.models.fields.CharField')(max_length=1024)), )) db.send_create_signal('ldt_utils', ['Media']) # Adding model 'Content' db.create_table('ldt_utils_content', ( ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), - ('iri_id', self.gf('django.db.models.fields.CharField')(default=u'540fe9e1-c974-11e0-9684-58b035f6b93d', unique=True, max_length=1024)), + ('iri_id', self.gf('django.db.models.fields.CharField')(default=lambda: unicode(uuid.uuid1()), unique=True, max_length=255)), #this does not match modeldefinition because of mysql limitations ('iriurl', self.gf('django.db.models.fields.CharField')(max_length=1024)), ('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)), @@ -70,7 +71,7 @@ db.create_table('ldt_utils_project', ( ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), ('owner', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['core.Owner'], null=True, blank=True)), - ('ldt_id', self.gf('django.db.models.fields.CharField')(unique=True, max_length=1024)), + ('ldt_id', self.gf('django.db.models.fields.CharField')(unique=True, max_length=255)), #this does not match modeldefinition because of mysql limitations ('ldt', self.gf('django.db.models.fields.TextField')(null=True)), ('title', self.gf('django.db.models.fields.CharField')(max_length=1024)), ('creation_date', self.gf('django.db.models.fields.DateTimeField')(auto_now_add=True, blank=True)), @@ -110,13 +111,13 @@ db.send_create_signal('ldt_utils', ['Segment']) # Adding unique constraint on 'Segment', fields ['project_id', 'iri_id', 'ensemble_id', 'cutting_id', 'element_id'] - db.create_unique('ldt_utils_segment', ['project_id', 'iri_id', 'ensemble_id', 'cutting_id', 'element_id']) + #db.create_unique('ldt_utils_segment', ['project_id', 'iri_id', 'ensemble_id', 'cutting_id', 'element_id']) def backwards(self, orm): # Removing unique constraint on 'Segment', fields ['project_id', 'iri_id', 'ensemble_id', 'cutting_id', 'element_id'] - db.delete_unique('ldt_utils_segment', ['project_id', 'iri_id', 'ensemble_id', 'cutting_id', 'element_id']) + #db.delete_unique('ldt_utils_segment', ['project_id', 'iri_id', 'ensemble_id', 'cutting_id', 'element_id']) # Deleting model 'Author' db.delete_table('ldt_utils_author') diff -r 0e91e924b945 -r aba6c30b6d2a src/ldt/ldt/ldt_utils/migrations/0017_correct_image_path.py --- a/src/ldt/ldt/ldt_utils/migrations/0017_correct_image_path.py Thu Aug 02 11:16:36 2012 +0200 +++ b/src/ldt/ldt/ldt_utils/migrations/0017_correct_image_path.py Sun Aug 05 15:18:53 2012 +0200 @@ -1,10 +1,7 @@ # -*- coding: utf-8 -*- -import datetime -from south.db import db from south.v2 import DataMigration -from django.db import models from django.conf import settings -import os.path +import os class Migration(DataMigration): diff -r 0e91e924b945 -r aba6c30b6d2a src/ldt/ldt/ldt_utils/migrations/0018_auto__chg_field_content_iri_id__chg_field_project_ldt_id__chg_field_au.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/ldt/ldt/ldt_utils/migrations/0018_auto__chg_field_content_iri_id__chg_field_project_ldt_id__chg_field_au.py Sun Aug 05 15:18:53 2012 +0200 @@ -0,0 +1,175 @@ +# -*- coding: utf-8 -*- +import datetime +from south.db import db +from south.v2 import SchemaMigration +from django.db import models +import hashlib +import uuid + + +class Migration(SchemaMigration): + + def forwards(self, orm): + # Removing unique constraint on 'Media', fields ['src'] + #db.delete_unique('ldt_utils_media', ['src']) + + + # 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)) + + # 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)) + + # 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)) + # Adding field 'Media.src_hash' + db.add_column('ldt_utils_media', 'src_hash', + self.gf('django.db.models.fields.CharField')(default=lambda : hashlib.sha512(str(uuid.uuid1())).hexdigest(), unique=True, max_length=128), + keep_default=False) + + + 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)) + + # 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)) + + # 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)) + # Deleting field 'Media.src_hash' + db.delete_column('ldt_utils_media', 'src_hash') + + # Adding unique constraint on 'Media', fields ['src'] + #db.create_unique('ldt_utils_media', ['src']) + + + models = { + 'auth.group': { + 'Meta': {'object_name': 'Group'}, + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}), + 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}) + }, + 'auth.permission': { + 'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'}, + 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}), + 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) + }, + 'auth.user': { + 'Meta': {'object_name': 'User'}, + 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), + 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}), + 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), + 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), + 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), + 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}), + 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}), + 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}) + }, + 'contenttypes.contenttype': { + 'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"}, + 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}) + }, + 'ldt_utils.author': { + 'Meta': {'object_name': 'Author'}, + 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'null': 'True', 'blank': 'True'}), + 'firstname': ('django.db.models.fields.CharField', [], {'max_length': '512', 'null': 'True', 'blank': 'True'}), + 'handle': ('django.db.models.fields.CharField', [], {'max_length': '255', 'unique': 'True', 'null': 'True', 'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'lastname': ('django.db.models.fields.CharField', [], {'max_length': '512', 'null': 'True', 'blank': 'True'}) + }, + 'ldt_utils.content': { + 'Meta': {'ordering': "['title']", 'object_name': 'Content'}, + 'authors': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['ldt_utils.Author']", 'symmetrical': 'False', 'blank': 'True'}), + 'content_creation_date': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}), + 'creation_date': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), + 'description': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'duration': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), + 'front_project': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ldt_utils.Project']", 'null': 'True', 'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'image': ('sorl.thumbnail.fields.ImageField', [], {'default': "'thumbnails/contents/content_default_icon.png'", 'max_length': '200'}), + 'iri_id': ('django.db.models.fields.CharField', [], {'default': "u'4a0c2ec0-dab4-11e1-a7c2-58b035f6b93d'", 'unique': 'True', 'max_length': '255'}), + 'iriurl': ('django.db.models.fields.CharField', [], {'max_length': '1024'}), + 'media_obj': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ldt_utils.Media']", 'null': 'True', 'blank': 'True'}), + 'tags': ('tagging.fields.TagField', [], {'max_length': '2048', 'null': 'True'}), + 'title': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'null': 'True', 'blank': 'True'}), + 'update_date': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}) + }, + 'ldt_utils.contentstat': { + 'Meta': {'object_name': 'ContentStat'}, + 'annotation_volume_str': ('django.db.models.fields.CommaSeparatedIntegerField', [], {'max_length': '1024', 'null': 'True', 'blank': 'True'}), + 'content': ('django.db.models.fields.related.OneToOneField', [], {'related_name': "'stat_annotation'", 'unique': 'True', 'to': "orm['ldt_utils.Content']"}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'last_annotated': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now', 'null': 'True', 'blank': 'True'}), + 'nb_annotations': ('django.db.models.fields.IntegerField', [], {'default': '0', 'db_index': 'True'}), + 'polemics_volume_str': ('django.db.models.fields.CommaSeparatedIntegerField', [], {'max_length': '1024', 'null': 'True', 'blank': 'True'}) + }, + 'ldt_utils.media': { + 'Meta': {'object_name': 'Media'}, + 'creation_date': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), + 'creator': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']", 'null': 'True', 'blank': 'True'}), + 'description': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'duration': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), + 'external_id': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'null': 'True', 'blank': 'True'}), + 'external_permalink': ('django.db.models.fields.URLField', [], {'max_length': '1024', 'null': 'True', 'blank': 'True'}), + 'external_publication_url': ('django.db.models.fields.URLField', [], {'max_length': '1024', 'null': 'True', 'blank': 'True'}), + 'external_src_url': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'null': 'True', 'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'media_creation_date': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}), + 'mimetype_field': ('django.db.models.fields.CharField', [], {'max_length': '512', 'null': 'True', 'blank': 'True'}), + 'src': ('django.db.models.fields.CharField', [], {'max_length': '1024'}), + 'src_hash': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '128'}), + 'title': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'null': 'True', 'blank': 'True'}), + 'update_date': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), + 'videopath': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'null': 'True', 'blank': 'True'}) + }, + 'ldt_utils.project': { + 'Meta': {'ordering': "['title']", 'object_name': 'Project'}, + 'changed_by': ('django.db.models.fields.CharField', [], {'max_length': '70'}), + 'contents': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['ldt_utils.Content']", 'symmetrical': 'False'}), + 'created_by': ('django.db.models.fields.CharField', [], {'max_length': '70'}), + 'creation_date': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), + 'description': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'image': ('sorl.thumbnail.fields.ImageField', [], {'default': "'thumbnails/projects/project_default_icon.png'", 'max_length': '200'}), + 'ldt': ('django.db.models.fields.TextField', [], {'null': 'True'}), + 'ldt_id': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '255'}), + 'modification_date': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), + 'owner': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']", 'null': 'True', 'blank': 'True'}), + 'state': ('django.db.models.fields.IntegerField', [], {'default': '1'}), + 'title': ('django.db.models.fields.CharField', [], {'max_length': '1024'}) + }, + 'ldt_utils.segment': { + 'Meta': {'unique_together': "(('project_id', 'iri_id', 'ensemble_id', 'cutting_id', 'element_id'),)", 'object_name': 'Segment'}, + 'abstract': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'author': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'null': 'True', 'blank': 'True'}), + 'content': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ldt_utils.Content']"}), + 'cutting_id': ('django.db.models.fields.CharField', [], {'max_length': '1024'}), + 'date': ('django.db.models.fields.CharField', [], {'max_length': '128', 'null': 'True', 'blank': 'True'}), + 'duration': ('django.db.models.fields.IntegerField', [], {'null': 'True'}), + 'element_id': ('django.db.models.fields.CharField', [], {'max_length': '1024'}), + 'ensemble_id': ('django.db.models.fields.CharField', [], {'max_length': '1024'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'iri_id': ('django.db.models.fields.CharField', [], {'max_length': '1024'}), + 'polemics': ('django.db.models.fields.IntegerField', [], {'default': '0', 'null': 'True', 'blank': 'True'}), + 'project_id': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'null': 'True', 'blank': 'True'}), + 'project_obj': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ldt_utils.Project']", 'null': 'True'}), + 'start_ts': ('django.db.models.fields.IntegerField', [], {'null': 'True'}), + 'tags': ('tagging.fields.TagField', [], {'max_length': '2048', 'null': 'True'}), + 'title': ('django.db.models.fields.CharField', [], {'max_length': '2048', 'null': 'True', 'blank': 'True'}) + } + } + + complete_apps = ['ldt_utils'] \ No newline at end of file diff -r 0e91e924b945 -r aba6c30b6d2a src/ldt/ldt/ldt_utils/migrations/0019_recalculate_media_hash_src.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/ldt/ldt/ldt_utils/migrations/0019_recalculate_media_hash_src.py Sun Aug 05 15:18:53 2012 +0200 @@ -0,0 +1,144 @@ +# -*- coding: utf-8 -*- +from south.v2 import DataMigration + +class Migration(DataMigration): + + def forwards(self, orm): + "Write your forwards methods here." + # Note: Remember to use orm['appname.ModelName'] rather than "from appname.models..." + for media in orm['ldt_utils.media'].objects.all(): + media.save() + + def backwards(self, orm): + "nothing to do" + pass + + models = { + 'auth.group': { + 'Meta': {'object_name': 'Group'}, + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}), + 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}) + }, + 'auth.permission': { + 'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'}, + 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}), + 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) + }, + 'auth.user': { + 'Meta': {'object_name': 'User'}, + 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), + 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}), + 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), + 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), + 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), + 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}), + 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}), + 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}) + }, + 'contenttypes.contenttype': { + 'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"}, + 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}) + }, + 'ldt_utils.author': { + 'Meta': {'object_name': 'Author'}, + 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'null': 'True', 'blank': 'True'}), + 'firstname': ('django.db.models.fields.CharField', [], {'max_length': '512', 'null': 'True', 'blank': 'True'}), + 'handle': ('django.db.models.fields.CharField', [], {'max_length': '255', 'unique': 'True', 'null': 'True', 'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'lastname': ('django.db.models.fields.CharField', [], {'max_length': '512', 'null': 'True', 'blank': 'True'}) + }, + 'ldt_utils.content': { + 'Meta': {'ordering': "['title']", 'object_name': 'Content'}, + 'authors': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['ldt_utils.Author']", 'symmetrical': 'False', 'blank': 'True'}), + 'content_creation_date': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}), + 'creation_date': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), + 'description': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'duration': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), + 'front_project': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ldt_utils.Project']", 'null': 'True', 'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'image': ('sorl.thumbnail.fields.ImageField', [], {'default': "'thumbnails/contents/content_default_icon.png'", 'max_length': '200'}), + 'iri_id': ('django.db.models.fields.CharField', [], {'default': "u'e2b3a8de-dae7-11e1-a0b3-58b035f6b93d'", 'unique': 'True', 'max_length': '255'}), + 'iriurl': ('django.db.models.fields.CharField', [], {'max_length': '1024'}), + 'media_obj': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ldt_utils.Media']", 'null': 'True', 'blank': 'True'}), + 'tags': ('tagging.fields.TagField', [], {'max_length': '2048', 'null': 'True'}), + 'title': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'null': 'True', 'blank': 'True'}), + 'update_date': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}) + }, + 'ldt_utils.contentstat': { + 'Meta': {'object_name': 'ContentStat'}, + 'annotation_volume_str': ('django.db.models.fields.CommaSeparatedIntegerField', [], {'max_length': '1024', 'null': 'True', 'blank': 'True'}), + 'content': ('django.db.models.fields.related.OneToOneField', [], {'related_name': "'stat_annotation'", 'unique': 'True', 'to': "orm['ldt_utils.Content']"}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'last_annotated': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now', 'null': 'True', 'blank': 'True'}), + 'nb_annotations': ('django.db.models.fields.IntegerField', [], {'default': '0', 'db_index': 'True'}), + 'polemics_volume_str': ('django.db.models.fields.CommaSeparatedIntegerField', [], {'max_length': '1024', 'null': 'True', 'blank': 'True'}) + }, + 'ldt_utils.media': { + 'Meta': {'object_name': 'Media'}, + 'creation_date': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), + 'creator': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']", 'null': 'True', 'blank': 'True'}), + 'description': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'duration': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), + 'external_id': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'null': 'True', 'blank': 'True'}), + 'external_permalink': ('django.db.models.fields.URLField', [], {'max_length': '1024', 'null': 'True', 'blank': 'True'}), + 'external_publication_url': ('django.db.models.fields.URLField', [], {'max_length': '1024', 'null': 'True', 'blank': 'True'}), + 'external_src_url': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'null': 'True', 'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'media_creation_date': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}), + 'mimetype_field': ('django.db.models.fields.CharField', [], {'max_length': '512', 'null': 'True', 'blank': 'True'}), + 'src': ('django.db.models.fields.CharField', [], {'max_length': '1024'}), + 'src_hash': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '128'}), + 'title': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'null': 'True', 'blank': 'True'}), + 'update_date': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), + 'videopath': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'null': 'True', 'blank': 'True'}) + }, + 'ldt_utils.project': { + 'Meta': {'ordering': "['title']", 'object_name': 'Project'}, + 'changed_by': ('django.db.models.fields.CharField', [], {'max_length': '70'}), + 'contents': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['ldt_utils.Content']", 'symmetrical': 'False'}), + 'created_by': ('django.db.models.fields.CharField', [], {'max_length': '70'}), + 'creation_date': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), + 'description': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'image': ('sorl.thumbnail.fields.ImageField', [], {'default': "'thumbnails/projects/project_default_icon.png'", 'max_length': '200'}), + 'ldt': ('django.db.models.fields.TextField', [], {'null': 'True'}), + 'ldt_id': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '255'}), + 'modification_date': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), + 'owner': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']", 'null': 'True', 'blank': 'True'}), + 'state': ('django.db.models.fields.IntegerField', [], {'default': '1'}), + 'title': ('django.db.models.fields.CharField', [], {'max_length': '1024'}) + }, + 'ldt_utils.segment': { + 'Meta': {'unique_together': "(('project_id', 'iri_id', 'ensemble_id', 'cutting_id', 'element_id'),)", 'object_name': 'Segment'}, + 'abstract': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'author': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'null': 'True', 'blank': 'True'}), + 'content': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ldt_utils.Content']"}), + 'cutting_id': ('django.db.models.fields.CharField', [], {'max_length': '1024'}), + 'date': ('django.db.models.fields.CharField', [], {'max_length': '128', 'null': 'True', 'blank': 'True'}), + 'duration': ('django.db.models.fields.IntegerField', [], {'null': 'True'}), + 'element_id': ('django.db.models.fields.CharField', [], {'max_length': '1024'}), + 'ensemble_id': ('django.db.models.fields.CharField', [], {'max_length': '1024'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'iri_id': ('django.db.models.fields.CharField', [], {'max_length': '1024'}), + 'polemics': ('django.db.models.fields.IntegerField', [], {'default': '0', 'null': 'True', 'blank': 'True'}), + 'project_id': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'null': 'True', 'blank': 'True'}), + 'project_obj': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ldt_utils.Project']", 'null': 'True'}), + 'start_ts': ('django.db.models.fields.IntegerField', [], {'null': 'True'}), + 'tags': ('tagging.fields.TagField', [], {'max_length': '2048', 'null': 'True'}), + 'title': ('django.db.models.fields.CharField', [], {'max_length': '2048', 'null': 'True', 'blank': 'True'}) + } + } + + complete_apps = ['ldt_utils'] + symmetrical = True diff -r 0e91e924b945 -r aba6c30b6d2a src/ldt/ldt/ldt_utils/migrations/0020_auto__add_field_segment_id_hash__chg_field_segment_iri_id__chg_field_s.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/ldt/ldt/ldt_utils/migrations/0020_auto__add_field_segment_id_hash__chg_field_segment_iri_id__chg_field_s.py Sun Aug 05 15:18:53 2012 +0200 @@ -0,0 +1,215 @@ +# -*- coding: utf-8 -*- +import datetime +from south.db import db +from south.v2 import SchemaMigration +from django.db import models +import hashlib +import uuid + + +class Migration(SchemaMigration): + + def forwards(self, orm): + # Removing unique constraint on 'Segment', fields ['ensemble_id', 'element_id', 'project_id', 'iri_id', 'cutting_id'] + #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)) + + # 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)) + + + # Adding field 'Segment.id_hash' + db.add_column('ldt_utils_segment', 'id_hash', + self.gf('django.db.models.fields.CharField')(default=lambda : hashlib.sha512(str(uuid.uuid1())).hexdigest(), unique=True, 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)) + # Adding index on 'Segment', fields ['iri_id'] + db.create_index('ldt_utils_segment', ['iri_id']) + + + # 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)) + # Adding index on 'Segment', fields ['project_id'] + db.create_index('ldt_utils_segment', ['project_id']) + + # Changing field 'Segment.cutting_id' + db.alter_column('ldt_utils_segment', 'cutting_id', self.gf('django.db.models.fields.CharField')(max_length=512)) + + # Changing field 'Segment.ensemble_id' + db.alter_column('ldt_utils_segment', 'ensemble_id', self.gf('django.db.models.fields.CharField')(max_length=512)) + + # Changing field 'Segment.element_id' + db.alter_column('ldt_utils_segment', 'element_id', self.gf('django.db.models.fields.CharField')(max_length=512)) + + + + + def backwards(self, orm): + # Removing index on 'Segment', fields ['project_id'] + db.delete_index('ldt_utils_segment', ['project_id']) + + # Removing index on 'Segment', fields ['iri_id'] + db.delete_index('ldt_utils_segment', ['iri_id']) + + # Deleting field 'Segment.id_hash' + db.delete_column('ldt_utils_segment', 'id_hash') + + + # Changing field 'Segment.iri_id' + db.alter_column('ldt_utils_segment', 'iri_id', self.gf('django.db.models.fields.CharField')(max_length=1024)) + + # 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)) + # 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)) + + # 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)) + + # Changing field 'Segment.cutting_id' + db.alter_column('ldt_utils_segment', 'cutting_id', self.gf('django.db.models.fields.CharField')(max_length=1024)) + + # Changing field 'Segment.ensemble_id' + db.alter_column('ldt_utils_segment', 'ensemble_id', self.gf('django.db.models.fields.CharField')(max_length=1024)) + + # Changing field 'Segment.element_id' + db.alter_column('ldt_utils_segment', 'element_id', self.gf('django.db.models.fields.CharField')(max_length=1024)) + + + + models = { + 'auth.group': { + 'Meta': {'object_name': 'Group'}, + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}), + 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}) + }, + 'auth.permission': { + 'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'}, + 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}), + 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) + }, + 'auth.user': { + 'Meta': {'object_name': 'User'}, + 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), + 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}), + 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), + 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), + 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), + 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}), + 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}), + 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}) + }, + 'contenttypes.contenttype': { + 'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"}, + 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}) + }, + 'ldt_utils.author': { + 'Meta': {'object_name': 'Author'}, + 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'null': 'True', 'blank': 'True'}), + 'firstname': ('django.db.models.fields.CharField', [], {'max_length': '512', 'null': 'True', 'blank': 'True'}), + 'handle': ('django.db.models.fields.CharField', [], {'max_length': '255', 'unique': 'True', 'null': 'True', 'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'lastname': ('django.db.models.fields.CharField', [], {'max_length': '512', 'null': 'True', 'blank': 'True'}) + }, + 'ldt_utils.content': { + 'Meta': {'ordering': "['title']", 'object_name': 'Content'}, + 'authors': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['ldt_utils.Author']", 'symmetrical': 'False', 'blank': 'True'}), + 'content_creation_date': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}), + 'creation_date': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), + 'description': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'duration': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), + 'front_project': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ldt_utils.Project']", 'null': 'True', 'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'image': ('sorl.thumbnail.fields.ImageField', [], {'default': "'thumbnails/contents/content_default_icon.png'", 'max_length': '200'}), + 'iri_id': ('django.db.models.fields.CharField', [], {'default': "u'5abdc87d-dd87-11e1-9a4f-58b035f6b93d'", 'unique': 'True', 'max_length': '255'}), + 'iriurl': ('django.db.models.fields.CharField', [], {'max_length': '1024'}), + 'media_obj': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ldt_utils.Media']", 'null': 'True', 'blank': 'True'}), + 'tags': ('tagging.fields.TagField', [], {'max_length': '2048', 'null': 'True'}), + 'title': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'null': 'True', 'blank': 'True'}), + 'update_date': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}) + }, + 'ldt_utils.contentstat': { + 'Meta': {'object_name': 'ContentStat'}, + 'annotation_volume_str': ('django.db.models.fields.CommaSeparatedIntegerField', [], {'max_length': '1024', 'null': 'True', 'blank': 'True'}), + 'content': ('django.db.models.fields.related.OneToOneField', [], {'related_name': "'stat_annotation'", 'unique': 'True', 'to': "orm['ldt_utils.Content']"}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'last_annotated': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now', 'null': 'True', 'blank': 'True'}), + 'nb_annotations': ('django.db.models.fields.IntegerField', [], {'default': '0', 'db_index': 'True'}), + 'polemics_volume_str': ('django.db.models.fields.CommaSeparatedIntegerField', [], {'max_length': '1024', 'null': 'True', 'blank': 'True'}) + }, + 'ldt_utils.media': { + 'Meta': {'object_name': 'Media'}, + 'creation_date': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), + 'creator': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']", 'null': 'True', 'blank': 'True'}), + 'description': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'duration': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), + 'external_id': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'null': 'True', 'blank': 'True'}), + 'external_permalink': ('django.db.models.fields.URLField', [], {'max_length': '1024', 'null': 'True', 'blank': 'True'}), + 'external_publication_url': ('django.db.models.fields.URLField', [], {'max_length': '1024', 'null': 'True', 'blank': 'True'}), + 'external_src_url': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'null': 'True', 'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'media_creation_date': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}), + 'mimetype_field': ('django.db.models.fields.CharField', [], {'max_length': '512', 'null': 'True', 'blank': 'True'}), + 'src': ('django.db.models.fields.CharField', [], {'max_length': '1024'}), + 'src_hash': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '128'}), + 'title': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'null': 'True', 'blank': 'True'}), + 'update_date': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), + 'videopath': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'null': 'True', 'blank': 'True'}) + }, + 'ldt_utils.project': { + 'Meta': {'ordering': "['title']", 'object_name': 'Project'}, + 'changed_by': ('django.db.models.fields.CharField', [], {'max_length': '70'}), + 'contents': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['ldt_utils.Content']", 'symmetrical': 'False'}), + 'created_by': ('django.db.models.fields.CharField', [], {'max_length': '70'}), + 'creation_date': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), + 'description': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'image': ('sorl.thumbnail.fields.ImageField', [], {'default': "'thumbnails/projects/project_default_icon.png'", 'max_length': '200'}), + 'ldt': ('django.db.models.fields.TextField', [], {'null': 'True'}), + 'ldt_id': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '255'}), + 'modification_date': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), + 'owner': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']", 'null': 'True', 'blank': 'True'}), + 'state': ('django.db.models.fields.IntegerField', [], {'default': '1'}), + 'title': ('django.db.models.fields.CharField', [], {'max_length': '1024'}) + }, + 'ldt_utils.segment': { + 'Meta': {'object_name': 'Segment'}, + 'abstract': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'author': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'null': 'True', 'blank': 'True'}), + 'content': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ldt_utils.Content']"}), + 'cutting_id': ('django.db.models.fields.CharField', [], {'max_length': '512', 'db_index': 'False'}), + 'date': ('django.db.models.fields.CharField', [], {'max_length': '128', 'null': 'True', 'blank': 'True'}), + 'duration': ('django.db.models.fields.IntegerField', [], {'null': 'True'}), + 'element_id': ('django.db.models.fields.CharField', [], {'max_length': '512', 'db_index': 'False'}), + 'ensemble_id': ('django.db.models.fields.CharField', [], {'max_length': '512', 'db_index': 'False'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'id_hash': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '128'}), + 'iri_id': ('django.db.models.fields.CharField', [], {'max_length': '255', 'db_index': 'True'}), + 'polemics': ('django.db.models.fields.IntegerField', [], {'default': '0', 'null': 'True', 'blank': 'True'}), + 'project_id': ('django.db.models.fields.CharField', [], {'db_index': 'True', 'max_length': '255', 'null': 'True', 'blank': 'True'}), + 'project_obj': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ldt_utils.Project']", 'null': 'True'}), + 'start_ts': ('django.db.models.fields.IntegerField', [], {'null': 'True'}), + 'tags': ('tagging.fields.TagField', [], {'max_length': '2048', 'null': 'True'}), + 'title': ('django.db.models.fields.CharField', [], {'max_length': '2048', 'null': 'True', 'blank': 'True'}) + } + } + + complete_apps = ['ldt_utils'] \ No newline at end of file diff -r 0e91e924b945 -r aba6c30b6d2a src/ldt/ldt/ldt_utils/migrations/0021_recalculate_segment_id_hash_script.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/ldt/ldt/ldt_utils/migrations/0021_recalculate_segment_id_hash_script.py Sun Aug 05 15:18:53 2012 +0200 @@ -0,0 +1,148 @@ +# -*- coding: 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 segment in orm['ldt_utils.segment'].objects.all(): + segment.save() + pass + + def backwards(self, orm): + pass # do nothing + + models = { + 'auth.group': { + 'Meta': {'object_name': 'Group'}, + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}), + 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}) + }, + 'auth.permission': { + 'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'}, + 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}), + 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) + }, + 'auth.user': { + 'Meta': {'object_name': 'User'}, + 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), + 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}), + 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), + 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), + 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), + 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}), + 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}), + 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}) + }, + 'contenttypes.contenttype': { + 'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"}, + 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}) + }, + 'ldt_utils.author': { + 'Meta': {'object_name': 'Author'}, + 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'null': 'True', 'blank': 'True'}), + 'firstname': ('django.db.models.fields.CharField', [], {'max_length': '512', 'null': 'True', 'blank': 'True'}), + 'handle': ('django.db.models.fields.CharField', [], {'max_length': '255', 'unique': 'True', 'null': 'True', 'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'lastname': ('django.db.models.fields.CharField', [], {'max_length': '512', 'null': 'True', 'blank': 'True'}) + }, + 'ldt_utils.content': { + 'Meta': {'ordering': "['title']", 'object_name': 'Content'}, + 'authors': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['ldt_utils.Author']", 'symmetrical': 'False', 'blank': 'True'}), + 'content_creation_date': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}), + 'creation_date': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), + 'description': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'duration': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), + 'front_project': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ldt_utils.Project']", 'null': 'True', 'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'image': ('sorl.thumbnail.fields.ImageField', [], {'default': "'thumbnails/contents/content_default_icon.png'", 'max_length': '200'}), + 'iri_id': ('django.db.models.fields.CharField', [], {'default': "u'0140762e-dd88-11e1-8f2c-58b035f6b93d'", 'unique': 'True', 'max_length': '255'}), + 'iriurl': ('django.db.models.fields.CharField', [], {'max_length': '1024'}), + 'media_obj': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ldt_utils.Media']", 'null': 'True', 'blank': 'True'}), + 'tags': ('tagging.fields.TagField', [], {'max_length': '2048', 'null': 'True'}), + 'title': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'null': 'True', 'blank': 'True'}), + 'update_date': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}) + }, + 'ldt_utils.contentstat': { + 'Meta': {'object_name': 'ContentStat'}, + 'annotation_volume_str': ('django.db.models.fields.CommaSeparatedIntegerField', [], {'max_length': '1024', 'null': 'True', 'blank': 'True'}), + 'content': ('django.db.models.fields.related.OneToOneField', [], {'related_name': "'stat_annotation'", 'unique': 'True', 'to': "orm['ldt_utils.Content']"}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'last_annotated': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now', 'null': 'True', 'blank': 'True'}), + 'nb_annotations': ('django.db.models.fields.IntegerField', [], {'default': '0', 'db_index': 'True'}), + 'polemics_volume_str': ('django.db.models.fields.CommaSeparatedIntegerField', [], {'max_length': '1024', 'null': 'True', 'blank': 'True'}) + }, + 'ldt_utils.media': { + 'Meta': {'object_name': 'Media'}, + 'creation_date': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), + 'creator': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']", 'null': 'True', 'blank': 'True'}), + 'description': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'duration': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), + 'external_id': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'null': 'True', 'blank': 'True'}), + 'external_permalink': ('django.db.models.fields.URLField', [], {'max_length': '1024', 'null': 'True', 'blank': 'True'}), + 'external_publication_url': ('django.db.models.fields.URLField', [], {'max_length': '1024', 'null': 'True', 'blank': 'True'}), + 'external_src_url': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'null': 'True', 'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'media_creation_date': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}), + 'mimetype_field': ('django.db.models.fields.CharField', [], {'max_length': '512', 'null': 'True', 'blank': 'True'}), + 'src': ('django.db.models.fields.CharField', [], {'max_length': '1024'}), + 'src_hash': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '128'}), + 'title': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'null': 'True', 'blank': 'True'}), + 'update_date': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), + 'videopath': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'null': 'True', 'blank': 'True'}) + }, + 'ldt_utils.project': { + 'Meta': {'ordering': "['title']", 'object_name': 'Project'}, + 'changed_by': ('django.db.models.fields.CharField', [], {'max_length': '70'}), + 'contents': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['ldt_utils.Content']", 'symmetrical': 'False'}), + 'created_by': ('django.db.models.fields.CharField', [], {'max_length': '70'}), + 'creation_date': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), + 'description': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'image': ('sorl.thumbnail.fields.ImageField', [], {'default': "'thumbnails/projects/project_default_icon.png'", 'max_length': '200'}), + 'ldt': ('django.db.models.fields.TextField', [], {'null': 'True'}), + 'ldt_id': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '255'}), + 'modification_date': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), + 'owner': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']", 'null': 'True', 'blank': 'True'}), + 'state': ('django.db.models.fields.IntegerField', [], {'default': '1'}), + 'title': ('django.db.models.fields.CharField', [], {'max_length': '1024'}) + }, + 'ldt_utils.segment': { + 'Meta': {'object_name': 'Segment'}, + 'abstract': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'author': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'null': 'True', 'blank': 'True'}), + 'content': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ldt_utils.Content']"}), + 'cutting_id': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'db_index': 'True'}), + 'date': ('django.db.models.fields.CharField', [], {'max_length': '128', 'null': 'True', 'blank': 'True'}), + 'duration': ('django.db.models.fields.IntegerField', [], {'null': 'True'}), + 'element_id': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'db_index': 'True'}), + 'ensemble_id': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'db_index': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'id_hash': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '128'}), + 'iri_id': ('django.db.models.fields.CharField', [], {'max_length': '255', 'db_index': 'True'}), + 'polemics': ('django.db.models.fields.IntegerField', [], {'default': '0', 'null': 'True', 'blank': 'True'}), + 'project_id': ('django.db.models.fields.CharField', [], {'db_index': 'True', 'max_length': '255', 'null': 'True', 'blank': 'True'}), + 'project_obj': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ldt_utils.Project']", 'null': 'True'}), + 'start_ts': ('django.db.models.fields.IntegerField', [], {'null': 'True'}), + 'tags': ('tagging.fields.TagField', [], {'max_length': '2048', 'null': 'True'}), + 'title': ('django.db.models.fields.CharField', [], {'max_length': '2048', 'null': 'True', 'blank': 'True'}) + } + } + + complete_apps = ['ldt_utils'] + symmetrical = True + \ No newline at end of file diff -r 0e91e924b945 -r aba6c30b6d2a src/ldt/ldt/ldt_utils/migrations/0022_auto__chg_field_segment_cutting_id__chg_field_segment_ensemble_id__chg.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/ldt/ldt/ldt_utils/migrations/0022_auto__chg_field_segment_cutting_id__chg_field_segment_ensemble_id__chg.py Sun Aug 05 15:18:53 2012 +0200 @@ -0,0 +1,160 @@ +# -*- 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): + + # Changing field 'Segment.cutting_id' + db.alter_column('ldt_utils_segment', 'cutting_id', self.gf('django.db.models.fields.CharField')(max_length=512)) + + # Changing field 'Segment.ensemble_id' + db.alter_column('ldt_utils_segment', 'ensemble_id', self.gf('django.db.models.fields.CharField')(max_length=512)) + + # Changing field 'Segment.element_id' + db.alter_column('ldt_utils_segment', 'element_id', self.gf('django.db.models.fields.CharField')(max_length=512)) + + def backwards(self, orm): + + # Changing field 'Segment.cutting_id' + db.alter_column('ldt_utils_segment', 'cutting_id', self.gf('django.db.models.fields.CharField')(max_length=1024)) + + # Changing field 'Segment.ensemble_id' + db.alter_column('ldt_utils_segment', 'ensemble_id', self.gf('django.db.models.fields.CharField')(max_length=1024)) + + # Changing field 'Segment.element_id' + db.alter_column('ldt_utils_segment', 'element_id', self.gf('django.db.models.fields.CharField')(max_length=1024)) + + models = { + 'auth.group': { + 'Meta': {'object_name': 'Group'}, + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}), + 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}) + }, + 'auth.permission': { + 'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'}, + 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}), + 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) + }, + 'auth.user': { + 'Meta': {'object_name': 'User'}, + 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), + 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}), + 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), + 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), + 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), + 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}), + 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}), + 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}) + }, + 'contenttypes.contenttype': { + 'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"}, + 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}) + }, + 'ldt_utils.author': { + 'Meta': {'object_name': 'Author'}, + 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'null': 'True', 'blank': 'True'}), + 'firstname': ('django.db.models.fields.CharField', [], {'max_length': '512', 'null': 'True', 'blank': 'True'}), + 'handle': ('django.db.models.fields.CharField', [], {'max_length': '255', 'unique': 'True', 'null': 'True', 'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'lastname': ('django.db.models.fields.CharField', [], {'max_length': '512', 'null': 'True', 'blank': 'True'}) + }, + 'ldt_utils.content': { + 'Meta': {'ordering': "['title']", 'object_name': 'Content'}, + 'authors': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['ldt_utils.Author']", 'symmetrical': 'False', 'blank': 'True'}), + 'content_creation_date': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}), + 'creation_date': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), + 'description': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'duration': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), + 'front_project': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ldt_utils.Project']", 'null': 'True', 'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'image': ('sorl.thumbnail.fields.ImageField', [], {'default': "'thumbnails/contents/content_default_icon.png'", 'max_length': '200'}), + 'iri_id': ('django.db.models.fields.CharField', [], {'default': "u'1d5e1597-dec9-11e1-8466-58b035f6b93d'", 'unique': 'True', 'max_length': '255'}), + 'iriurl': ('django.db.models.fields.CharField', [], {'max_length': '1024'}), + 'media_obj': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ldt_utils.Media']", 'null': 'True', 'blank': 'True'}), + 'tags': ('tagging.fields.TagField', [], {'max_length': '2048', 'null': 'True'}), + 'title': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'null': 'True', 'blank': 'True'}), + 'update_date': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}) + }, + 'ldt_utils.contentstat': { + 'Meta': {'object_name': 'ContentStat'}, + 'annotation_volume_str': ('django.db.models.fields.CommaSeparatedIntegerField', [], {'max_length': '1024', 'null': 'True', 'blank': 'True'}), + 'content': ('django.db.models.fields.related.OneToOneField', [], {'related_name': "'stat_annotation'", 'unique': 'True', 'to': "orm['ldt_utils.Content']"}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'last_annotated': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now', 'null': 'True', 'blank': 'True'}), + 'nb_annotations': ('django.db.models.fields.IntegerField', [], {'default': '0', 'db_index': 'True'}), + 'polemics_volume_str': ('django.db.models.fields.CommaSeparatedIntegerField', [], {'max_length': '1024', 'null': 'True', 'blank': 'True'}) + }, + 'ldt_utils.media': { + 'Meta': {'object_name': 'Media'}, + 'creation_date': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), + 'creator': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']", 'null': 'True', 'blank': 'True'}), + 'description': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'duration': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), + 'external_id': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'null': 'True', 'blank': 'True'}), + 'external_permalink': ('django.db.models.fields.URLField', [], {'max_length': '1024', 'null': 'True', 'blank': 'True'}), + 'external_publication_url': ('django.db.models.fields.URLField', [], {'max_length': '1024', 'null': 'True', 'blank': 'True'}), + 'external_src_url': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'null': 'True', 'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'media_creation_date': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}), + 'mimetype_field': ('django.db.models.fields.CharField', [], {'max_length': '512', 'null': 'True', 'blank': 'True'}), + 'src': ('django.db.models.fields.CharField', [], {'max_length': '1024'}), + 'src_hash': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '128'}), + 'title': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'null': 'True', 'blank': 'True'}), + 'update_date': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), + 'videopath': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'null': 'True', 'blank': 'True'}) + }, + 'ldt_utils.project': { + 'Meta': {'ordering': "['title']", 'object_name': 'Project'}, + 'changed_by': ('django.db.models.fields.CharField', [], {'max_length': '70'}), + 'contents': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['ldt_utils.Content']", 'symmetrical': 'False'}), + 'created_by': ('django.db.models.fields.CharField', [], {'max_length': '70'}), + 'creation_date': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), + 'description': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'image': ('sorl.thumbnail.fields.ImageField', [], {'default': "'thumbnails/projects/project_default_icon.png'", 'max_length': '200'}), + 'ldt': ('django.db.models.fields.TextField', [], {'null': 'True'}), + 'ldt_id': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '255'}), + 'modification_date': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), + 'owner': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']", 'null': 'True', 'blank': 'True'}), + 'state': ('django.db.models.fields.IntegerField', [], {'default': '1'}), + 'title': ('django.db.models.fields.CharField', [], {'max_length': '1024'}) + }, + 'ldt_utils.segment': { + 'Meta': {'object_name': 'Segment'}, + 'abstract': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'author': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'null': 'True', 'blank': 'True'}), + 'content': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ldt_utils.Content']"}), + 'cutting_id': ('django.db.models.fields.CharField', [], {'max_length': '512', 'db_index': 'True'}), + 'date': ('django.db.models.fields.CharField', [], {'max_length': '128', 'null': 'True', 'blank': 'True'}), + 'duration': ('django.db.models.fields.IntegerField', [], {'null': 'True'}), + 'element_id': ('django.db.models.fields.CharField', [], {'max_length': '512', 'db_index': 'True'}), + 'ensemble_id': ('django.db.models.fields.CharField', [], {'max_length': '512', 'db_index': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'id_hash': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '128'}), + 'iri_id': ('django.db.models.fields.CharField', [], {'max_length': '255', 'db_index': 'True'}), + 'polemics': ('django.db.models.fields.IntegerField', [], {'default': '0', 'null': 'True', 'blank': 'True'}), + 'project_id': ('django.db.models.fields.CharField', [], {'db_index': 'True', 'max_length': '255', 'null': 'True', 'blank': 'True'}), + 'project_obj': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ldt_utils.Project']", 'null': 'True'}), + 'start_ts': ('django.db.models.fields.IntegerField', [], {'null': 'True'}), + 'tags': ('tagging.fields.TagField', [], {'max_length': '2048', 'null': 'True'}), + 'title': ('django.db.models.fields.CharField', [], {'max_length': '2048', 'null': 'True', 'blank': 'True'}) + } + } + + complete_apps = ['ldt_utils'] \ No newline at end of file diff -r 0e91e924b945 -r aba6c30b6d2a src/ldt/ldt/ldt_utils/models.py --- a/src/ldt/ldt/ldt_utils/models.py Thu Aug 02 11:16:36 2012 +0200 +++ b/src/ldt/ldt/ldt_utils/models.py Sun Aug 05 15:18:53 2012 +0200 @@ -12,6 +12,7 @@ from tagging.models import Tag from utils import (create_ldt, copy_ldt, create_empty_iri, update_iri, generate_uuid) +from ldt.utils import generate_hash import datetime import lxml.etree import mimetypes @@ -24,7 +25,7 @@ class Author(SafeModel): - handle = models.CharField(max_length=512, unique=True, blank=True, null=True) + handle = models.CharField(max_length=255, unique=True, blank=True, null=True) email = models.EmailField(unique=False, blank=True, null=True) firstname = models.CharField(max_length=512, blank=True, null=True) lastname = models.CharField(max_length=512, blank=True, null=True) @@ -50,7 +51,9 @@ creator = models.ForeignKey(User, blank=True, null=True, verbose_name=_('media.creator')) description = models.TextField(null=True, blank=True, verbose_name=_('description')) title = models.CharField(max_length=1024, null=True, blank=True, verbose_name=_('title')) - src = models.CharField(max_length=1024, unique=True, verbose_name=_('media.src')) + src = models.CharField(max_length=1024, verbose_name=_('media.src')) + #TODO: use a fixed length char field + src_hash = models.CharField(max_length=128, unique=True, verbose_name=_('media.src_hash')) mimetype_field = models.CharField(max_length=512, null=True, blank=True, verbose_name=_('media.mimetype')) class Meta: @@ -93,6 +96,7 @@ stream_src = property(**stream_src()) def save(self, *args, **kwargs): + self.src_hash = generate_hash(self.src) super(Media, self).save(*args, **kwargs) for content in self.content_set.all(): content.sync_iri_file() @@ -119,7 +123,7 @@ class Content(SafeModel): objects = ContentManager() - iri_id = models.CharField(max_length=1024, unique=True, default=generate_uuid, verbose_name=_('content.iri_id')) + iri_id = models.CharField(max_length=255, unique=True, default=generate_uuid, verbose_name=_('content.iri_id')) iriurl = models.CharField(max_length=1024, verbose_name=_('content.iriurl')) creation_date = models.DateTimeField(auto_now_add=True, verbose_name=_('content.creation_date')) update_date = models.DateTimeField(auto_now=True, verbose_name=_('content.update_date')) @@ -484,7 +488,7 @@ (4, 'rejected'), (5, 'deleted') ) - ldt_id = models.CharField(max_length=1024, unique=True) + ldt_id = models.CharField(max_length=255, unique=True) ldt = models.TextField(null=True) title = models.CharField(max_length=1024) contents = models.ManyToManyField(Content) @@ -648,11 +652,11 @@ project_obj = models.ForeignKey(Project, null=True) content = models.ForeignKey(Content) - project_id = models.CharField(max_length=1024, unique=False, blank=True, null=True) - iri_id = models.CharField(max_length=1024, unique=False) - ensemble_id = models.CharField(max_length=1024, unique=False) - cutting_id = models.CharField(max_length=1024, unique=False) - element_id = models.CharField(max_length=1024, unique=False) + project_id = models.CharField(max_length=255, unique=False, blank=True, null=True, db_index=True) + iri_id = models.CharField(max_length=255, unique=False, db_index=True) + ensemble_id = models.CharField(max_length=512, unique=False, db_index=True) + cutting_id = models.CharField(max_length=512, unique=False, db_index=True) + element_id = models.CharField(max_length=512, unique=False, db_index=True) tags = tagging.fields.TagField(max_length=2048, null=True, blank=True, unique=False) title = models.CharField(max_length=2048, unique=False, null=True, blank=True) duration = models.IntegerField(null=True) @@ -661,6 +665,7 @@ date = models.CharField(max_length=128, unique=False, null=True, blank=True) abstract = models.TextField(null=True, blank=True) polemics = models.IntegerField(null=True, blank=True, default=0) + id_hash = models.CharField(max_length=128, unique=True) # All combinations of polemic hashtags can be represented by a combination of @@ -690,12 +695,15 @@ return value.pop() + def save(self, *args, **kwargs): + self.id_hash = generate_hash(str(self)) + super(Segment, self).save(*args, **kwargs) + def __unicode__(self): return "/".join((unicode(self.project_id), unicode(self.iri_id), unicode(self.ensemble_id), unicode(self.cutting_id), unicode(self.element_id))) class Meta: - unique_together = (('project_id', 'iri_id', 'ensemble_id', 'cutting_id', 'element_id'),) permissions = ( ('view_segment', 'Can view segment'), ) diff -r 0e91e924b945 -r aba6c30b6d2a src/ldt/ldt/text/migrations/0001_initial.py --- a/src/ldt/ldt/text/migrations/0001_initial.py Thu Aug 02 11:16:36 2012 +0200 +++ b/src/ldt/ldt/text/migrations/0001_initial.py Sun Aug 05 15:18:53 2012 +0200 @@ -11,7 +11,7 @@ # Adding model 'Annotation' db.create_table('text_annotation', ( ('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=1024)), + ('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)), ('tags_field', self.gf('tagging.fields.TagField')(max_length=2048, null=True)), ('title', self.gf('django.db.models.fields.CharField')(max_length=1024, null=True, blank=True)), diff -r 0e91e924b945 -r aba6c30b6d2a src/ldt/ldt/text/migrations/0002_auto__chg_field_annotation_external_id.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/ldt/ldt/text/migrations/0002_auto__chg_field_annotation_external_id.py Sun Aug 05 15:18:53 2012 +0200 @@ -0,0 +1,38 @@ +# -*- 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): + + # Changing field 'Annotation.external_id' + db.alter_column('text_annotation', 'external_id', self.gf('django.db.models.fields.CharField')(unique=True, max_length=255)) + + 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)) + + models = { + 'text.annotation': { + 'Meta': {'object_name': 'Annotation'}, + 'color': ('django.db.models.fields.CharField', [], {'max_length': '1024'}), + 'contributor': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'null': 'True', 'blank': 'True'}), + 'creation_date': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), + 'creator': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'null': 'True', 'blank': 'True'}), + 'description': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'external_id': ('django.db.models.fields.CharField', [], {'default': "u'5b1398c2-dab4-11e1-a723-58b035f6b93d'", 'unique': 'True', 'max_length': '255'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'tags_field': ('tagging.fields.TagField', [], {'max_length': '2048', 'null': 'True'}), + 'text': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'title': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'null': 'True', 'blank': 'True'}), + 'update_date': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), + 'uri': ('django.db.models.fields.CharField', [], {'max_length': '1024'}) + } + } + + complete_apps = ['text'] \ No newline at end of file diff -r 0e91e924b945 -r aba6c30b6d2a src/ldt/ldt/text/models.py --- a/src/ldt/ldt/text/models.py Thu Aug 02 11:16:36 2012 +0200 +++ b/src/ldt/ldt/text/models.py Sun Aug 05 15:18:53 2012 +0200 @@ -11,7 +11,7 @@ class Annotation(models.Model): - external_id = models.CharField(max_length=1024, null=False, unique=True, default=generate_uuid, verbose_name=_('annotation.external_id')) + external_id = models.CharField(max_length=255, null=False, unique=True, default=generate_uuid, verbose_name=_('annotation.external_id')) uri = models.CharField(max_length=1024, verbose_name=_('annotation.uri')) tags_field = tagging.fields.TagField(max_length=2048, null=True, blank=True, verbose_name=_('annotation.tags')) title = models.CharField(max_length=1024, null=True, blank=True, verbose_name=_('annotation.title')) diff -r 0e91e924b945 -r aba6c30b6d2a src/ldt/ldt/utils/__init__.py --- a/src/ldt/ldt/utils/__init__.py Thu Aug 02 11:16:36 2012 +0200 +++ b/src/ldt/ldt/utils/__init__.py Sun Aug 05 15:18:53 2012 +0200 @@ -1,4 +1,7 @@ +import hashlib def Property(func): return property(**func()) +def generate_hash(str): + return hashlib.sha512(str).hexdigest() if str is not None else None diff -r 0e91e924b945 -r aba6c30b6d2a virtualenv/res/lib/lib_create_env.py --- a/virtualenv/res/lib/lib_create_env.py Thu Aug 02 11:16:36 2012 +0200 +++ b/virtualenv/res/lib/lib_create_env.py Sun Aug 05 15:18:53 2012 +0200 @@ -7,6 +7,9 @@ import urllib import platform import patch +import struct +import glob +import re join = os.path.join system_str = platform.system() @@ -22,7 +25,6 @@ 'OAUTH2': { 'setup': 'python-oauth2', 'url':"https://github.com/simplegeo/python-oauth2/tarball/hudson-python-oauth2-211", 'local':"oauth2-1.5.211.tar.gz", 'install': {'method': 'easy_install', 'option_str': None, 'dict_extra_env': None}}, 'HTTPLIB2': { 'setup': 'python-httplib2', 'url':'http://code.google.com/p/httplib2/downloads/detail?name=httplib2-0.7.4.tar.gz&can=2&q=', 'local':"httplib2-0.7.4.tar.gz", 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}}, 'DJANGO-OAUTH-PLUS': { 'setup': 'django-oauth-plus', 'url':'http://bitbucket.org/david/django-oauth-plus/get/f314f018e473.gz', 'local':"django-oauth-plus.tar.gz", 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}}, - 'MYSQL': { 'setup': 'mysql-python', 'url': 'http://sourceforge.net/projects/mysql-python/files/mysql-python/1.2.3/MySQL-python-1.2.3.tar.gz/download', 'local':"MySQL-python-1.2.3.tar.gz", 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}}, 'OPENID': {'setup':'openid', 'url':'http://pypi.python.org/packages/source/p/python-openid/python-openid-2.2.5.tar.gz', 'local':"python-openid-2.2.5.tar.gz", 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}}, 'DJANGO_OPENID_CONSUMER': {'setup':'django_openid_consumer', 'url':'http://pypi.python.org/packages/source/d/django-openid-consumer/django-openid-consumer-0.1.1.tar.gz', 'local':"django-openid-consumer-0.1.1.tar.gz", 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}}, 'SOCIAL_AUTH': {'setup':'social_auth', 'url':'https://github.com/omab/django-social-auth/tarball/v0.3.10', 'local':"omab-django-social-auth-v0.3.10-modified.tar.gz", 'install': {'method': 'easy_install', 'option_str': None, 'dict_extra_env': None}}, @@ -42,23 +44,34 @@ } if system_str == 'Windows': + + size = 8 * struct.calcsize("P") + if size==32: + mysqlres = "MySQL-python-1.2.3.win32-py2.7.exe" + else: + mysqlres = "MySQL-python-1.2.3.win-amd64-py2.7.exe" + URLS.update({ 'PSYCOPG2': {'setup': 'psycopg2','url': 'psycopg2-2.0.14.win32-py2.6-pg8.4.3-release.zip', 'local':"psycopg2-2.0.14.win32-py2.6-pg8.4.3-release.zip", 'install': {'method': 'install_psycopg2', 'option_str': None, 'dict_extra_env': None}}, 'PIL': {'setup': 'pil', 'url': 'http://effbot.org/media/downloads/PIL-1.1.7.win32-py2.6.exe', 'local':"PIL-1.1.7.win32-py2.6.exe", 'install': {'method': 'easy_install', 'option_str': None, 'dict_extra_env': None}}, - 'LXML': {'setup': 'lxml', 'url': 'http://pypi.python.org/packages/2.6/l/lxml/lxml-2.2.2-py2.6-win32.egg', 'local':"lxml-2.2.2-py2.6-win32.egg", 'install': {'method': 'easy_install', 'option_str': None, 'dict_extra_env': None}} + 'LXML': {'setup': 'lxml', 'url': 'http://pypi.python.org/packages/2.6/l/lxml/lxml-2.2.2-py2.6-win32.egg', 'local':"lxml-2.2.2-py2.6-win32.egg", 'install': {'method': 'easy_install', 'option_str': None, 'dict_extra_env': None}}, + 'MYSQL': { 'setup': 'mysql-python', 'url': mysqlres, 'local': mysqlres, 'install': {'method': 'easy_install', 'option_str': None, 'dict_extra_env': None}}, }) else: if system_str == "Darwin": lxml_options = {'STATIC_DEPS': 'true', 'LIBXML2_VERSION': '2.8.0', 'LIBXSLT_VERSION': '1.1.26', 'LIBICONV_VERSION': '1.14'} lxml_method = 'easy_install' + mysql_method = 'install_mysql' else: lxml_options = None lxml_method = 'pip' + mysql_method = 'pip' URLS.update({ 'PSYCOPG2': {'setup': 'psycopg2','url': 'http://www.psycopg.org/psycopg/tarballs/PSYCOPG-2-4/psycopg2-2.4.5.tar.gz', 'local':"psycopg2-2.4.5.tar.gz", 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}}, 'PIL': {'setup': 'pil', 'url': 'http://effbot.org/downloads/Imaging-1.1.7.tar.gz', 'local':"Imaging-1.1.7.tar.gz", 'install': {'method': 'easy_install', 'option_str': None, 'dict_extra_env': None}}, 'LXML': {'setup': 'lxml', 'url':"lxml-2.3.4.tar.bz2", 'local':"lxml-2.3.4.tar.bz2", 'install': {'method': lxml_method, 'option_str': None, 'dict_extra_env': lxml_options}}, + 'MYSQL': { 'setup': 'mysql-python', 'url': 'http://sourceforge.net/projects/mysql-python/files/mysql-python/1.2.3/MySQL-python-1.2.3.tar.gz/download', 'local':"MySQL-python-1.2.3.tar.gz", 'install': {'method': mysql_method, 'option_str': None, 'dict_extra_env': None}}, }) @@ -107,101 +120,7 @@ metavar='ignore_packages', dest='ignore_packages', default=None, - help='list of comma separated keys for package to ignore') - -def install_pylucene(option_str, extra_env, res_source_key, home_dir, lib_dir, tmp_dir, src_dir, res_env, logger, call_subprocess, filter_python_develop): - - logger.notify("PYLUCENE Custom install") - logger.notify("Get Pylucene from %s " % res_env.URLS['PYLUCENE'][res_source_key]) - pylucene_src = os.path.join(src_dir,"pylucene.tar.gz") - if res_source_key == 'local': - shutil.copy(res_env.URLS['PYLUCENE'][res_source_key], pylucene_src) - else: - urllib.urlretrieve(res_env.URLS['PYLUCENE'][res_source_key], pylucene_src) - tf = tarfile.open(pylucene_src,'r:gz') - pylucene_base_path = os.path.join(src_dir,"pylucene") - logger.notify("Extract Pylucene to %s " % pylucene_base_path) - tf.extractall(pylucene_base_path) - tf.close() - - pylucene_src_path = os.path.join(pylucene_base_path, os.listdir(pylucene_base_path)[0]) - jcc_src_path = os.path.abspath(os.path.join(pylucene_src_path,"jcc")) - - #install jcc - - #patch for linux - if system_str == 'Linux' : - olddir = os.getcwd() - setuptools_path = os.path.join(lib_dir, 'site-packages', 'setuptools') - if os.path.exists(setuptools_path) and os.path.isdir(setuptools_path): - patch_dest_path = os.path.join(lib_dir, 'site-packages') - else: - patch_dest_path = os.path.join(lib_dir,'site-packages','setuptools-0.6c11-py%s.%s.egg' % (sys.version_info[0], sys.version_info[1])) - if os.path.isfile(patch_dest_path): - # must unzip egg - # rename file and etract all - shutil.move(patch_dest_path, patch_dest_path + ".zip") - zf = zipfile.ZipFile(patch_dest_path + ".zip",'r') - zf.extractall(patch_dest_path) - os.remove(patch_dest_path + ".zip") - logger.notify("Patch jcc : %s " % (patch_dest_path)) - os.chdir(patch_dest_path) - p = patch.fromfile(os.path.join(jcc_src_path,"jcc","patches","patch.43.0.6c11")) - p.apply() - os.chdir(olddir) - - logger.notify("Install jcc") - call_subprocess([os.path.abspath(os.path.join(home_dir, 'bin', 'python')), 'setup.py', 'install'], - cwd=jcc_src_path, - filter_stdout=filter_python_develop, - show_stdout=True) - #install pylucene - - logger.notify("Install pylucene") - #modify makefile - makefile_path = os.path.join(pylucene_src_path,"Makefile") - logger.notify("Modify makefile %s " % makefile_path) - shutil.move( makefile_path, makefile_path+"~" ) - - destination= open( makefile_path, "w" ) - source= open( makefile_path+"~", "r" ) - destination.write("PREFIX_PYTHON="+os.path.abspath(home_dir)+"\n") - destination.write("ANT=ant\n") - destination.write("PYTHON=$(PREFIX_PYTHON)/bin/python\n") - - if system_str == "Darwin": - if sys.version_info >= (2,6): - destination.write("JCC=$(PYTHON) -m jcc.__main__ --shared --arch x86_64 --arch i386\n") - else: - destination.write("JCC=$(PYTHON) -m jcc --shared --arch x86_64 --arch i386\n") - destination.write("NUM_FILES=2\n") - elif system_str == "Windows": - destination.write("JCC=$(PYTHON) -m jcc.__main__ --shared --arch x86_64 --arch i386\n") - destination.write("NUM_FILES=2\n") - else: - if sys.version_info >= (2,6) and sys.version_info <= (2,7): - destination.write("JCC=$(PYTHON) -m jcc.__main__ --shared\n") - else: - destination.write("JCC=$(PYTHON) -m jcc --shared\n") - destination.write("NUM_FILES=2\n") - for line in source: - destination.write( line ) - source.close() - destination.close() - os.remove(makefile_path+"~" ) - - logger.notify("pylucene make") - call_subprocess(['make'], - cwd=os.path.abspath(pylucene_src_path), - filter_stdout=filter_python_develop, - show_stdout=True) - - logger.notify("pylucene make install") - call_subprocess(['make', 'install'], - cwd=os.path.abspath(pylucene_src_path), - filter_stdout=filter_python_develop, - show_stdout=True) - + help='list of comma separated keys for package to ignore') def install_psycopg2(option_str, extra_env, res_source_key, home_dir, lib_dir, tmp_dir, src_dir, res_env, logger, call_subprocess, filter_python_develop): psycopg2_src = os.path.join(src_dir,"psycopg2.zip") @@ -215,6 +134,55 @@ psycopg2_src_path = os.path.join(psycopg2_base_path, os.listdir(psycopg2_base_path)[0]) shutil.copytree(os.path.join(psycopg2_src_path, 'psycopg2'), os.path.abspath(os.path.join(home_dir, 'Lib/site-packages', 'psycopg2'))) shutil.copy(os.path.join(psycopg2_src_path, 'psycopg2-2.0.14-py2.6.egg-info'), os.path.abspath(os.path.join(home_dir, 'Lib/site-packages', 'site-packages'))) + + +def install_mysql(option_str, extra_env, res_source_key, home_dir, lib_dir, tmp_dir, src_dir, res_env, logger, call_subprocess, filter_python_develop): + + args = [os.path.abspath(os.path.join(home_dir, 'bin', 'pip')), 'install', res_env.URLS['MYSQL'][res_source_key]] + if option_str : + args.insert(4,option_str) + call_subprocess(args, + cwd=os.path.abspath(tmp_dir), + filter_stdout=filter_python_develop, + show_stdout=True, + extra_env=extra_env) + + mysqlconfig_output = [] + + call_subprocess(['mysql_config', '--libmysqld-libs'], + cwd=os.path.abspath(tmp_dir), + filter_stdout=lambda line: mysqlconfig_output.append(line), + show_stdout=True) + + mysqlconfig_output = "".join(mysqlconfig_output) + m = re.search("\-L[\'\"]?([\w\/]+)[\'\"]?", mysqlconfig_output) + if m: + repdylibpath = m.group(1) + else: + repdylibpath = '/usr/local/mysql/lib' + + dyliblist = glob.glob(repdylibpath+"/libmysqlclient.*.dylib") + def key_func(s): + m = re.match(repdylibpath+"/libmysqlclient\.([\d]+)\.dylib", s) + if m: + return int(m.group(1)) + else: + return sys.maxint + dyliblist.sort(key=key_func) + + if dyliblist: + dylibpath = dyliblist[0] + else: + dylibpath = '/usr/local/mysql/lib/libmysqlclient.18.dylib' + + dylibname = os.path.basename(dylibpath) + sopath = os.path.join(os.path.abspath(lib_dir), 'site-packages', '_mysql.so') + + call_subprocess(['install_name_tool', '-change', dylibname, dylibpath, sopath], + cwd=os.path.abspath(tmp_dir), + filter_stdout=filter_python_develop, + show_stdout=True) + def gen_install_comp_lib(lib_name, lib_key, configure_options=[]): @@ -229,19 +197,19 @@ lib_src_path = os.path.join(lib_base_path, os.listdir(lib_base_path)[0]) - logger.notify("libjpeg configure") + logger.notify(libname + " configure") call_subprocess(['configure', '--prefix='+os.path.abspath(home_dir)] + configure_options, cwd=os.path.abspath(lib_src_path), filter_stdout=filter_python_develop, show_stdout=True) - logger.notify("libjpeg make") + logger.notify(libname + " make") call_subprocess(['make'], cwd=os.path.abspath(lib_src_path), filter_stdout=filter_python_develop, show_stdout=True) - logger.notify("zlib make install") + logger.notify(libname + "make install") call_subprocess(['make', 'install'], cwd=os.path.abspath(lib_src_path), filter_stdout=filter_python_develop, diff -r 0e91e924b945 -r aba6c30b6d2a virtualenv/res/src/MySQL-python-1.2.3.tar.gz Binary file virtualenv/res/src/MySQL-python-1.2.3.tar.gz has changed diff -r 0e91e924b945 -r aba6c30b6d2a virtualenv/res/src/MySQL-python-1.2.3.win-amd64-py2.7.exe Binary file virtualenv/res/src/MySQL-python-1.2.3.win-amd64-py2.7.exe has changed diff -r 0e91e924b945 -r aba6c30b6d2a virtualenv/res/src/MySQL-python-1.2.3.win32-py2.7.exe Binary file virtualenv/res/src/MySQL-python-1.2.3.win32-py2.7.exe has changed diff -r 0e91e924b945 -r aba6c30b6d2a virtualenv/web/create_python_env.py --- a/virtualenv/web/create_python_env.py Thu Aug 02 11:16:36 2012 +0200 +++ b/virtualenv/web/create_python_env.py Sun Aug 05 15:18:53 2012 +0200 @@ -13,6 +13,10 @@ - For Linux : python project-boot.py --unzip-setuptools --no-site-packages --index-url=http://pypi.websushi.org/ --clear --type-install=local +Probleme avec mysql : + +sudo install_name_tool -change libmysqlclient.18.dylib /usr/local/mysql/lib/libmysqlclient.18.dylib ~/dev/workspace/platform/virtualenv/web/env/venv_platform/lib/python2.7/site-packages/_mysql.so + """ import os diff -r 0e91e924b945 -r aba6c30b6d2a virtualenv/web/res/res_create_env.py --- a/virtualenv/web/res/res_create_env.py Thu Aug 02 11:16:36 2012 +0200 +++ b/virtualenv/web/res/res_create_env.py Sun Aug 05 15:18:53 2012 +0200 @@ -8,6 +8,7 @@ INSTALLS = [ #(key,method, option_str, dict_extra_env) 'LXML', 'PSYCOPG2', + 'MYSQL', 'SOUTH', 'PIL', 'DJANGO',