fixing html location and adding prints
authorBryan <btbonval@gmail.com>
Tue, 14 Jan 2014 09:01:07 +0000 (04:01 -0500)
committerBryan <btbonval@gmail.com>
Thu, 16 Jan 2014 01:30:33 +0000 (20:30 -0500)
karmaworld/apps/notes/management/commands/populate_s3.py

index 99741257a0881952adbc1c2f93210e944e23f258..f39b9ff027fe4a170aeba72d091bdadd0faf23e9 100644 (file)
@@ -22,6 +22,7 @@ class Command(BaseCommand):
         for note in Note.objects.iterator():
             if note.static_html:
                 # don't reprocess notes that are already on S3.
+                print "Skipping {0}".format(str(note))
                 continue
 
             filepath = note.get_relative_s3_path()
@@ -29,6 +30,7 @@ class Command(BaseCommand):
                 # HTML file is already uploaded if its slug is already there.
                 note.static_html = True
                 note.save()
+                print "Marking {0} as uploaded.".format(filepath)
                 continue
      
             # Copy pasta!
@@ -37,7 +39,7 @@ class Command(BaseCommand):
             # and some decent default settings chosen by django-storages.
     
             # S3 upload wants a file-like object.
-            htmlflo = StringIO(html)
+            htmlflo = StringIO(note.html)
             # Create the new key (key == filename in S3 bucket)
             newkey = default_storage.bucket.new(filepath)
             # Upload data!