Skip to content
This repository has been archived by the owner on Sep 15, 2018. It is now read-only.

Adding code to get header #1

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions appmode/server_extension.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from notebook.base.handlers import IPythonHandler, FilesRedirectHandler, path_regex
import notebook.notebook.handlers as orig_handler
from tornado import web
import json

class AppmodeHandler(IPythonHandler):
#===========================================================================
Expand All @@ -17,6 +18,7 @@ def get(self, path):
user_name = path_split.pop(1)
# global environment variables are lazy but easiest way to pass username
os.environ['APPMODE_USER']=user_name
os.environ['APPMODE_SETTINGS'] = json.dumps(self.settings)
path = '/'.join(path_split)
path = path.strip('/')
self.log.info('Appmode get: %s', path)
Expand Down
3 changes: 2 additions & 1 deletion example_app.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
"outputs": [],
"source": [
"import os\n",
"USERNAME=os.environ.get('APPMODE_USER', 'Not logged in')"
"USERNAME=os.environ.get('APPMODE_USER', 'Not logged in')\n",
"print(os.environ.get('APPMODE_SETTINGS', ''), 'settings loaded')"
]
},
{
Expand Down