def publish_pages(include_unpublished=False, language=None, site=None):
 qs = Page.objects.drafts()
 if (not include_unpublished):
  qs = qs.filter(title_set__published=True).distinct()
 if site:
  qs = qs.filter(site=site)
 output_language = None
 for (i, page) in enumerate(qs):
  add = True
  titles = page.title_set
  if (not include_unpublished):
   titles = titles.filter(published=True)
  for lang in titles.values_list('language', flat=True):
   if ((language is None) or (lang == language)):
    if (not output_language):
     output_language = lang
    if (not page.publish(lang)):
     add = False
  activate(output_language)
  (yield (page, add))

def publish_pages ( include_unpublished = False , language = None , site = None ) : qs = Page . objects . drafts ( ) if ( not include_unpublished ) : qs = qs . filter ( title_set__published = True ) . distinct ( ) if site : qs = qs . filter ( site = site ) output_language = None for ( i , page ) in enumerate ( qs ) : add = True titles = page . title_set if ( not include_unpublished ) : titles = titles . filter ( published = True ) for lang in titles . values_list ( 'language' , flat = True ) : if ( ( language is None ) or ( lang == language ) ) : if ( not output_language ) : output_language = lang if ( not page . publish ( lang ) ) : add = False activate ( output_language ) ( yield ( page , add ) )
create published public version of selected drafts .