-       try : posOfPhoto = lightboxUids.index(photouid)
-       except ValueError : pass
-       options['backToContextUrl'] = '%s?b_start:int=%s' % (lightboxUrl, posOfPhoto/bsize*bsize)
-       relPhotoPath = '/'.join(photo.getPhysicalPath()[portalDepth:])
-       lastBcUrl = '%s/lightboxcontext/%s' % (lightboxUrl, relPhotoPath)
-       options['lastBcUrl'] = lastBcUrl
-       meth = getattr(photo, 'photo_view_ajax_template')
-       return meth(**options)
+    try : posOfPhoto = lightboxUids.index(photouid)
+    except ValueError : pass
+    options['backToContextUrl'] = '%s?b_start:int=%s' % (lightboxUrl, posOfPhoto/bsize*bsize)
+    relPhotoPath = '/'.join(photo.getPhysicalPath()[portalDepth:])
+    lastBcUrl = '%s/lightboxcontext/%s' % (lightboxUrl, relPhotoPath)
+    options['lastBcUrl'] = lastBcUrl
+    app = context.restrictedTraverse('/')
+    meth = app.restrictedTraverse(photo.getPhysicalPath() + ('photo_view_ajax_template',))
+    return meth(**options)