Commits

Tay Ray Chuan  committed 1a53dca Merge

Merge in improvements to tax commands

This fixes #1154, as well as:

- add properties on the command implementations to make the tax
commands more helpful;
- check the arguments, as they require an argument to be passed (the
CSV file)

* rc-pvt/fix-sst_import_rate:
tax/us_sst/commands/*: check that <file> is passed
tax/us_sst/commands/*: add some info to commands
tax/us_sst/config: import config to prevent SettingNotSet error
tax/us_sst/commands/sst_import_boundry: strip trailing whitespace

  • Participants
  • Parent commits 115e630, 6efe3da

Comments (0)

Files changed (3)

File satchmo/apps/tax/modules/us_sst/config.py

 from django.utils.translation import ugettext_lazy as _
+
 from livesettings import *
+import tax.config
 
 TAX_MODULE = config_get('TAX', 'MODULE')
 TAX_MODULE.add_choice(('tax.modules.us_sst', _('USA: Streamlined Sales Tax')))

File satchmo/apps/tax/modules/us_sst/management/commands/sst_import_boundry.py

-from django.core.management.base import BaseCommand
+from django.core.management.base import BaseCommand, CommandError
 import os
 from datetime import date
 
     'lowAddress', 'highAddress', 'oddEven',
     'streetPreDirection', 'streetName', 'streetSuffix', 'streetPostDirection',
     'addressSecondaryAbbr', 'addressSecondaryLow', 'addressSecondaryHigh', 'addressSecondaryOddEven',
-    'cityName', 'zipCode', 'plus4', 
+    'cityName', 'zipCode', 'plus4',
     'zipCodeLow', 'zipExtensionLow', 'zipCodeHigh', 'zipExtensionHigh',
     'serCode',
     'fipsStateCode', 'fipsStateIndicator', 'fipsCountyCode', 'fipsPlaceCode', 'fipsPlaceType',
     their end dates set properly and the new rows inserted. You will need to do
     this quartly or as-needed by your tax jurisdictions.'''
 
+    help = "Imports a CSV boundary file from the SST website."
+    args = 'file'
 
     def handle(self, *args, **options):
         new = 0
         updated = 0
         unchanged = 0
         total = 0
+        if not args:
+            raise CommandError("No file specified")
         file = args[0]
         if not os.path.isfile(file):
             raise RuntimeError("File: %s is not a normal file or doesn't exist." % file)
 
             if total % 100 == 0:
                 print "%s," % total,
-                
+
             # Now, handle mapping boundries to rates.
             #extra = SER,state_providing,state_taxed,County,Place,Class,Long,Lat, (ST/VD,Special Code,Special Type,) x 20
             # IF SER, then the tax module should report all sales taxes by that SER code.

File satchmo/apps/tax/modules/us_sst/management/commands/sst_import_rate.py

-from django.core.management.base import BaseCommand
+from django.core.management.base import BaseCommand, CommandError
 import os
 from datetime import date
 from tax.modules.us_sst.models import TaxRate
     their end dates set properly and the new rows inserted. You will need to do
     this quartly or as-needed by your tax jurisdictions.'''
 
+    help = "Imports a CSV rate file from the SST website."
+    args = 'file'
+
     def handle(self, *args, **options):
         new = 0
         updated = 0
         unchanged = 0
+        if not args:
+            raise CommandError("No file specified")
         file = args[0]
         if not os.path.isfile(file):
             raise RuntimeError("File: %s is not a normal file or doesn't exist." % file)