<s> import datetime <EOL> import os <EOL> import sys <EOL> from optparse import make_option <EOL> from django . core . management . base import BaseCommand <EOL> from django . conf import settings <EOL> try : <EOL> from django . contrib . gis . utils import LayerMapping <EOL> except ImportError : <EOL> print ( "<STR_LIT>" ) <EOL> sys . exit ( <NUM_LIT:1> ) <EOL> from tigerline . models import State <EOL> def state_import ( state_shp ) : <EOL> if '<STR_LIT>' in state_shp or '<STR_LIT>' in state_shp or '<STR_LIT>' in state_shp or '<STR_LIT>' in state_shp or '<STR_LIT>' in state_shp : <EOL> state_mapping = { <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT:name>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> } <EOL> else : <EOL> state_mapping = { <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT:name>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> } <EOL> lm = LayerMapping ( State , state_shp , state_mapping ) <EOL> lm . save ( verbose = True ) <EOL> class Command ( BaseCommand ) : <EOL> option_list = BaseCommand . option_list + ( <EOL> make_option ( '<STR_LIT>' , default = '<STR_LIT>' , dest = '<STR_LIT:path>' , <EOL> help = '<STR_LIT>' ) , <EOL> ) <EOL> help = '<STR_LIT>' <EOL> def handle ( self , * args , ** kwargs ) : <EOL> path = kwargs [ '<STR_LIT:path>' ] <EOL> settings . DEBUG = False <EOL> if os . path . exists ( os . path . join ( path , '<STR_LIT>' ) ) : <EOL> print ( '<STR_LIT>' ) <EOL> path = os . path . join ( path , '<STR_LIT>' ) <EOL> elif os . path . exists ( os . path . join ( path , '<STR_LIT>' ) ) : <EOL> print ( '<STR_LIT>' ) <EOL> path = os . path . join ( path , '<STR_LIT>' ) <EOL> elif os . path . exists ( os . path . join ( path , '<STR_LIT>' ) ) : <EOL> print ( '<STR_LIT>' ) <EOL> path = os . path . join ( path , '<STR_LIT>' ) <EOL> elif os . path . exists ( os . path . join ( path , '<STR_LIT>' ) ) : <EOL> print ( '<STR_LIT>' ) <EOL> path = os . path . join ( path , '<STR_LIT>' ) <EOL> elif os . path . exists ( os . path . join ( path , '<STR_LIT>' ) ) : <EOL> print ( '<STR_LIT>' ) <EOL> path = os . path . join ( path , '<STR_LIT>' ) <EOL> elif os . path . exists ( os . path . join ( path , '<STR_LIT>' ) ) : <EOL> print ( '<STR_LIT>' ) <EOL> path = os . path . join ( path , '<STR_LIT>' ) <EOL> else : <EOL> print ( '<STR_LIT>' ) <EOL> exit ( ) <EOL> print ( "<STR_LIT>" % datetime . datetime . now ( ) ) <EOL> if path : <EOL> state_import ( path ) <EOL> print ( "<STR_LIT>" % datetime . datetime . now ( ) ) </s>
