fix links to local files in editor
[redakcja.git] / apps / wiki / views.py
index 7a56106..1cee83a 100644 (file)
@@ -110,7 +110,8 @@ def editor(request, slug, chunk=None, template_name='wiki/bootstrap.html'):
         },
         'tags': list(save_form.fields['stage_completed'].choices),
         'can_pubmark': request.user.has_perm('catalogue.can_pubmark'),
-        'slug': chunk.book.slug
+        'slug': chunk.book.slug,
+        'gallery': chunk.book.gallery,
     })
 
 
@@ -233,7 +234,7 @@ def gallery(request, directory):
             return urllib.quote("%s/%s" % (base_url, smart_unicode(filename)))
 
         def is_image(filename):
-            return os.path.splitext(f)[1].lower() in (u'.jpg', u'.jpeg', u'.png')
+            return os.path.splitext(filename)[1].lower() in (u'.jpg', u'.jpeg', u'.png')
 
         images = [map_to_url(f) for f in map(smart_unicode, os.listdir(base_dir)) if is_image(f)]
         images.sort()