correct virtualenv creation + addcommand to reinitialize front projects
authorymh <ymh.work@gmail.com>
Wed, 06 Jun 2012 22:07:15 +0200
changeset 652 cdbd6d1d8088
parent 651 fbc733e27f8b
child 653 dfdd945df4ae
correct virtualenv creation + addcommand to reinitialize front projects
.settings/org.eclipse.core.resources.prefs
src/ldt/ldt/management/commands/initfrontproject.py
src/ldt/ldt/security/__init__.py
src/ldt/ldt/user/migrations/0008_auto__chg_field_groupprofile_image__chg_field_groupprofile_group__chg_.py
src/ldt/ldt/user/migrations/0008_auto__chg_field_groupprofile_image__chg_field_groupprofile_group__chg_.py.old
src/ldt/ldt/user/models.py
virtualenv/res/lib/lib_create_env.py
virtualenv/res/src/django-piston-7c90898072ce-modifed.tar.gz
virtualenv/res/src/django-piston.tar.gz
virtualenv/web/res/res_create_env.py
--- a/.settings/org.eclipse.core.resources.prefs	Tue Jun 05 17:34:19 2012 +0200
+++ b/.settings/org.eclipse.core.resources.prefs	Wed Jun 06 22:07:15 2012 +0200
@@ -1,4 +1,3 @@
-#Thu Feb 09 19:01:11 CET 2012
 eclipse.preferences.version=1
 encoding//src/ldt/ldt/core/migrations/0001_initial.py=utf-8
 encoding//src/ldt/ldt/core/migrations/0002_auto__del_owner.py=utf-8
@@ -12,13 +11,10 @@
 encoding//src/ldt/ldt/ldt_utils/migrations/0010_auto__add_annotationstat.py=utf-8
 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/0016_one_to_one_stat_annotation.py=utf-8
 encoding//src/ldt/ldt/management/utils.py=utf-8
 encoding//src/ldt/ldt/text/migrations/0001_initial.py=utf-8
 encoding//src/ldt/ldt/user/migrations/0001_initial.py=utf-8
-encoding//src/ldt/ldt/user/migrations/0002_auto__del_irigroup.py=utf-8
-encoding//src/ldt/ldt/user/migrations/0004_fill_language.py=utf-8
-encoding//src/ldt/ldt/user/migrations/0005_add_permission_owner_group.py=utf-8
+encoding//src/ldt/ldt/user/migrations/0008_auto__chg_field_groupprofile_image__chg_field_groupprofile_group__chg_.py.old=utf-8
 encoding//virtualenv/web/env/guardianenv/Lib/site-packages/guardian/migrations/0001_initial.py=utf-8
 encoding//web/ldtplatform/config.py=utf-8
 encoding//web/ldtplatform/settings.py=utf-8
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/ldt/ldt/management/commands/initfrontproject.py	Wed Jun 06 22:07:15 2012 +0200
@@ -0,0 +1,46 @@
+from django.core.management.base import LabelCommand, CommandError
+from ldt.ldt_utils.models import Content
+from optparse import make_option
+from django.db import transaction
+
+class Command(LabelCommand):
+    help = 'init front project for content'    
+    option_list = LabelCommand.option_list + (
+        make_option('--noinput', action='store_false', dest='interactive', default=True,
+            help='Tells to NOT prompt the user for input of any kind.'),
+        make_option('--all-yes', action='store_true', dest='allyes',
+            default=False, help='Answer yes to all question'),
+    )
+
+    def handle_label(self, label, **options):
+        
+        interactive = options.get('interactive')
+        allyes = options.get('allyes')
+            
+        try:   
+            content = Content.objects.get_by_natural_key(label)
+        except Content.DoesNotExist:
+            raise CommandError("Content \"%s\" does not exists." % label)
+        
+        if content is None:
+            raise CommandError("Content \"%s\" does not exists." % label)
+
+        do_delete = allyes
+        if interactive and (not do_delete) and content.front_project is not None:
+            confirm = raw_input("""The content already has a front project. Do you want to delete it ?
+
+    Type 'yes' to delete, or 'no' to keep: """)
+            do_delete = (confirm == "yes")
+        
+        with transaction.commit_on_success():        
+            if do_delete:
+                fp = content.front_project
+                content.front_project = None
+                content.save()
+                fp.contents.clear()
+                fp.delete()
+            
+            content.create_front_project()
+            self.stdout.write('Successfully created front project for content "%s"' % label)
+        
+    
\ No newline at end of file
--- a/src/ldt/ldt/security/__init__.py	Tue Jun 05 17:34:19 2012 +0200
+++ b/src/ldt/ldt/security/__init__.py	Wed Jun 06 22:07:15 2012 +0200
@@ -40,7 +40,7 @@
     current = get_current_user()
     if current:
         return current
