def _list_designs(user, querydict, page_size, prefix='', is_trashed=False):
 DEFAULT_SORT = ('-', 'date')
 SORT_ATTR_TRANSLATION = dict(date='last_modified', name='name', desc='description', type='extra')
 if is_trashed:
  db_queryset = Document.objects.trashed_docs(SavedQuery, user)
 else:
  db_queryset = Document.objects.available_docs(SavedQuery, user)
 filter_username = querydict.get((prefix + 'user'))
 if filter_username:
  try:
   db_queryset = db_queryset.filter(owner=User.objects.get(username=filter_username))
  except User.DoesNotExist:
   pass
 d_type = querydict.get((prefix + 'type'))
 if (d_type and (d_type in SavedQuery.TYPES_MAPPING.keys())):
  db_queryset = db_queryset.filter(extra=str(SavedQuery.TYPES_MAPPING[d_type]))
 frag = querydict.get((prefix + 'text'))
 if frag:
  db_queryset = db_queryset.filter((Q(name__icontains=frag) | Q(description__icontains=frag)))
 sort_key = querydict.get((prefix + 'sort'))
 if sort_key:
  if (sort_key[0] == '-'):
   (sort_dir, sort_attr) = ('-', sort_key[1:])
  else:
   (sort_dir, sort_attr) = ('', sort_key)
  if (not SORT_ATTR_TRANSLATION.has_key(sort_attr)):
   LOG.warn(('Bad parameter to list_designs: sort=%s' % (sort_key,)))
   (sort_dir, sort_attr) = DEFAULT_SORT
 else:
  (sort_dir, sort_attr) = DEFAULT_SORT
 db_queryset = db_queryset.order_by((sort_dir + SORT_ATTR_TRANSLATION[sort_attr]))
 designs = [job.content_object for job in db_queryset.all() if (job.content_object and (job.content_object.is_auto == False))]
 pagenum = int(querydict.get((prefix + 'page'), 1))
 paginator = Paginator(designs, page_size)
 page = paginator.page(pagenum)
 keys_to_copy = [(prefix + key) for key in ('user', 'type', 'sort', 'text')]
 filter_params = copy_query_dict(querydict, keys_to_copy)
 return (page, filter_params)

def _list_designs ( user , querydict , page_size , prefix = '' , is_trashed = False ) : DEFAULT_SORT = ( '-' , 'date' ) SORT_ATTR_TRANSLATION = dict ( date = 'last_modified' , name = 'name' , desc = 'description' , type = 'extra' ) if is_trashed : db_queryset = Document . objects . trashed_docs ( SavedQuery , user ) else : db_queryset = Document . objects . available_docs ( SavedQuery , user ) filter_username = querydict . get ( ( prefix + 'user' ) ) if filter_username : try : db_queryset = db_queryset . filter ( owner = User . objects . get ( username = filter_username ) ) except User . DoesNotExist : pass d_type = querydict . get ( ( prefix + 'type' ) ) if ( d_type and ( d_type in SavedQuery . TYPES_MAPPING . keys ( ) ) ) : db_queryset = db_queryset . filter ( extra = str ( SavedQuery . TYPES_MAPPING [ d_type ] ) ) frag = querydict . get ( ( prefix + 'text' ) ) if frag : db_queryset = db_queryset . filter ( ( Q ( name__icontains = frag ) | Q ( description__icontains = frag ) ) ) sort_key = querydict . get ( ( prefix + 'sort' ) ) if sort_key : if ( sort_key [ 0 ] == '-' ) : ( sort_dir , sort_attr ) = ( '-' , sort_key [ 1 : ] ) else : ( sort_dir , sort_attr ) = ( '' , sort_key ) if ( not SORT_ATTR_TRANSLATION . has_key ( sort_attr ) ) : LOG . warn ( ( 'Bad parameter to list_designs: sort=%s' % ( sort_key , ) ) ) ( sort_dir , sort_attr ) = DEFAULT_SORT else : ( sort_dir , sort_attr ) = DEFAULT_SORT db_queryset = db_queryset . order_by ( ( sort_dir + SORT_ATTR_TRANSLATION [ sort_attr ] ) ) designs = [ job . content_object for job in db_queryset . all ( ) if ( job . content_object and ( job . content_object . is_auto == False ) ) ] pagenum = int ( querydict . get ( ( prefix + 'page' ) , 1 ) ) paginator = Paginator ( designs , page_size ) page = paginator . page ( pagenum ) keys_to_copy = [ ( prefix + key ) for key in ( 'user' , 'type' , 'sort' , 'text' ) ] filter_params = copy_query_dict ( querydict , keys_to_copy ) return ( page , filter_params )
fetch all workflow designs .