from daisyproducer.dictionary.brailleTables import writeWhiteListTables, writeLocalTables
from daisyproducer.dictionary.models import Word
from daisyproducer.documents.models import Document
from django.core.management.base import BaseCommand

class Command(BaseCommand):
    args = ''
    help = 'Write Liblouis tables from the confirmed words in the dictionary'

    def handle(self, *args, **options):
        # write new global white lists
        if options['verbosity'] >= 2:
            self.stderr.write('Writing new global white lists...\n')
        writeWhiteListTables(Word.objects.filter(isConfirmed=True).filter(isLocal=False).order_by('untranslated'))
        # update local tables
        if options['verbosity'] >= 2:
            self.stderr.write('Updating local tables...\n')
        writeLocalTables(Document.objects.all())

@@ -437,35 +437,48 @@
 e lists%0A        
-if 
+verbosity = int(
 options%5B'verbosi
@@ -473,32 +473,54 @@
 ons%5B'verbosity'%5D
+)%0A        if verbosity
  %3E= 2:%0A         
@@ -735,25 +735,16 @@
      if 
-options%5B'
 verbosit
@@ -744,18 +744,16 @@
 erbosity
-'%5D
  %3E= 2:%0A 

Make sure the verbosity stuff actually works