def installdefaultpaths(): # default paths # First remove all existing data Path.objects.all().delete() # create dictionaries for zone dct = { 'path_reception':'/ESSArch/reception', 'path_gate':'/ESSArch/exchange', 'path_work':'/ESSArch/work', 'path_control':'/ESSArch/control', 'path_ingest':'/ESSArch/ingest', 'path_mimetypesdefinition':'/ESSArch/Tools/env/data', } # create according to model with two fields for key in dct : print >> sys.stderr, "**", key try: le = Path( entity=key, value=dct[key] ) le.save() except: pass return 0
def installdefaultpaths(): # default paths # First remove all existing data Path.objects.all().delete() # create dictionaries for zone dct = { #'path_reception':'/data/mottak', 'path_reception':'/mottak', 'path_gate':'/data/ioessarch/', 'path_work':'/data/test', #'path_control':'/data/control', 'path_control':'/kontroll', 'path_ingest':'/data/ingest', 'path_mimetypesdefinition':'/ESSArch/Tools/env/data', } # create according to model with two fields for key in dct : print >> sys.stderr, "**", key try: le = Path( entity=key, value=dct[key] ) le.save() except: pass return 0
def installdefaultpaths(request): # default paths # First remove all existing data Path.objects.all().delete() # find out which zone zone = Parameter.objects.get(entity="zone").value # create dictionaries for zone dct = {} dct1 = { 'path_prepare': '/ESSArch/prepare', 'path_delivery': '/ESSArch/delivery', 'path_expedition': '/ESSArch/expedition', } dct2 = { 'path_expedition': '/ESSArch/expedition', 'path_gate': '/ESSArch/ioessarch', } dct3 = { 'path_reception': '/ESSArch/reception', 'path_gate': '/ESSArch/ioessarch', 'path_work': '/ESSArch/work', 'path_control': '/ESSArch/control', } dctc = { 'path_mimetypesdefinition': '/ESSArch/Tools/env/data', } # set default logevents according to zone if zone == "zone1": dct.update(dct1) dct.update(dctc) if zone == "zone2": dct.update(dct2) dct.update(dctc) if zone == "zone3": dct.update(dct3) dct.update(dctc) if zone == "all": dct.update(dct1) dct.update(dct2) dct.update(dct3) dct.update(dctc) # if zone is incorrect if dct is None: return HttpResponseRedirect('/admin/configuration') # create according to model with two fields for key in dct: print >> sys.stderr, "**", key try: le = Path(entity=key, value=dct[key]) le.save() except: pass return HttpResponseRedirect('/admin/configuration')
def installdefaultpaths(request): # default paths # First remove all existing data Path.objects.all().delete() # find out which zone zone = Parameter.objects.get(entity="zone").value # create dictionaries for zone dct = {} dct1 = { 'path_prepare':'/ESSArch/prepare', 'path_delivery':'/ESSArch/delivery', 'path_expedition':'/ESSArch/expedition', } dct2 = { 'path_expedition':'/ESSArch/expedition', 'path_gate':'/ESSArch/ioessarch', } dct3 = { 'path_reception':'/ESSArch/reception', 'path_gate':'/ESSArch/ioessarch', 'path_work':'/ESSArch/work', 'path_control':'/ESSArch/control', } dctc = { 'path_mimetypesdefinition':'/ESSArch/Tools/env/data', } # set default logevents according to zone if zone == "zone1" : dct.update(dct1) dct.update(dctc) if zone == "zone2" : dct.update(dct2) dct.update(dctc) if zone == "zone3" : dct.update(dct3) dct.update(dctc) if zone == "all" : dct.update(dct1) dct.update(dct2) dct.update(dct3) dct.update(dctc) # if zone is incorrect if dct is None: return HttpResponseRedirect( '/admin/configuration' ) # create according to model with two fields for key in dct : print >> sys.stderr, "**", key try: le = Path( entity=key, value=dct[key] ) le.save() except: pass return HttpResponseRedirect( '/admin/configuration' )
def installdefaultpaths(): # default paths # First remove all existing data Path.objects.all().delete() # create dictionaries for different sites #if install_site == 'ESSArch_RA-OSLO': # dct = { # #'path_reception':'/data/mottak', # 'path_reception':'/mottak', # 'path_gate':'/data/ioessarch/', # 'path_work':'/data/test', # 'path_control':'/kontroll', # 'path_ingest':'/data/ingest', # 'TmpWorkarea_upload_path':'/ESSArch/data/epp/temp', # } #else: dct = { 'path_mimetypes_definitionfile':'/ESSArch/config/mime.types', 'path_reception':'/ESSArch/data/eta/reception/eft', 'path_gate':'/ESSArch/data/gate', 'path_gate_reception':'/ESSArch/data/gate/reception', 'path_work':'/ESSArch/data/epp/work', 'path_control':'/ESSArch/data/epp/control', 'path_ingest':'/ESSArch/data/epp/ingest', 'TmpWorkarea_upload_path':'/ESSArch/data/epp/temp', } # create according to model with two fields for key in dct : print >> sys.stderr, "**", key try: le = Path( entity=key, value=dct[key] ) le.save() except: pass return 0