Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5-Boxiang
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
Hamza
erp5-Boxiang
Commits
60146ebd
Commit
60146ebd
authored
Mar 06, 2012
by
Rafael Monnerat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added an action to perform a very basic validation at HTML5 Content
parent
faa91cc1
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
308 additions
and
2 deletions
+308
-2
bt5/erp5_run_my_doc/ActionTemplateItem/portal_types/Test%20Page/verify_content.xml
...nTemplateItem/portal_types/Test%20Page/verify_content.xml
+81
-0
bt5/erp5_run_my_doc/ActionTemplateItem/portal_types/Web%20Page/verify_content.xml
...onTemplateItem/portal_types/Web%20Page/verify_content.xml
+81
-0
bt5/erp5_run_my_doc/ExtensionTemplateItem/ERP5RunMyDocs.py
bt5/erp5_run_my_doc/ExtensionTemplateItem/ERP5RunMyDocs.py
+33
-1
bt5/erp5_run_my_doc/SkinTemplateItem/portal_skins/erp5_run_my_doc/TestPage_validateContent.xml
...portal_skins/erp5_run_my_doc/TestPage_validateContent.xml
+28
-0
bt5/erp5_run_my_doc/SkinTemplateItem/portal_skins/erp5_run_my_doc/TestPage_validateHTML5Content.xml
...l_skins/erp5_run_my_doc/TestPage_validateHTML5Content.xml
+82
-0
bt5/erp5_run_my_doc/bt/revision
bt5/erp5_run_my_doc/bt/revision
+1
-1
bt5/erp5_run_my_doc/bt/template_action_path_list
bt5/erp5_run_my_doc/bt/template_action_path_list
+2
-0
No files found.
bt5/erp5_run_my_doc/ActionTemplateItem/portal_types/Test%20Page/verify_content.xml
0 → 100644
View file @
60146ebd
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"ActionInformation"
module=
"Products.CMFCore.ActionInformation"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
action
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAI=
</string>
</persistent>
</value>
</item>
<item>
<key>
<string>
categories
</string>
</key>
<value>
<tuple>
<string>
action_type/object_action
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
category
</string>
</key>
<value>
<string>
object_action
</string>
</value>
</item>
<item>
<key>
<string>
condition
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
icon
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
verify_content
</string>
</value>
</item>
<item>
<key>
<string>
permissions
</string>
</key>
<value>
<tuple>
<string>
View
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
priority
</string>
</key>
<value>
<float>
10.0
</float>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string>
Verify Content
</string>
</value>
</item>
<item>
<key>
<string>
visible
</string>
</key>
<value>
<int>
1
</int>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"2"
aka=
"AAAAAAAAAAI="
>
<pickle>
<global
name=
"Expression"
module=
"Products.CMFCore.Expression"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
text
</string>
</key>
<value>
<string>
string:${object_url}/TestPage_validateHTML5Content
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_run_my_doc/ActionTemplateItem/portal_types/Web%20Page/verify_content.xml
0 → 100644
View file @
60146ebd
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"ActionInformation"
module=
"Products.CMFCore.ActionInformation"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
action
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAI=
</string>
</persistent>
</value>
</item>
<item>
<key>
<string>
categories
</string>
</key>
<value>
<tuple>
<string>
action_type/object_action
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
category
</string>
</key>
<value>
<string>
object_action
</string>
</value>
</item>
<item>
<key>
<string>
condition
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
icon
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
verify_content
</string>
</value>
</item>
<item>
<key>
<string>
permissions
</string>
</key>
<value>
<tuple>
<string>
View
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
priority
</string>
</key>
<value>
<float>
10.0
</float>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string>
Verify Content
</string>
</value>
</item>
<item>
<key>
<string>
visible
</string>
</key>
<value>
<int>
1
</int>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"2"
aka=
"AAAAAAAAAAI="
>
<pickle>
<global
name=
"Expression"
module=
"Products.CMFCore.Expression"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
text
</string>
</key>
<value>
<string>
string:${object_url}/TestPage_validateHTML5Content
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_run_my_doc/ExtensionTemplateItem/ERP5RunMyDocs.py
View file @
60146ebd
...
...
@@ -128,4 +128,36 @@ def extractTest(text):
testcode
+=
row
[
0
].
text
else
:
testcode
+=
lxml
.
html
.
tostring
(
row
)
return
testcode
return
testcode
"""
HTML5 Presentation validador
"""
def
validateHTML5Document
(
text
):
import
lxml.html
from
lxml
import
etree
root
=
lxml
.
html
.
fromstring
(
text
)
section_list
=
root
.
xpath
(
'//section'
)
count
=
0
error_list
=
[]
for
section
in
section_list
:
count
+=
1
if
section
.
xpath
(
"h1"
)
==
[]:
error_list
.
append
(
"Section %s had no h1."
%
count
)
if
section
.
get
(
"class"
)
in
[
"screenshot"
,
"illustration"
]:
if
section
.
xpath
(
"img"
)
==
[]:
error_list
.
append
(
"Section %s has class %s but do not have an image."
%
(
count
,
section
.
get
(
"class"
)))
else
:
if
section
.
xpath
(
"img"
)[
0
].
get
(
"title"
)
==
None
:
error_list
.
append
(
"At section %s, img has no title"
%
count
)
if
section
.
xpath
(
"img"
)[
0
].
get
(
"alt"
)
==
None
:
error_list
.
append
(
"At section %s, img has no alt"
%
count
)
if
section
.
xpath
(
"details"
)
==
[]:
error_list
.
append
(
"Section %s has no details."
%
(
count
))
return
error_list
bt5/erp5_run_my_doc/SkinTemplateItem/portal_skins/erp5_run_my_doc/TestPage_validateContent.xml
0 → 100644
View file @
60146ebd
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"ExternalMethod"
module=
"Products.ExternalMethod.ExternalMethod"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_function
</string>
</key>
<value>
<string>
validateHTML5Document
</string>
</value>
</item>
<item>
<key>
<string>
_module
</string>
</key>
<value>
<string>
ERP5RunMyDocs
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
TestPage_validateContent
</string>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string></string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_run_my_doc/SkinTemplateItem/portal_skins/erp5_run_my_doc/TestPage_validateHTML5Content.xml
0 → 100644
View file @
60146ebd
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"PythonScript"
module=
"Products.PythonScripts.PythonScript"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
Script_magic
</string>
</key>
<value>
<int>
3
</int>
</value>
</item>
<item>
<key>
<string>
_bind_names
</string>
</key>
<value>
<object>
<klass>
<global
name=
"NameAssignments"
module=
"Shared.DC.Scripts.Bindings"
/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key>
<string>
_asgns
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
name_container
</string>
</key>
<value>
<string>
container
</string>
</value>
</item>
<item>
<key>
<string>
name_context
</string>
</key>
<value>
<string>
context
</string>
</value>
</item>
<item>
<key>
<string>
name_m_self
</string>
</key>
<value>
<string>
script
</string>
</value>
</item>
<item>
<key>
<string>
name_subpath
</string>
</key>
<value>
<string>
traverse_subpath
</string>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string
encoding=
"cdata"
>
<![CDATA[
translateString = context.Base_translateString\n
\n
text_content = context.getTextContent()\n
error_list = context.TestPage_validateContent(text_content)\n
\n
if len(error_list) >
0:\n
portal_status_message = " ".join(error_list)\n
else:\n
portal_status_message = translateString("No error was found.")\n
\n
return context.Base_redirect(context.REQUEST.get("form_id", ""), \n
keep_items=dict(portal_status_message=portal_status_message))\n
]]>
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
TestPage_validateHTML5Content
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_run_my_doc/bt/revision
View file @
60146ebd
60
\ No newline at end of file
61
\ No newline at end of file
bt5/erp5_run_my_doc/bt/template_action_path_list
View file @
60146ebd
...
...
@@ -18,6 +18,7 @@ Test Page | related
Test Page | send_email
Test Page | slideshow
Test Page | update_report
Test Page | verify_content
Test Page | view
Test Page | view_editor
Test Page | view_slideshow_editor
...
...
@@ -27,4 +28,5 @@ Web Page Module | page_fast_input
Web Page | export_book
Web Page | export_chapter
Web Page | slideshow
Web Page | verify_content
Web Page | view_slideshow_editor
\ 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