2 from Products
.CMFCore
.utils
import getToolByName
3 from Products
.CMFCore
.exceptions
import zExceptions_Unauthorized
4 uidh
= getToolByName(context
, 'portal_uidhandler')
8 for item
in context
.items
:
10 b
= uidh
.getBrain(item
['cmf_uid'])
11 except : # TODO: catch only UniqueIdError (not public yet:)
12 raise zExceptions_Unauthorized
13 size
= b
.getThumbnailSize
14 d
= {'thumbUrl' : '%s/getThumbnail' % b
.getURL()
15 ,'thumbHeight' : size
['height'] / 2
16 ,'thumbWidth' : size
['width'] / 2
17 ,'alt' : ('%s - %s' % (b
.Title
, b
.Description
)).strip(' -')
18 ,'title' : item
['title']
19 ,'description' : item
['description']
20 ,'unit_price' : item
['unit_price']
21 ,'quantity' : item
['quantity']
22 ,'total' : item
['unit_price'] * item
['quantity']
28 options
['infos'] = infos
29 if traverse_subpath
and traverse_subpath
[-1] == 'xml' :
30 channel_info
= {'title' :'Commande %s' % context
.getId()
31 ,'url' : context
.absolute_url()
32 ,'description' :'' # TODO mettre l'identification client
35 options
['channel_info'] = channel_info
36 options
['listItemInfos'] = infos
37 return context
.order_printing_list_template_xml(**options
)
39 return context
.order_printing_list_template(**options
)