-    admin = User.objects.filter(is_superuse=True)[0]
+    admin = User.objects.filter(is_superuser=True)[0]
     return admin
 
 def protect_models():
--- a/src/ldt/ldt/user/migrations/0008_auto__chg_field_groupprofile_image__chg_field_groupprofile_group__chg_.py	Tue Jun 05 17:34:19 2012 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,85 +0,0 @@
-#@PydevCodeAnalysisIgnore
-# encoding: utf-8
-import datetime
-from south.db import db
-from south.v2 import SchemaMigration
-from django.db import models
-
-class Migration(SchemaMigration):
-
-    def forwards(self, orm):
-        
-        # Changing field 'GroupProfile.image'
-        db.alter_column('user_groupprofile', 'image', self.gf('sorl.thumbnail.fields.ImageField')(max_length=200))
-
-        # Changing field 'UserProfile.image'
-        db.alter_column('user_userprofile', 'image', self.gf('sorl.thumbnail.fields.ImageField')(max_length=200))
-
-
-    def backwards(self, orm):
-        
-        # Changing field 'GroupProfile.image'
-        db.alter_column('user_groupprofile', 'image', self.gf('sorl.thumbnail.fields.ImageField')(max_length=100))
-
-        # Changing field 'UserProfile.image'
-        db.alter_column('user_userprofile', 'image', self.gf('sorl.thumbnail.fields.ImageField')(max_length=100))
-
-
-    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'})
-        },
-        'user.groupprofile': {
-            'Meta': {'object_name': 'GroupProfile'},
-            'description': ('django.db.models.fields.TextField', [], {}),
-            'group': ('django.db.models.fields.related.OneToOneField', [], {'related_name': "'profile'", 'unique': 'True', 'to': "orm['auth.Group']"}),
-            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
-            'image': ('sorl.thumbnail.fields.ImageField', [], {'default': "'thumbnails/groups/group_default_icon.png'", 'max_length': '200'})
-        },
-        'user.ldt': {
-            'Meta': {'object_name': 'Ldt', '_ormbases': ['auth.User']},
-            'user_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['auth.User']", 'unique': 'True', 'primary_key': 'True'})
-        },
-        'user.userprofile': {
-            'Meta': {'object_name': 'UserProfile'},
-            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
-            'image': ('sorl.thumbnail.fields.ImageField', [], {'default': "'thumbnails/users/user_default_icon.png'", 'max_length': '200'}),
-            'language': ('django.db.models.fields.CharField', [], {'default': "'fr'", 'max_length': '2'}),
-            'user': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['auth.User']", 'unique': 'True'})
-        }
-    }
-
-    complete_apps = ['user']
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/ldt/ldt/user/migrations/0008_auto__chg_field_groupprofile_image__chg_field_groupprofile_group__chg_.py.old	Wed Jun 06 22:07:15 2012 +0200
@@ -0,0 +1,85 @@
+#@PydevCodeAnalysisIgnore
+# encoding: utf-8
+import datetime
+from south.db import db
+from south.v2 import SchemaMigration
+from django.db import models
+
+class Migration(SchemaMigration):
+
+    def forwards(self, orm):
+        
+        # Changing field 'GroupProfile.image'
+        db.alter_column('user_groupprofile', 'image', self.gf('sorl.thumbnail.fields.ImageField')(max_length=200))
+
+        # Changing field 'UserProfile.image'
+        db.alter_column('user_userprofile', 'image', self.gf('sorl.thumbnail.fields.ImageField')(max_length=200))
+
+
+    def backwards(self, orm):
+        
+        # Changing field 'GroupProfile.image'
+        db.alter_column('user_groupprofile', 'image', self.gf('sorl.thumbnail.fields.ImageField')(max_length=100))
+
+        # Changing field 'UserProfile.image'
+        db.alter_column('user_userprofile', 'image', self.gf('sorl.thumbnail.fields.ImageField')(max_length=100))
+
+
+    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'})
+        },
+        'user.groupprofile': {
+            'Meta': {'object_name': 'GroupProfile'},
+            'description': ('django.db.models.fields.TextField', [], {}),
+            'group': ('django.db.models.fields.related.OneToOneField', [], {'related_name': "'profile'", 'unique': 'True', 'to': "orm['auth.Group']"}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'image': ('sorl.thumbnail.fields.ImageField', [], {'default': "'thumbnails/groups/group_default_icon.png'", 'max_length': '200'})
+        },
+        'user.ldt': {
+            'Meta': {'object_name': 'Ldt', '_ormbases': ['auth.User']},
+            'user_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['auth.User']", 'unique': 'True', 'primary_key': 'True'})
+        },
+        'user.userprofile': {
+            'Meta': {'object_name': 'UserProfile'},
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'image': ('sorl.thumbnail.fields.ImageField', [], {'default': "'thumbnails/users/user_default_icon.png'", 'max_length': '200'}),
+            'language': ('django.db.models.fields.CharField', [], {'default': "'fr'", 'max_length': '2'}),
+            'user': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['auth.User']", 'unique': 'True'})
+        }
+    }
+
+    complete_apps = ['user']
--- a/src/ldt/ldt/user/models.py	Tue Jun 05 17:34:19 2012 +0200
+++ b/src/ldt/ldt/user/models.py	Wed Jun 06 22:07:15 2012 +0200
@@ -41,7 +41,7 @@
     def create_user_profile(sender, instance, created, **kwargs):
         if created:
             UserProfile.objects.create(user=instance)
