Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
slapos
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
francois
slapos
Commits
7bd79e3d
Commit
7bd79e3d
authored
Jun 05, 2015
by
Ayush Tiwari
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Removed hardcoded url for ERP5Kernel jinja file and moved to the instance file
parent
d21fc169
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
10 deletions
+15
-10
software/ipython_notebook/instance.cfg
software/ipython_notebook/instance.cfg
+2
-0
software/ipython_notebook/software.cfg
software/ipython_notebook/software.cfg
+1
-1
software/ipython_notebook/template/ERP5kernel.py.jinja
software/ipython_notebook/template/ERP5kernel.py.jinja
+12
-9
No files found.
software/ipython_notebook/instance.cfg
View file @
7bd79e3d
...
@@ -133,9 +133,11 @@ monitor_url = $${monitor-parameters:url}
...
@@ -133,9 +133,11 @@ monitor_url = $${monitor-parameters:url}
recipe = slapos.recipe.template:jinja2
recipe = slapos.recipe.template:jinja2
template = ${erp5-kernel:location}/${erp5-kernel:filename}
template = ${erp5-kernel:location}/${erp5-kernel:filename}
rendered = $${directory:erp5_kernel_dir}/ERP5kernel.py
rendered = $${directory:erp5_kernel_dir}/ERP5kernel.py
erp5_url = https://softinst60318.host.vifib.net/erp5/Base_executePython
mode = 0744
mode = 0744
context =
context =
raw python_executable ${buildout:bin-directory}/pythonwitheggs
raw python_executable ${buildout:bin-directory}/pythonwitheggs
key erp5_url :erp5_url
[kernel-json]
[kernel-json]
recipe = slapos.recipe.template:jinja2
recipe = slapos.recipe.template:jinja2
...
...
software/ipython_notebook/software.cfg
View file @
7bd79e3d
...
@@ -55,7 +55,7 @@ output = ${buildout:directory}/instance.cfg
...
@@ -55,7 +55,7 @@ output = ${buildout:directory}/instance.cfg
recipe = hexagonit.recipe.download
recipe = hexagonit.recipe.download
url = ${:_profile_base_location_}/template/${:filename}
url = ${:_profile_base_location_}/template/${:filename}
download-only = true
download-only = true
md5sum =
c74ced2f5e20f5509a3aca8d00952499
md5sum =
0e9c5070725c3a10125a9b658bd4eb5c
destination = ${buildout:parts-directory}/${:_buildout_section_name_}
destination = ${buildout:parts-directory}/${:_buildout_section_name_}
filename = ERP5kernel.py.jinja
filename = ERP5kernel.py.jinja
mode = 0644
mode = 0644
...
...
software/ipython_notebook/template/ERP5kernel.py.jinja
View file @
7bd79e3d
#!{{
python_executable
}}
#!{{
python_executable
}}
from IPython.kernel.zmq.kernelbase import Kernel
from IPython.kernel.zmq.kernelbase import Kernel
from IPython.core.display import HTML
from IPython.core.display import HTML
...
@@ -6,6 +6,8 @@ from IPython.core.display import HTML
...
@@ -6,6 +6,8 @@ from IPython.core.display import HTML
import requests
import requests
import logging
import logging
global erp5_url = "{{ erp5_url }}"
class ERP5Kernel(Kernel):
class ERP5Kernel(Kernel):
implementation = 'ERP5'
implementation = 'ERP5'
implementation_version = '1.0'
implementation_version = '1.0'
...
@@ -14,11 +16,12 @@ class ERP5Kernel(Kernel):
...
@@ -14,11 +16,12 @@ class ERP5Kernel(Kernel):
language_info = {'mimetype': 'text/plain', 'name':'python'}
language_info = {'mimetype': 'text/plain', 'name':'python'}
banner = "ERP5 integration with ipython notebook"
banner = "ERP5 integration with ipython notebook"
def __init__(self, user=None, pwd=None, url=None, status_code=None, *args, **kwargs):
def __init__(self, user=None, pwd=None, url=None, status_code=None,
*args, **kwargs):
super(ERP5Kernel, self).__init__(*args, **kwargs)
super(ERP5Kernel, self).__init__(*args, **kwargs)
self.user = user
self.user = user
self.pwd = pwd
self.pwd = pwd
self.url = url
self.url =
erp5_
url
self.status_code = status_code
self.status_code = status_code
def do_execute(self, code, silent, store_history=True, user_expressions=None,
def do_execute(self, code, silent, store_history=True, user_expressions=None,
...
@@ -33,11 +36,10 @@ class ERP5Kernel(Kernel):
...
@@ -33,11 +36,10 @@ class ERP5Kernel(Kernel):
elif code.startswith('%erp5_password'):
elif code.startswith('%erp5_password'):
self.pwd = code.split()[1]
self.pwd = code.split()[1]
self.url = 'softinst60318.host.vifib.net/erp5/manage_main'
if self.user:
if self.user:
url = 'https://%s:%s@%s' %(self.user, self.pwd, self.url)
try:
try:
res = requests.get(url, verify=False)
res = requests.get(self.url, verify=False,
auth=(self.user, self.pwd))
self.status_code = res.status_code
self.status_code = res.status_code
if self.status_code != 200:
if self.status_code != 200:
resp = 'Incorrect username or password'
resp = 'Incorrect username or password'
...
@@ -52,8 +54,9 @@ class ERP5Kernel(Kernel):
...
@@ -52,8 +54,9 @@ class ERP5Kernel(Kernel):
else:
else:
if self.status_code == 200:
if self.status_code == 200:
url = 'https://%s:%s@softinst60318.host.vifib.net/erp5/data_set_module/wendelin_1/Base_executePython' %(self.user, self.pwd)
res = requests.get(self.url, verify=False,
res = requests.get(url, verify=False, params={'python_expression': code})
auth=(self.user, self.pwd),
params={'python_expression': code})
code_result = res.text
code_result = res.text
else:
else:
...
@@ -76,4 +79,4 @@ if __name__ == '__main__':
...
@@ -76,4 +79,4 @@ if __name__ == '__main__':
from IPython.kernel.zmq.kernelapp import IPKernelApp
from IPython.kernel.zmq.kernelapp import IPKernelApp
IPKernelApp.launch_instance(kernel_class=ERP5Kernel)
IPKernelApp.launch_instance(kernel_class=ERP5Kernel)
else:
else:
from IPython.kernel.zmq.kernelapp import IPKernelApp
from IPython.kernel.zmq.kernelapp import IPKernelApp
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment