def _db_documents_for(locale, topics=None, products=None):
 qs = Document.objects.filter(locale=locale, is_archived=False, current_revision__isnull=False, category__in=settings.IA_DEFAULT_CATEGORIES)
 for topic in (topics or []):
  qs = qs.filter(topics=topic)
 for product in (products or []):
  qs = qs.filter(products=product)
 doc_dicts = []
 for d in qs.distinct():
  doc_dicts.append(dict(id=d.id, document_title=d.title, url=d.get_absolute_url(), document_parent_id=d.parent_id, document_summary=d.current_revision.summary))
 return doc_dicts

def _db_documents_for ( locale , topics = None , products = None ) : qs = Document . objects . filter ( locale = locale , is_archived = False , current_revision__isnull = False , category__in = settings . IA_DEFAULT_CATEGORIES ) for topic in ( topics or [ ] ) : qs = qs . filter ( topics = topic ) for product in ( products or [ ] ) : qs = qs . filter ( products = product ) doc_dicts = [ ] for d in qs . distinct ( ) : doc_dicts . append ( dict ( id = d . id , document_title = d . title , url = d . get_absolute_url ( ) , document_parent_id = d . parent_id , document_summary = d . current_revision . summary ) ) return doc_dicts
db implementation of documents_for .