]> git.parisson.com Git - telemeta.git/commitdiff
clean collection copy method, timeside watermark
authoryomguy <yomguy@parisson.com>
Sat, 4 Jun 2011 12:35:10 +0000 (14:35 +0200)
committeryomguy <yomguy@parisson.com>
Sat, 4 Jun 2011 12:35:10 +0000 (14:35 +0200)
telemeta/web/base.py

index a82f42bdf151eedc91b2040a7c635369d51fa9f6..b744c83253d87a54b25c81a66a658d2b85cec303 100644 (file)
@@ -195,9 +195,8 @@ class WebView(object):
 
     @method_decorator(permission_required('telemeta.add_mediacollection'))
     def collection_copy(self, request, public_id, template='telemeta/collection_edit.html'):
-        collection = MediaCollection.objects.get(public_id=public_id)
-        new_collection = MediaCollection()
         if request.method == 'POST':
+            new_collection = MediaCollection()
             form = MediaCollectionForm(data=request.POST, files=request.FILES, instance=new_collection)
             if form.is_valid():
                 code = form.cleaned_data['code']
@@ -207,6 +206,7 @@ class WebView(object):
                 new_collection.set_revision(request.user)
                 return HttpResponseRedirect('/collections/'+code)
         else:
+            collection = MediaCollection.objects.get(public_id=public_id)
             form = MediaCollectionForm(instance=collection)
         
         return render(request, template, {'collection': collection, "form": form,})
@@ -473,7 +473,7 @@ class WebView(object):
                 graph = grapher(width = int(width), height = int(height))
                 pipe = decoder | graph
                 pipe.run()
-                graph.watermark('telemeta', opacity=.6, margin=(5,5))
+                graph.watermark('timeside', opacity=.6, margin=(5,5))
                 f = open(path, 'w')
                 graph.render(path)
                 f.close()