-            everyone = Group.objects.get(name=settings.PUBLIC_GROUP_NAME)
+            everyone, _ = Group.objects.get_or_create(name=settings.PUBLIC_GROUP_NAME)
             instance.groups.add(everyone)
 
 class GroupProfile(models.Model):
--- a/virtualenv/res/lib/lib_create_env.py	Tue Jun 05 17:34:19 2012 +0200
+++ b/virtualenv/res/lib/lib_create_env.py	Wed Jun 06 22:07:15 2012 +0200
@@ -19,7 +19,7 @@
     'DJANGO-EXTENSIONS': { 'setup': 'django-extensions', 'url':'https://github.com/django-extensions/django-extensions/tarball/0.8', 'local':"django-extensions-0.8.tar.gz"},
     'DJANGO-REGISTRATION': { 'setup': 'django-registration', 'url':'https://bitbucket.org/ubernostrum/django-registration/get/v0.8.tar.gz', 'local':"django-registration-0.8.tar.gz"},
     'DJANGO-TAGGING': { 'setup': 'django-tagging', 'url':'http://django-tagging.googlecode.com/files/django-tagging-0.3.1.tar.gz', 'local':"django-tagging-0.3.1.tar.gz"},
-    'DJANGO-PISTON': { 'setup': 'django-piston', 'url':"https://bitbucket.org/jespern/django-piston/get/default.tar.gz", 'local':"django-piston.tar.gz"},
+    'DJANGO-PISTON': { 'setup': 'django-piston', 'url':'django-piston-7c90898072ce-modifed.tar.gz', 'local':'django-piston-7c90898072ce-modifed.tar.gz'},
     'OAUTH2': { 'setup': 'python-oauth2', 'url':"https://github.com/simplegeo/python-oauth2/tarball/hudson-python-oauth2-211", 'local':"oauth2-1.5.211.tar.gz"},
     '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"},
     'DJANGO-OAUTH-PLUS': { 'setup': 'django-oauth-plus', 'url':'http://bitbucket.org/david/django-oauth-plus/get/f314f018e473.gz', 'local':"django-oauth-plus.tar.gz"},
Binary file virtualenv/res/src/django-piston-7c90898072ce-modifed.tar.gz has changed
Binary file virtualenv/res/src/django-piston.tar.gz has changed
--- a/virtualenv/web/res/res_create_env.py	Tue Jun 05 17:34:19 2012 +0200
+++ b/virtualenv/web/res/res_create_env.py	Wed Jun 06 22:07:15 2012 +0200
@@ -28,7 +28,7 @@
     ('DJANGO-EXTENSIONS', 'pip', None, None),
     ('DJANGO-REGISTRATION', 'easy_install', '-Z', None),
     ('DJANGO-TAGGING', 'pip', None, None),
-    ('DJANGO-PISTON', 'pip', None, None),
+    ('DJANGO-PISTON', 'easy_install', None, None),
     ('HTTPLIB2', 'pip', None, None),
     ('OAUTH2', 'easy_install', None, None),
     ('DJANGO-OAUTH-PLUS', 'pip', None, None),