Skip to content

Commit 4710613

Browse files
committed
add method for switching between prod and dev
1 parent 0013d78 commit 4710613

33 files changed

+317
-2
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ Network Trash Folder
4646
Temporary Items
4747
.apdisk
4848
secrets.py
49+
secretsProd.py
4950
*.pyc
5051
data/*
5152
!data/.keep
@@ -54,4 +55,4 @@ data/*
5455
*.json
5556
local/*
5657
*.xml
57-
*.xslx
58+
*.xslx

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ All of these scripts require a secrets.py file in the same directory that must c
88
user='[user name]'
99
password='[password]'
1010

11+
This secrets.py file will be ignored according to the repository's .gitignore file so that ArchivesSpace login details will not be inadvertently exposed through GitHub.
12+
13+
If you are using both a development server and a production server, you can create a separate secrets.py file with a different name (e.g. secretsProd.py) and containing the production server information. When running each of these scripts, you will be prompted to enter the file name (e.g 'secretsProd' without '.py') of an alternate secrets file. If you skip the prompt or incorrectly type the file name, the scripts will default to the information in the secrets.py file. This ensures that you will only access the production server if you really intend to.
14+
1115
## Scripts
1216

1317
#### [addBibNumbersAndPost.py](/addBibNumbersAndPost.py)

addBibNumbersAndPost.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,16 @@
55
import csv
66
from datetime import datetime
77

8+
secretsVersion = raw_input('To edit production server, enter the name of the secrets file: ')
9+
if secretsVersion != '':
10+
try:
11+
secrets = __import__(secretsVersion)
12+
print 'Editing Production'
13+
except ImportError:
14+
print 'Editing Development'
15+
else:
16+
print 'Editing Development'
17+
818
startTime = time.time()
919

1020
baseURL = secrets.baseURL

dateCheck.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,16 @@
44
import time
55
import csv
66

7+
secretsVersion = raw_input('To edit production server, enter the name of the secrets file: ')
8+
if secretsVersion != '':
9+
try:
10+
secrets = __import__(secretsVersion)
11+
print 'Editing Production'
12+
except ImportError:
13+
print 'Editing Development'
14+
else:
15+
print 'Editing Development'
16+
717
startTime = time.time()
818

919
baseURL = secrets.baseURL

getAccessionUDFs.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,16 @@
44
import time
55
import csv
66

7+
secretsVersion = raw_input('To edit production server, enter the name of the secrets file: ')
8+
if secretsVersion != '':
9+
try:
10+
secrets = __import__(secretsVersion)
11+
print 'Editing Production'
12+
except ImportError:
13+
print 'Editing Development'
14+
else:
15+
print 'Editing Development'
16+
717
startTime = time.time()
818

919
def findKey(d, key):

getAccessions.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,16 @@
33
import secrets
44
import time
55

6+
secretsVersion = raw_input('To edit production server, enter the name of the secrets file: ')
7+
if secretsVersion != '':
8+
try:
9+
secrets = __import__(secretsVersion)
10+
print 'Editing Production'
11+
except ImportError:
12+
print 'Editing Development'
13+
else:
14+
print 'Editing Development'
15+
616
startTime = time.time()
717

818
baseURL = secrets.baseURL

getAllArchivalObjectTitles.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,16 @@
44
import time
55
import csv
66

7+
secretsVersion = raw_input('To edit production server, enter the name of the secrets file: ')
8+
if secretsVersion != '':
9+
try:
10+
secrets = __import__(secretsVersion)
11+
print 'Editing Production'
12+
except ImportError:
13+
print 'Editing Development'
14+
else:
15+
print 'Editing Development'
16+
717
startTime = time.time()
818

919
baseURL = secrets.baseURL

getArchivalObjectCountByResource.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,16 @@
44
import time
55
import csv
66

7+
secretsVersion = raw_input('To edit production server, enter the name of the secrets file: ')
8+
if secretsVersion != '':
9+
try:
10+
secrets = __import__(secretsVersion)
11+
print 'Editing Production'
12+
except ImportError:
13+
print 'Editing Development'
14+
else:
15+
print 'Editing Development'
16+
717
startTime = time.time()
818

919
def findKey(d, key):

getArchivalObjectRefIdsForResource.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,16 @@
44
import time
55
import csv
66

7+
secretsVersion = raw_input('To edit production server, enter the name of the secrets file: ')
8+
if secretsVersion != '':
9+
try:
10+
secrets = __import__(secretsVersion)
11+
print 'Editing Production'
12+
except ImportError:
13+
print 'Editing Development'
14+
else:
15+
print 'Editing Development'
16+
717
startTime = time.time()
818

919
def findKey(d, key):

getArchivalObjectsByResource.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,16 @@
33
import secrets
44
import time
55

6+
secretsVersion = raw_input('To edit production server, enter the name of the secrets file: ')
7+
if secretsVersion != '':
8+
try:
9+
secrets = __import__(secretsVersion)
10+
print 'Editing Production'
11+
except ImportError:
12+
print 'Editing Development'
13+
else:
14+
print 'Editing Development'
15+
616
startTime = time.time()
717

818
def findKey(d, key):

0 commit comments

Comments
 (0)