@@ -0,0 +1,1294 @@
+from optparse import make_option%0A%0Afrom django.core.management.base import NoArgsCommand%0Afrom django.db.models import Max%0A%0Afrom knesset.simple.management.commands import parse_laws%0Afrom knesset.laws.models import GovProposal%0A%0Adef parse_gov_laws(use_last_booklet):%0A    booklet = 0%0A    if use_last_booklet:%0A        booklet = GovProposal.objects.aggregate(Max('booklet_number')).values()%5B0%5D%0A    parser = parse_laws.ParseGovLaws(booklet)%0A    parser.parse_gov_laws()%0A%0Aclass Command(NoArgsCommand):%0A    option_list = NoArgsCommand.option_list + (%0A        make_option('--forceupdate', action='store_true', dest='forceupdate',%0A            help=%22forced update for gov bills, will download all pdfs and update Bills%22),%0A        make_option('--pdf', action='store', dest='pdf', default=None,%0A            help=%22forced update for gov bills, will download all pdfs and update Bills%22),)%0A%0A    help = %22Give information on government bills (pdfs)%22%0A%0A    def handle_noargs(self, **options):%0A        forceupdate = options.get('forceupdate', False)%0A        pdf = options.get('pdf')%0A        if pdf:%0A            parse_laws.ParseGovLaws(0).update_single_bill(pdf)%0A            print %22updated: %25s%22 %25 GovProposal.objects.filter(source_url=pdf)%5B0%5D.get_absolute_url()%0A        else:%0A            parse_gov_laws(not forceupdate)%0A

add gov_bills command