changeset 27:e5336ec2ee02

make sequence template better and more error resistant
author Jeff Hammel <jhammel@mozilla.com>
date Sun, 30 Oct 2011 14:45:35 -0700
parents ee74cf1e444b
children 2df31d088583
files montage/templates/sequence.html setup.py
diffstat 2 files changed, 9 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/montage/templates/sequence.html	Wed Oct 27 09:48:04 2010 -0700
+++ b/montage/templates/sequence.html	Sun Oct 30 14:45:35 2011 -0700
@@ -11,7 +11,7 @@
     <xi:include py:if="include" href="${include}"/>
 
     <center py:if="files" py:with="index = int(request.GET.get('index', 0))">
-      <div py:with="image = files[index]" class="image">
+      <div py:if="index in range(len(files))" py:with="image = files[index]" class="image">
         <a name="${image['path']}"></a>
         <a href="${image['link']}">
           <img src="${image['path']}" width="${width or None}" height="${height or None}"/>
@@ -19,14 +19,15 @@
         <br/>
         ${image.get('title', image['description'])}
       </div>
-      <py:if test="index &gt; 0">
-	<a href="?index=${index - 1}"
-	   py:with="image=files[index - 1]">
-	  ${image.get("title", image.get("description", "&raquo;&raquo;"))}
+      <py:if test="(index - 1) in range(len(files))">
+	<a href="?index=${index - 1}" py:with="image=files[index - 1]">
+	  ${image.get('title') or image.get('description') or '&laquo;&laquo;'}
 	</a>
       </py:if>
-      <py:if test="index &lt; len(files)">
-	<a href="?index=${index + 1}" py:with="image=files[index + 1]">${image.get('title', image.get('description', '&laquo;&laquo;'))}</a>
+      <py:if test="(index + 1) in range(len(files))">
+	<a href="?index=${index + 1}" py:with="image=files[index + 1]">
+          ${image.get('title') or image.get('description') or '&raquo;&raquo;'}
+        </a>
       </py:if>
     </center>
 
--- a/setup.py	Wed Oct 27 09:48:04 2010 -0700
+++ b/setup.py	Sun Oct 30 14:45:35 2011 -0700
@@ -1,7 +1,7 @@
 import os
 from setuptools import setup, find_packages
 
-version = '0.3.1'
+version = '0.3.2'
 
 try:
     description = file(os.path.join(os.path.dirname(__file__), 'README.txt')).read()