2 from Products
.CMFCore
.utils
import getToolByName
3 from Products
.CMFCore
.permissions
import ModifyPortalContent
4 from Products
.Plinn
.utils
import getAdapterByInterface
, translate
5 def _(message
) : return translate(message
, context
).encode('utf-8')
6 mtool
= getToolByName(context
, 'portal_membership')
12 req
.other
['syncFragments'] = ['Breadcrumbs']
16 history
= getAdapterByInterface(context
, 'Products.Plinn.interfaces.IContentHistory', None)
17 key
= traverse_subpath
[0]
19 rev
, revCtx
= history
.getHistoricalRevisionByKey(key
, withContext
=form
['pos'])
20 ctxOptions
['rev'] = rev
21 ctxOptions
['currentOb'] = context
22 ctxOptions
['pos'] = pos
23 ctxOptions
['revCtx'] = revCtx
24 userName
= revCtx
['current']['user_name']
26 userId
= userName
.split()[-1]
27 memberFullName
= mtool
.getMemberFullNameById(userId
, nameBefore
=False)
29 memberFullName
= _('nobody')
30 ctxOptions
['ctUser'] = memberFullName
31 ctxOptions
['ctTime'] = revCtx
['current']['time'].strftime(_('%Y/%m/%d at %I:%M:%S %p'))
32 ctxOptions
['restorationAllowed'] = mtool
.checkPermission(ModifyPortalContent
, context
)
33 options
['specialCtxHeader'] = context
.revision_context_header(**ctxOptions
).encode('utf-8')
35 breadcrumbs
= context
.breadcrumbs()
38 ,'title' : _('state of %s') % revCtx
['current']['time'].strftime(_('%Y/%m/%d at %I:%M:%S %p'))
39 , 'url' : '%s?pos:int=%d' % (req
.ACTUAL_URL
, pos
)}
42 options
['breadcrumbs'] = breadcrumbs
44 ti
= context
.getTypeInfo()
45 method_id
= ti
.queryMethodID('view', context
=context
)
46 meth
= getattr(rev
, method_id
)
47 return meth(**options
)