Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
139
Merge Requests
139
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
nexedi
erp5
Commits
5ab4dab4
Commit
5ab4dab4
authored
Apr 19, 2018
by
Klaus Wölfel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jupyter: add adhoc configuration for jupyterconvert
parent
eb896b21
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
8 deletions
+13
-8
bt5/erp5_data_notebook/ExtensionTemplateItem/portal_components/extension.erp5.JupyterConvert.py
...teItem/portal_components/extension.erp5.JupyterConvert.py
+10
-6
bt5/erp5_data_notebook/ExtensionTemplateItem/portal_components/extension.erp5.JupyterConvert.xml
...eItem/portal_components/extension.erp5.JupyterConvert.xml
+3
-2
No files found.
bt5/erp5_data_notebook/ExtensionTemplateItem/portal_components/extension.erp5.JupyterConvert.py
View file @
5ab4dab4
...
...
@@ -8,6 +8,10 @@ from xmlrpclib import ServerProxy
from
urllib
import
urlencode
from
urllib2
import
urlopen
import
os
os
.
environ
[
'JUPYTER_CONFIG_DIR'
]
=
"/srv/slapgrid/slappart5/srv/runner/instance/slappart10/ipython"
os
.
environ
[
'IPYTHONDIR'
]
=
"/srv/slapgrid/slappart5/srv/runner/instance/slappart10/ipython"
class
PyMarkdownPreprocessor
(
Preprocessor
):
"""
:mod:`nbconvert` Preprocessor for the python-markdown nbextension.
...
...
@@ -47,12 +51,12 @@ class PyMarkdownPreprocessor(Preprocessor):
cell
.
source
,
variables
)
return
cell
,
resources
def
to_html
(
self
):
def
to_html
(
self
,
**
kw
):
notebook
=
nbformat
.
reads
(
self
.
getTextContent
(),
as_version
=
4
)
resources
=
{}
notebook
=
\
ExecutePreprocessor
(
kernel_name
=
"erp5"
).
preprocess
(
notebook
,
resources
)[
0
]
ExecutePreprocessor
(
timeout
=
300
,
kernel_name
=
"erp5"
).
preprocess
(
notebook
,
resources
)[
0
]
notebook
=
PyMarkdownPreprocessor
().
preprocess
(
notebook
,
resources
)[
0
]
html_exporter
=
HTMLExporter
()
...
...
@@ -63,9 +67,9 @@ def to_html(self):
return
body
def
cloudoooConvertFile
(
self
,
data
,
source_mimetype
,
destination_mimetype
,
zip
=
False
,
refresh
=
False
,
conversion_kw
=
None
):
url
=
'https://softinst78992.host.vifib.net/erp5/ERP5Site_htmlToPdf'
data_dict
=
{
'data'
:
b64encode
(
data
)}
data_dict
.
update
(
**
conversion_kw
)
return
urlopen
(
url
=
url
,
data
=
urlencode
(
data_dict
)).
read
()
#
url = 'https://softinst78992.host.vifib.net/erp5/ERP5Site_htmlToPdf'
#
data_dict = {'data' : b64encode(data)}
#
data_dict.update(**conversion_kw)
#
return urlopen(url=url, data=urlencode(data_dict)).read()
proxy
=
ServerProxy
(
self
.
getPortalObject
().
portal_preferences
.
getPreferredDocumentConversionServerUrl
(),
allow_none
=
True
)
return
b64decode
(
proxy
.
convertFile
(
b64encode
(
data
),
source_mimetype
,
destination_mimetype
,
zip
,
refresh
,
conversion_kw
or
{}))
bt5/erp5_data_notebook/ExtensionTemplateItem/portal_components/extension.erp5.JupyterConvert.xml
View file @
5ab4dab4
...
...
@@ -46,9 +46,10 @@
<key>
<string>
text_content_warning_message
</string>
</key>
<value>
<tuple>
<string>
W: 65, 75: Redefining built-in \'zip\' (redefined-builtin)
</string>
<string>
W: 70, 2: Unreachable code (unreachable)
</string>
<string>
W: 69, 75: Redefining built-in \'zip\' (redefined-builtin)
</string>
<string>
W: 2, 0: Unused import ssl (unused-import)
</string>
<string>
W: 8, 0: Unused urlencode imported from urllib (unused-import)
</string>
<string>
W: 9, 0: Unused urlopen imported from urllib2 (unused-import)
</string>
</tuple>
</value>
</item>
...
...
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