-
Notifications
You must be signed in to change notification settings - Fork 55
/
.pythonstartup.py
31 lines (24 loc) · 988 Bytes
/
.pythonstartup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import readline
import traceback
readline.parse_and_bind('tab: complete')
try:
import cherrypy
from uber.config import c
from uber.models import AdminAccount, Attendee, initialize_db, Session
initialize_db()
# Make it easier to do session stuff at the command line
session = Session().session
if c.DEV_BOX:
admin = session.query(AdminAccount).filter(
AdminAccount.attendee_id == Attendee.id,
Attendee.email == 'magfest@example.com'
).order_by(AdminAccount.id).first()
if admin:
# Make it easier to do site section testing at the command line
cherrypy.session = {'account_id': admin.id}
print('Logged in as {} <{}>'.format(admin.attendee.full_name, admin.attendee.email))
else:
print('INFO: Could not find Test Developer admin account')
except Exception as ex:
print('ERROR: Could not initialize ubersystem environment')
traceback.print_exc()