summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
8a52521)
Bugfix localisation / getattr.
selDict = req.SESSION.get('objects_selection_dict', {})
if traverse_subpath[-1] == 'photo_view_ajax' :
selDict = req.SESSION.get('objects_selection_dict', {})
if traverse_subpath[-1] == 'photo_view_ajax' :
- photoSubPath = traverse_subpath[:-1]
- ajax = True
+ photoSubPath = traverse_subpath[:-1]
+ ajax = True
- photoSubPath = traverse_subpath
- ajax = False
-
+ photoSubPath = traverse_subpath
+ ajax = False
+
photo = portal.restrictedTraverse(photoSubPath)
photouid = uidh.register(photo)
lightboxUids = context.getUidList()
if pptool :
photo = portal.restrictedTraverse(photoSubPath)
photouid = uidh.register(photo)
lightboxUids = context.getUidList()
if pptool :
- buyable = bool(pptool.getPrintingOptionsFor(photo))
- sd = context.session_data_manager.getSessionData(create=1)
- cart = sd.get('cart', None)
- if cart and cart.locked :
- buyable = False
+ buyable = bool(pptool.getPrintingOptionsFor(photo))
+ sd = context.session_data_manager.getSessionData(create=1)
+ cart = sd.get('cart', None)
+ if cart and cart.locked :
+ buyable = False
options['buyable'] = buyable
infos = []
posOfPhoto = 0
if ajax == True :
options['buyable'] = buyable
infos = []
posOfPhoto = 0
if ajax == True :
- 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)
for i, uid in enumerate(lightboxUids) :
for i, uid in enumerate(lightboxUids) :
- b = uidh.getBrain(uid)
- size = b.getThumbnailSize
- size = {'width':int(size['width']/2.0), 'height':int(size['height']/2.0)}
-
- className = selDict.has_key(uid) and 'selected' or ''
- if uid == photouid :
- className = ('%s displayed' % className).lstrip()
- posOfPhoto = i
-
- relPhotoPath = '/'.join(b.getPath().split('/')[portalDepth:])
- href = '%s/lightboxcontext/%s' % (lightboxUrl, relPhotoPath)
-
- d = {'src': '%s/getThumbnail' % b.getURL()
- ,'href': href
- ,'thumbSize': size
- ,'title' : b.Title
- ,'className': className
- , 'index': i
- }
- infos.append(d)
+ b = uidh.getBrain(uid)
+ size = b.getThumbnailSize
+ size = {'width':int(size['width']/2.0), 'height':int(size['height']/2.0)}
+
+ className = selDict.has_key(uid) and 'selected' or ''
+ if uid == photouid :
+ className = ('%s displayed' % className).lstrip()
+ posOfPhoto = i
+
+ relPhotoPath = '/'.join(b.getPath().split('/')[portalDepth:])
+ href = '%s/lightboxcontext/%s' % (lightboxUrl, relPhotoPath)
+
+ d = {'src': '%s/getThumbnail' % b.getURL()
+ ,'href': href
+ ,'thumbSize': size
+ ,'title' : b.Title
+ ,'className': className
+ , 'index': i
+ }
+ infos.append(d)
- previous = infos[posOfPhoto - 1]['href']
+ previous = infos[posOfPhoto - 1]['href']
- previous = infos[0]['href']
+ previous = infos[0]['href']
if posOfPhoto < len(infos) -1 :
if posOfPhoto < len(infos) -1 :
- next = infos[posOfPhoto + 1]['href']
+ next = infos[posOfPhoto + 1]['href']
- next = infos[-1]['href']
+ next = infos[-1]['href']
contextInfos = {'infos':infos,
contextInfos = {'infos':infos,
- 'isSelected': selDict.has_key(photouid),
- 'backUrl' : '%s?b_start:int=%s' % (lightboxUrl, posOfPhoto/bsize*bsize),
- 'index' : posOfPhoto,
- 'previous' : previous,
- 'next' : next,
- 'reBaseCtxUrl':'/^%s/' % ('%s/lightboxcontext/' % lightboxUrl).replace('/', '\/'),
- 'canonicalUrl': "'%s/'" % portal_url}
+ 'isSelected': selDict.has_key(photouid),
+ 'backUrl' : '%s?b_start:int=%s' % (lightboxUrl, posOfPhoto/bsize*bsize),
+ 'index' : posOfPhoto,
+ 'previous' : previous,
+ 'next' : next,
+ 'reBaseCtxUrl':'/^%s/' % ('%s/lightboxcontext/' % lightboxUrl).replace('/', '\/'),
+ 'canonicalUrl': "'%s/'" % portal_url}
options['contextInfos'] = contextInfos
# breadcrumbs customization
breadcrumbs = context.breadcrumbs()
breadcrumbs.append(
options['contextInfos'] = contextInfos
# breadcrumbs customization
breadcrumbs = context.breadcrumbs()
breadcrumbs.append(
- {'id' : photo.getId()
- ,'title' : photo.title_or_id()
- , 'url' : req.ACTUAL_URL}
+ {'id' : photo.getId()
+ ,'title' : photo.title_or_id()
+ , 'url' : req.ACTUAL_URL}
)
options['breadcrumbs'] = breadcrumbs
)
options['breadcrumbs'] = breadcrumbs
ti = photo.getTypeInfo()
method_id = ti.queryMethodID('view', context=photo)
ti = photo.getTypeInfo()
method_id = ti.queryMethodID('view', context=photo)
-meth = getattr(photo, method_id)
+app = context.restrictedTraverse('/')
+meth = app.restrictedTraverse(photo.getPhysicalPath() + (method_id,))
return meth(req, resp, **options)
return meth(req, resp, **options)