def get_zen_unitdata(translation, request):
 search_result = search(translation, request)
 try:
  offset = int(request.GET.get(u'offset', 0))
 except ValueError:
  offset = 0
 if isinstance(search_result, HttpResponse):
  return (search_result, None)
 search_result[u'last_section'] = ((offset + 20) >= len(search_result[u'ids']))
 search_result[u'offset'] = offset
 units = translation.unit_set.filter(pk__in=search_result[u'ids'][offset:(offset + 20)])
 unitdata = [{u'unit': unit, u'secondary': (unit.get_secondary_units(request.user) if (request.user.is_authenticated() and request.user.profile.secondary_in_zen) else None), u'form': TranslationForm(translation, unit, tabindex=(100 + (unit.position * 10))), u'offset': (offset + pos)} for (pos, unit) in enumerate(units)]
 return (search_result, unitdata)

def get_zen_unitdata ( translation , request ) : search_result = search ( translation , request ) try : offset = int ( request . GET . get ( u'offset' , 0 ) ) except ValueError : offset = 0 if isinstance ( search_result , HttpResponse ) : return ( search_result , None ) search_result [ u'last_section' ] = ( ( offset + 20 ) >= len ( search_result [ u'ids' ] ) ) search_result [ u'offset' ] = offset units = translation . unit_set . filter ( pk__in = search_result [ u'ids' ] [ offset : ( offset + 20 ) ] ) unitdata = [ { u'unit' : unit , u'secondary' : ( unit . get_secondary_units ( request . user ) if ( request . user . is_authenticated ( ) and request . user . profile . secondary_in_zen ) else None ) , u'form' : TranslationForm ( translation , unit , tabindex = ( 100 + ( unit . position * 10 ) ) ) , u'offset' : ( offset + pos ) } for ( pos , unit ) in enumerate ( units ) ] return ( search_result , unitdata )
loads unit data for zen mode .