def generate_views(action):
 view_id = (action.get('view_id') or False)
 if isinstance(view_id, (list, tuple)):
  view_id = view_id[0]
 view_modes = action['view_mode'].split(',')
 if (len(view_modes) > 1):
  if view_id:
   raise ValueError(('Non-db action dictionaries should provide either multiple view modes or a single view mode and an optional view id.\n\n Got view modes %r and view id %r for action %r' % (view_modes, view_id, action)))
  action['views'] = [(False, mode) for mode in view_modes]
  return
 action['views'] = [(view_id, view_modes[0])]

def generate_views ( action ) : view_id = ( action . get ( 'view_id' ) or False ) if isinstance ( view_id , ( list , tuple ) ) : view_id = view_id [ 0 ] view_modes = action [ 'view_mode' ] . split ( ',' ) if ( len ( view_modes ) > 1 ) : if view_id : raise ValueError ( ( 'Non-db action dictionaries should provide either multiple view modes or a single view mode and an optional view id.\n\n Got view modes %r and view id %r for action %r' % ( view_modes , view_id , action ) ) ) action [ 'views' ] = [ ( False , mode ) for mode in view_modes ] return action [ 'views' ] = [ ( view_id , view_modes [ 0 ] ) ]
while the server generates a sequence called "views" computing dependencies between a bunch of stuff for views coming directly from the database .