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
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
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
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Laurent S
erp5
Commits
8996cda2
Commit
8996cda2
authored
Feb 29, 2012
by
Rafael Monnerat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added External Method code to extract Test from a Test Page
parent
14014cd1
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
1 deletion
+43
-1
bt5/erp5_run_my_doc/ExtensionTemplateItem/ERP5RunMyDocs.py
bt5/erp5_run_my_doc/ExtensionTemplateItem/ERP5RunMyDocs.py
+42
-0
bt5/erp5_run_my_doc/bt/revision
bt5/erp5_run_my_doc/bt/revision
+1
-1
No files found.
bt5/erp5_run_my_doc/ExtensionTemplateItem/ERP5RunMyDocs.py
View file @
8996cda2
...
@@ -109,3 +109,45 @@ def parseTutorial(text):
...
@@ -109,3 +109,45 @@ def parseTutorial(text):
def
urlread
(
url
):
def
urlread
(
url
):
import
urllib
import
urllib
return
urllib
.
urlopen
(
url
).
read
()
return
urllib
.
urlopen
(
url
).
read
()
"""
Remove everything but the test in a webpage
"""
def
extractTest
(
title
,
text
):
import
lxml.html
from
lxml
import
etree
root
=
lxml
.
html
.
fromstring
(
text
)
table_list
=
root
.
xpath
(
'//test'
)
html
=
"""
<html xmlns:tal="http://xml.zope.org/namespaces/tal"
xmlns:metal="http://xml.zope.org/namespaces/metal">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>"""
+
title
+
"""</title>
</head>
<body>
<table name="SELENIUM-TEST" cellpadding="1" cellspacing="1" border="1">
<thead>
<tr class="title">
<td colspan="3">"""
+
title
+
"""</td>
</tr>
</thead>
<tbody>
"""
for
table
in
table_list
:
table
=
table
[
0
]
if
len
(
table
)
>
0
:
for
row
in
table
[
-
1
]:
if
len
(
row
)
==
1
:
# Include Macros as it is defined by the user.
html
+=
row
[
0
].
text
else
:
html
+=
lxml
.
html
.
tostring
(
row
)
html
+=
"""
</tbody>
</table>
</body>
</html>"""
return
html
\ No newline at end of file
bt5/erp5_run_my_doc/bt/revision
View file @
8996cda2
51
52
\ No newline at end of file
\ 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