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
Alexander Emmerich
erp5
Commits
68bec827
Commit
68bec827
authored
Sep 29, 2022
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'upstream/master' into zope4py2
parents
0b834c3c
28048ede
Changes
29
Hide whitespace changes
Inline
Side-by-side
Showing
29 changed files
with
99 additions
and
115 deletions
+99
-115
bt5/erp5_corporate_identity/SkinTemplateItem/portal_skins/erp5_corporate_identity_web/WebPage_substituteDocumentationList.py
...orate_identity_web/WebPage_substituteDocumentationList.py
+4
-7
bt5/erp5_forge/SkinTemplateItem/portal_skins/erp5_toolbox/Base_checkSkinFolderForms.py
...em/portal_skins/erp5_toolbox/Base_checkSkinFolderForms.py
+2
-2
bt5/erp5_web_js_style/SkinTemplateItem/portal_skins/erp5_web_js_style_ui/WebSection_generateNavigationHTML.py
...erp5_web_js_style_ui/WebSection_generateNavigationHTML.py
+7
-11
product/ERP5/Extensions/Grep.py
product/ERP5/Extensions/Grep.py
+3
-3
product/ERP5/bin/genbt5list
product/ERP5/bin/genbt5list
+2
-2
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Resource_hashVariationCategoryItemList.py
...skins/erp5_core/Resource_hashVariationCategoryItemList.py
+2
-2
product/ERP5/bootstrap/erp5_core/ToolComponentTemplateItem/portal_components/tool.erp5.IntrospectionTool.py
...lateItem/portal_components/tool.erp5.IntrospectionTool.py
+3
-3
product/ERP5/tests/erp5_url_checker.py
product/ERP5/tests/erp5_url_checker.py
+2
-2
product/ERP5Form/ListBox.py
product/ERP5Form/ListBox.py
+3
-3
product/ERP5Form/MultiRelationField.py
product/ERP5Form/MultiRelationField.py
+19
-19
product/ERP5Form/dtml/captchaFieldTales.dtml
product/ERP5Form/dtml/captchaFieldTales.dtml
+1
-1
product/ERP5Form/dtml/proxyFieldEdit.dtml
product/ERP5Form/dtml/proxyFieldEdit.dtml
+1
-1
product/ERP5Form/dtml/proxyFieldTales.dtml
product/ERP5Form/dtml/proxyFieldTales.dtml
+1
-1
product/ERP5Type/CopySupport.py
product/ERP5Type/CopySupport.py
+0
-1
product/ERP5Type/patches/make_hidden_input.py
product/ERP5Type/patches/make_hidden_input.py
+2
-2
product/Formulator/Form.py
product/Formulator/Form.py
+6
-7
product/Formulator/FormToXML.py
product/Formulator/FormToXML.py
+5
-8
product/Formulator/ListTextAreaField.py
product/Formulator/ListTextAreaField.py
+4
-5
product/Formulator/Widget.py
product/Formulator/Widget.py
+11
-11
product/Formulator/XMLObjects.py
product/Formulator/XMLObjects.py
+1
-2
product/Formulator/dtml/FieldHelpTopic.dtml
product/Formulator/dtml/FieldHelpTopic.dtml
+1
-1
product/Formulator/dtml/fieldEdit.dtml
product/Formulator/dtml/fieldEdit.dtml
+1
-1
product/Formulator/dtml/fieldOverride.dtml
product/Formulator/dtml/fieldOverride.dtml
+1
-1
product/Formulator/dtml/fieldTales.dtml
product/Formulator/dtml/fieldTales.dtml
+1
-1
product/HBTreeFolder2/HBTreeFolder2.py
product/HBTreeFolder2/HBTreeFolder2.py
+3
-3
product/PortalTransforms/transforms/python.py
product/PortalTransforms/transforms/python.py
+2
-3
product/PortalTransforms/transforms/safe_html.py
product/PortalTransforms/transforms/safe_html.py
+3
-3
product/ZSQLCatalog/SQLCatalog.py
product/ZSQLCatalog/SQLCatalog.py
+1
-2
product/ZSQLCatalog/ZSQLCatalog.py
product/ZSQLCatalog/ZSQLCatalog.py
+7
-7
No files found.
bt5/erp5_corporate_identity/SkinTemplateItem/portal_skins/erp5_corporate_identity_web/WebPage_substituteDocumentationList.py
View file @
68bec827
import
cgi
from
Products.PythonScripts.standard
import
html_quote
def
escapeInnerHTML
(
string_to_escape
):
def
escape
(
string_to_escape
):
return
cgi
.
escape
(
"%s"
%
string_to_escape
,
quote
=
False
)
return
html_quote
(
"%s"
%
string_to_escape
)
def
escapeAttributeProperty
(
string_to_escape
):
return
cgi
.
escape
(
"%s"
%
string_to_escape
,
quote
=
True
)
web_site_value
=
context
.
getWebSiteValue
()
web_site_value
=
context
.
getWebSiteValue
()
...
@@ -15,7 +12,7 @@ if (web_site_value is not None):
...
@@ -15,7 +12,7 @@ if (web_site_value is not None):
for
category_relative_url
in
category_relative_url_list
:
for
category_relative_url
in
category_relative_url_list
:
base_category
,
_
=
category_relative_url
.
split
(
'/'
,
1
)
base_category
,
_
=
category_relative_url
.
split
(
'/'
,
1
)
result
[
category_relative_url
.
replace
(
'/'
,
'__'
)]
=
'<ul>%s</ul>'
%
''
.
join
([
'<li><a href="%s">%s</a></li>'
%
(
escape
AttributeProperty
(
x
.
getReference
()),
escapeInnerHTML
(
x
.
getTitle
()))
for
x
in
web_site_value
.
getDocumentValueList
(
result
[
category_relative_url
.
replace
(
'/'
,
'__'
)]
=
'<ul>%s</ul>'
%
''
.
join
([
'<li><a href="%s">%s</a></li>'
%
(
escape
(
x
.
getReference
()),
escape
(
x
.
getTitle
()))
for
x
in
web_site_value
.
getDocumentValueList
(
sort_on
=
[[
'title'
,
'ASC'
]],
sort_on
=
[[
'title'
,
'ASC'
]],
**
{
'%s__relative_url'
%
base_category
:
category_relative_url
}
**
{
'%s__relative_url'
%
base_category
:
category_relative_url
}
)])
)])
...
...
bt5/erp5_forge/SkinTemplateItem/portal_skins/erp5_toolbox/Base_checkSkinFolderForms.py
View file @
68bec827
from
cgi
import
escap
e
from
Products.PythonScripts.standard
import
html_quot
e
portal
=
context
.
getPortalObject
()
portal
=
context
.
getPortalObject
()
skin_folder
=
portal
.
portal_skins
[
original_skin_name
]
skin_folder
=
portal
.
portal_skins
[
original_skin_name
]
new_skin_folder
=
portal
.
portal_skins
[
new_skin_name
]
new_skin_folder
=
portal
.
portal_skins
[
new_skin_name
]
...
@@ -38,7 +38,7 @@ for original_form in skin_folder.objectValues():
...
@@ -38,7 +38,7 @@ for original_form in skin_folder.objectValues():
original_field
.
absolute_url
(),
new_field
.
absolute_url
()))
original_field
.
absolute_url
(),
new_field
.
absolute_url
()))
output_list
+=
(
"<tr><td>%s</td></tr>"
%
"</td><td>"
.
join
(
output_list
+=
(
"<tr><td>%s</td></tr>"
%
"</td><td>"
.
join
(
map
(
escap
e
,
(
'[%s]'
%
key
if
T
else
key
,
str
(
old
),
str
(
new
[
key
]))))
map
(
html_quot
e
,
(
'[%s]'
%
key
if
T
else
key
,
str
(
old
),
str
(
new
[
key
]))))
for
T
,
old
,
new
in
((
0
,
original_value_dict
,
new_value_dict
),
for
T
,
old
,
new
in
((
0
,
original_value_dict
,
new_value_dict
),
(
1
,
original_value_tales
,
new_value_tales
))
(
1
,
original_value_tales
,
new_value_tales
))
for
key
,
old
in
old
.
iteritems
()
for
key
,
old
in
old
.
iteritems
()
...
...
bt5/erp5_web_js_style/SkinTemplateItem/portal_skins/erp5_web_js_style_ui/WebSection_generateNavigationHTML.py
View file @
68bec827
import
cgi
from
Products.PythonScripts.standard
import
html_quote
import
re
import
re
web_section
=
context
web_section
=
context
web_site
=
web_section
.
getWebSiteValue
()
web_site
=
web_section
.
getWebSiteValue
()
def
_
(
string_to_escape
):
def
_
(
string_to_escape
):
return
cgi
.
escape
(
"%s"
%
string_to_escape
,
quote
=
False
)
return
html_quote
(
"%s"
%
string_to_escape
)
def
__
(
string_to_escape
):
return
cgi
.
escape
(
"%s"
%
string_to_escape
,
quote
=
True
)
def
generateSectionListHTML
(
result_list
,
section_list
):
def
generateSectionListHTML
(
result_list
,
section_list
):
...
@@ -18,7 +14,7 @@ def generateSectionListHTML(result_list, section_list):
...
@@ -18,7 +14,7 @@ def generateSectionListHTML(result_list, section_list):
for
section
in
section_list
:
for
section
in
section_list
:
# Add missing / suffix to get correct relative url generation
# Add missing / suffix to get correct relative url generation
# XXX Fix WebSection_getSiteMapTree instead, but no idea what would be the site effects
# XXX Fix WebSection_getSiteMapTree instead, but no idea what would be the site effects
result_list
.
append
(
'<li><a href="%s">%s</a>'
%
(
_
_
(
section
[
'url'
]
+
'/'
),
_
(
section
[
'translated_title'
])))
result_list
.
append
(
'<li><a href="%s">%s</a>'
%
(
_
(
section
[
'url'
]
+
'/'
),
_
(
section
[
'translated_title'
])))
generateSectionListHTML
(
result_list
,
section
[
'subsection'
])
generateSectionListHTML
(
result_list
,
section
[
'subsection'
])
result_list
.
append
(
'</li>'
)
result_list
.
append
(
'</li>'
)
result_list
.
append
(
'</ul>'
)
result_list
.
append
(
'</ul>'
)
...
@@ -41,8 +37,8 @@ def generateDocumentListHTML(result_list, document_list):
...
@@ -41,8 +37,8 @@ def generateDocumentListHTML(result_list, document_list):
_
(
section
[
'translated_title'
]),
_
(
section
[
'translated_title'
]),
(
'<p class="p-summary">%s</p>'
%
_
(
section
[
'description'
]))
if
section
.
get
(
'description'
)
else
''
,
(
'<p class="p-summary">%s</p>'
%
_
(
section
[
'description'
]))
if
section
.
get
(
'description'
)
else
''
,
(
'<p class="p-author h-card">%s</p>'
%
_
(
section
[
'document'
].
Document_getContributorTitleList
()[
0
])),
(
'<p class="p-author h-card">%s</p>'
%
_
(
section
[
'document'
].
Document_getContributorTitleList
()[
0
])),
_
_
(
section
[
'url'
]),
_
(
section
[
'url'
]),
_
_
(
publication_date
.
HTML4
()),
_
(
publication_date
.
HTML4
()),
_
(
publication_date
.
rfc822
())
_
(
publication_date
.
rfc822
())
))
))
result_list
.
append
(
'</ul></aside>'
)
result_list
.
append
(
'</ul></aside>'
)
...
@@ -65,12 +61,12 @@ for language in available_language_set:
...
@@ -65,12 +61,12 @@ for language in available_language_set:
website_url_set
[
language
]
=
re
.
sub
(
website_url_pattern
,
r'%s/%s/\1'
%
(
root_website_url
,
language
),
web_site
.
absolute_url
())
website_url_set
[
language
]
=
re
.
sub
(
website_url_pattern
,
r'%s/%s/\1'
%
(
root_website_url
,
language
),
web_site
.
absolute_url
())
for
language
,
url
in
website_url_set
.
items
():
for
language
,
url
in
website_url_set
.
items
():
result_list
+=
'<li><a href="%s" hreflang="%s"><abbr lang="%s">%s</abbr></a></li>'
%
(
_
_
(
url
),
__
(
language
),
_
_
(
language
),
_
(
language
))
result_list
+=
'<li><a href="%s" hreflang="%s"><abbr lang="%s">%s</abbr></a></li>'
%
(
_
(
url
),
_
(
language
),
_
(
language
),
_
(
language
))
result_list
.
append
(
'</ul></nav>'
)
result_list
.
append
(
'</ul></nav>'
)
# Sitemap
# Sitemap
result_list
.
append
(
'<nav id="sitemap">'
)
result_list
.
append
(
'<nav id="sitemap">'
)
result_list
.
append
(
'<a href="%s">%s</a>'
%
(
_
_
(
web_site
.
absolute_url
()),
_
(
web_site
.
getTranslatedTitle
())))
result_list
.
append
(
'<a href="%s">%s</a>'
%
(
_
(
web_site
.
absolute_url
()),
_
(
web_site
.
getTranslatedTitle
())))
generateSectionListHTML
(
result_list
,
web_site
.
WebSection_getSiteMapTree
(
include_document
=
False
,
depth
=
99
))
generateSectionListHTML
(
result_list
,
web_site
.
WebSection_getSiteMapTree
(
include_document
=
False
,
depth
=
99
))
result_list
.
append
(
'</nav>'
)
result_list
.
append
(
'</nav>'
)
...
...
product/ERP5/Extensions/Grep.py
View file @
68bec827
import
re
import
re
import
cgi
from
Products.PythonScripts.standard
import
html_quote
from
Acquisition
import
aq_base
from
Acquisition
import
aq_base
from
AccessControl
import
Unauthorized
from
AccessControl
import
Unauthorized
from
Products.CMFCore.utils
import
_checkPermission
from
Products.CMFCore.utils
import
_checkPermission
...
@@ -73,8 +73,8 @@ def grep(self, pattern, A=0, B=0, r=1, i=0, highlight=1, first_occurence=0):
...
@@ -73,8 +73,8 @@ def grep(self, pattern, A=0, B=0, r=1, i=0, highlight=1, first_occurence=0):
html_element_list
=
[
doctype
,
html
,
head
,
'<body>'
'<p>'
]
html_element_list
=
[
doctype
,
html
,
head
,
'<body>'
'<p>'
]
result_list
=
[]
result_list
=
[]
for
url
,
path
,
line
in
result
:
for
url
,
path
,
line
in
result
:
path
=
cgi
.
escap
e
(
path
)
path
=
html_quot
e
(
path
)
line
=
cgi
.
escap
e
(
line
)
line
=
html_quot
e
(
line
)
if
highlight
:
if
highlight
:
line
=
rx
.
sub
(
'<span class="highlight">
\
g<
0
></span>'
,
line
)
line
=
rx
.
sub
(
'<span class="highlight">
\
g<
0
></span>'
,
line
)
if
ExternalEditor
is
None
:
if
ExternalEditor
is
None
:
...
...
product/ERP5/bin/genbt5list
View file @
68bec827
...
@@ -220,8 +220,8 @@ def generateInformation(dir, info=id, err=None):
...
@@ -220,8 +220,8 @@ def generateInformation(dir, info=id, err=None):
if
str
is
not
bytes
:
if
str
is
not
bytes
:
k
=
k
.
encode
()
k
=
k
.
encode
()
for
v
in
(
v
,)
if
type
(
v
)
is
bytes
else
v
:
for
v
in
(
v
,)
if
type
(
v
)
is
bytes
else
v
:
xml
.
write
(
b' <%s>%s</%s>
\
n
'
%
(
k
,
escape
(
v
)
if
str
is
bytes
else
xml
.
write
(
b' <%s>%s</%s>
\
n
'
%
(
k
,
escape
(
v
,
quote
=
False
)
if
str
is
bytes
else
escape
(
v
.
decode
()).
encode
(),
k
))
escape
(
v
.
decode
()
,
quote
=
False
).
encode
(),
k
))
xml
.
write
(
b' </template>
\
n
'
)
xml
.
write
(
b' </template>
\
n
'
)
info
(
'done
\
n
'
)
info
(
'done
\
n
'
)
xml
.
write
(
b'</repository>
\
n
'
)
xml
.
write
(
b'</repository>
\
n
'
)
...
...
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Resource_hashVariationCategoryItemList.py
View file @
68bec827
...
@@ -13,8 +13,8 @@ for item in item_list:
...
@@ -13,8 +13,8 @@ for item in item_list:
item_value
=
item
[
int
(
not
is_right_display
)]
item_value
=
item
[
int
(
not
is_right_display
)]
# Hash key from item_value
# Hash key from item_value
item_split
=
string
.
split
(
item_value
,
'/'
)
item_split
=
item_value
.
split
(
'/'
)
item_key
=
string
.
join
(
item_split
[:
split_depth
]
,
'/'
)
item_key
=
'/'
.
join
(
item_split
[:
split_depth
]
,
'/'
)
if
item_key
not
in
sub_field_dict
:
if
item_key
not
in
sub_field_dict
:
# Create property dict
# Create property dict
...
...
product/ERP5/bootstrap/erp5_core/ToolComponentTemplateItem/portal_components/tool.erp5.IntrospectionTool.py
View file @
68bec827
...
@@ -40,7 +40,7 @@ from AccessControl.SecurityManagement import setSecurityManager
...
@@ -40,7 +40,7 @@ from AccessControl.SecurityManagement import setSecurityManager
from
Products.ERP5Type.Utils
import
_setSuperSecurityManager
from
Products.ERP5Type.Utils
import
_setSuperSecurityManager
from
App.config
import
getConfiguration
from
App.config
import
getConfiguration
from
Products.ERP5Type.Cache
import
CachingMethod
from
Products.ERP5Type.Cache
import
CachingMethod
from
cgi
import
escap
e
from
Products.PythonScripts.standard
import
html_quot
e
import
logging
import
logging
...
@@ -257,14 +257,14 @@ class IntrospectionTool(LogMixin, BaseTool):
...
@@ -257,14 +257,14 @@ class IntrospectionTool(LogMixin, BaseTool):
"""
"""
Tail the Event Log.
Tail the Event Log.
"""
"""
return
escap
e
(
self
.
_tailFile
(
self
.
__getEventLogPath
(),
500
))
return
html_quot
e
(
self
.
_tailFile
(
self
.
__getEventLogPath
(),
500
))
security
.
declareProtected
(
Permissions
.
ManagePortal
,
'tailAccessLog'
)
security
.
declareProtected
(
Permissions
.
ManagePortal
,
'tailAccessLog'
)
def
tailAccessLog
(
self
):
def
tailAccessLog
(
self
):
"""
"""
Tail the Event Log.
Tail the Event Log.
"""
"""
return
escap
e
(
self
.
_tailFile
(
self
.
__getAccessLogPath
(),
50
))
return
html_quot
e
(
self
.
_tailFile
(
self
.
__getAccessLogPath
(),
50
))
security
.
declareProtected
(
Permissions
.
ManagePortal
,
'getAccessLog'
)
security
.
declareProtected
(
Permissions
.
ManagePortal
,
'getAccessLog'
)
def
getAccessLog
(
self
,
compressed
=
1
,
REQUEST
=
None
):
def
getAccessLog
(
self
,
compressed
=
1
,
REQUEST
=
None
):
...
...
product/ERP5/tests/erp5_url_checker.py
View file @
68bec827
...
@@ -89,7 +89,7 @@ class URLOpener(FancyURLopener):
...
@@ -89,7 +89,7 @@ class URLOpener(FancyURLopener):
urltype
,
rest
=
splittype
(
selector
)
urltype
,
rest
=
splittype
(
selector
)
url
=
rest
url
=
rest
user_passwd
=
None
user_passwd
=
None
if
string
.
lower
(
urltype
)
!=
'http'
:
if
urltype
.
lower
(
)
!=
'http'
:
realhost
=
None
realhost
=
None
else
:
else
:
realhost
,
rest
=
splithost
(
rest
)
realhost
,
rest
=
splithost
(
rest
)
...
@@ -101,7 +101,7 @@ class URLOpener(FancyURLopener):
...
@@ -101,7 +101,7 @@ class URLOpener(FancyURLopener):
if
not
host
:
raise
IOError
(
'http error'
,
'no host given'
)
if
not
host
:
raise
IOError
(
'http error'
,
'no host given'
)
if
user_passwd
:
if
user_passwd
:
import
base64
import
base64
auth
=
string
.
strip
(
base64
.
encodestring
(
user_passwd
)
)
auth
=
base64
.
encodestring
(
user_passwd
).
strip
(
)
else
:
else
:
auth
=
None
auth
=
None
h
=
httplib
.
HTTP
(
host
)
h
=
httplib
.
HTTP
(
host
)
...
...
product/ERP5Form/ListBox.py
View file @
68bec827
...
@@ -53,9 +53,9 @@ from ZTUtils import make_query
...
@@ -53,9 +53,9 @@ from ZTUtils import make_query
from
Products.ERP5Type.Globals
import
InitializeClass
,
get_request
from
Products.ERP5Type.Globals
import
InitializeClass
,
get_request
from
Products.PythonScripts.Utility
import
allow_class
from
Products.PythonScripts.Utility
import
allow_class
from
Products.PythonScripts.standard
import
html_quote
from
Products.PageTemplates.PageTemplateFile
import
PageTemplateFile
from
Products.PageTemplates.PageTemplateFile
import
PageTemplateFile
from
warnings
import
warn
from
warnings
import
warn
import
cgi
import
six
import
six
DEFAULT_LISTBOX_DISPLAY_STYLE
=
'table'
DEFAULT_LISTBOX_DISPLAY_STYLE
=
'table'
...
@@ -2475,7 +2475,7 @@ class ListBoxHTMLRendererLine(ListBoxRendererLine):
...
@@ -2475,7 +2475,7 @@ class ListBoxHTMLRendererLine(ListBoxRendererLine):
# If error on current field, we should display message
# If error on current field, we should display message
if
key
in
error_dict
:
if
key
in
error_dict
:
error_text
=
error_dict
[
key
].
error_text
error_text
=
error_dict
[
key
].
error_text
error_text
=
cgi
.
escap
e
(
error_text
)
error_text
=
html_quot
e
(
error_text
)
if
isinstance
(
error_text
,
str
):
if
isinstance
(
error_text
,
str
):
error_mapping
=
getattr
(
error_dict
[
key
],
'error_mapping'
,
None
)
error_mapping
=
getattr
(
error_dict
[
key
],
'error_mapping'
,
None
)
if
error_mapping
is
not
None
:
if
error_mapping
is
not
None
:
...
@@ -2521,7 +2521,7 @@ class ListBoxHTMLRendererLine(ListBoxRendererLine):
...
@@ -2521,7 +2521,7 @@ class ListBoxHTMLRendererLine(ListBoxRendererLine):
html
+=
u' <span class="error">%s</span>'
%
error_message
html
+=
u' <span class="error">%s</span>'
%
error_message
else
:
else
:
# If not editable, show a static text with a link, if enabled.
# If not editable, show a static text with a link, if enabled.
html
=
cgi
.
escap
e
(
processed_value
)
html
=
html_quot
e
(
processed_value
)
if
url
is
not
None
:
if
url
is
not
None
:
# JPS-XXX - I think we should not display a URL for objects
# JPS-XXX - I think we should not display a URL for objects
# which do not have the View permission
# which do not have the View permission
...
...
product/ERP5Form/MultiRelationField.py
View file @
68bec827
...
@@ -37,7 +37,7 @@ from Products.ERP5Type.Message import translateString
...
@@ -37,7 +37,7 @@ from Products.ERP5Type.Message import translateString
from
AccessControl
import
ClassSecurityInfo
from
AccessControl
import
ClassSecurityInfo
from
Products.Formulator.DummyField
import
fields
from
Products.Formulator.DummyField
import
fields
from
Products.ERP5Type.Globals
import
get_request
from
Products.ERP5Type.Globals
import
get_request
from
cgi
import
escap
e
from
Products.PythonScripts.standard
import
html_quot
e
import
json
import
json
# Max. number of catalog result
# Max. number of catalog result
...
@@ -311,8 +311,8 @@ class MultiRelationStringFieldWidget(Widget.LinesTextAreaWidget,
...
@@ -311,8 +311,8 @@ class MultiRelationStringFieldWidget(Widget.LinesTextAreaWidget,
value
=
value
,
value
=
value
,
html_string
=
'<br />'
.
join
(
html_string
=
'<br />'
.
join
(
'<a class="relationfieldlink" href="%s">%s</a>'
%
(
'<a class="relationfieldlink" href="%s">%s</a>'
%
(
escap
e
(
jump_reference
.
absolute_url
()),
html_quot
e
(
jump_reference
.
absolute_url
()),
escap
e
(
display_value
),
html_quot
e
(
display_value
),
)
)
for
jump_reference
,
display_value
in
zip
(
for
jump_reference
,
display_value
in
zip
(
getattr
(
getattr
(
...
@@ -345,7 +345,7 @@ class MultiRelationStringFieldWidget(Widget.LinesTextAreaWidget,
...
@@ -345,7 +345,7 @@ class MultiRelationStringFieldWidget(Widget.LinesTextAreaWidget,
css_class
=
field
.
get_value
(
'css_class'
)
css_class
=
field
.
get_value
(
'css_class'
)
if
css_class
not
in
(
''
,
None
):
if
css_class
not
in
(
''
,
None
):
html_string
=
'<span class="%s">%s</span>'
%
(
html_string
=
'<span class="%s">%s</span>'
%
(
escap
e
(
css_class
),
html_quot
e
(
css_class
),
html_string
,
html_string
,
)
)
return
html_string
return
html_string
...
@@ -363,9 +363,9 @@ $(document).ready(function() {
...
@@ -363,9 +363,9 @@ $(document).ready(function() {
search_catalog_key: "%s"});
search_catalog_key: "%s"});
});
});
</script>"""
%
(
</script>"""
%
(
escap
e
(
key
),
html_quot
e
(
key
),
escap
e
(
json
.
dumps
([
x
[
0
]
for
x
in
field
.
get_value
(
'portal_type'
)])),
html_quot
e
(
json
.
dumps
([
x
[
0
]
for
x
in
field
.
get_value
(
'portal_type'
)])),
escap
e
(
field
.
get_value
(
'catalog_index'
)),
html_quot
e
(
field
.
get_value
(
'catalog_index'
)),
)
)
def
render_wheel
(
self
,
field
,
value
,
REQUEST
,
relation_index
=
0
,
def
render_wheel
(
self
,
field
,
value
,
REQUEST
,
relation_index
=
0
,
...
@@ -383,10 +383,10 @@ $(document).ready(function() {
...
@@ -383,10 +383,10 @@ $(document).ready(function() {
'src="%s/images/exec16.png" alt="update..." '
\
'src="%s/images/exec16.png" alt="update..." '
\
'name="%s/viewSearchRelatedDocumentDialog%s%s'
\
'name="%s/viewSearchRelatedDocumentDialog%s%s'
\
':method"/>'
%
(
':method"/>'
%
(
escap
e
(
portal_url
()),
html_quot
e
(
portal_url
()),
escap
e
(
portal_url
.
getRelativeContentURL
(
here
.
portal_selections
)),
html_quot
e
(
portal_url
.
getRelativeContentURL
(
here
.
portal_selections
)),
escap
e
(
str
(
relation_index
)),
html_quot
e
(
str
(
relation_index
)),
escap
e
(
sub_index_string
),
html_quot
e
(
sub_index_string
),
)
)
def
render_relation_link
(
self
,
field
,
value
,
REQUEST
,
render_prefix
=
None
):
def
render_relation_link
(
self
,
field
,
value
,
REQUEST
,
render_prefix
=
None
):
...
@@ -408,8 +408,8 @@ $(document).ready(function() {
...
@@ -408,8 +408,8 @@ $(document).ready(function() {
selection_name
=
REQUEST
.
get
(
'selection_name'
)
selection_name
=
REQUEST
.
get
(
'selection_name'
)
if
selection_name
is
not
None
:
if
selection_name
is
not
None
:
selection_name_html
=
'&selection_name=%s&selection_index=%s'
%
(
selection_name_html
=
'&selection_name=%s&selection_index=%s'
%
(
escap
e
(
selection_name
),
html_quot
e
(
selection_name
),
escap
e
(
str
(
REQUEST
.
get
(
'selection_index'
,
0
))),
html_quot
e
(
str
(
REQUEST
.
get
(
'selection_index'
,
0
))),
)
)
else
:
else
:
selection_name_html
=
''
selection_name_html
=
''
...
@@ -420,12 +420,12 @@ $(document).ready(function() {
...
@@ -420,12 +420,12 @@ $(document).ready(function() {
return
'<a href="%s/%s?field_id=%s&form_id=%s%s">'
\
return
'<a href="%s/%s?field_id=%s&form_id=%s%s">'
\
'<img src="%s/images/jump.png" alt="jump" />'
\
'<img src="%s/images/jump.png" alt="jump" />'
\
'</a>'
%
(
'</a>'
%
(
escap
e
(
here
.
absolute_url
()),
html_quot
e
(
here
.
absolute_url
()),
escap
e
(
field
.
get_value
(
'jump_method'
)),
html_quot
e
(
field
.
get_value
(
'jump_method'
)),
escap
e
(
field
.
id
),
html_quot
e
(
field
.
id
),
escap
e
(
field
.
aq_parent
.
id
),
html_quot
e
(
field
.
aq_parent
.
id
),
escap
e
(
selection_name_html
),
html_quot
e
(
selection_name_html
),
escap
e
(
here
.
getPortalObject
().
portal_url
()),
html_quot
e
(
here
.
getPortalObject
().
portal_url
()),
)
)
return
''
return
''
...
...
product/ERP5Form/dtml/captchaFieldTales.dtml
View file @
68bec827
...
@@ -20,7 +20,7 @@ This tab can therefore not be used.
...
@@ -20,7 +20,7 @@ This tab can therefore not be used.
<dtml-if fields>
<dtml-if fields>
<tr>
<tr>
<td colspan="3" class="form-title">
<td colspan="3" class="form-title">
<dtml-var
"_.string.capitalize(group)"
> properties
<dtml-var
group capitalize
> properties
</td>
</td>
</tr>
</tr>
...
...
product/ERP5Form/dtml/proxyFieldEdit.dtml
View file @
68bec827
...
@@ -76,7 +76,7 @@ Surcharge <dtml-var meta_type> properties here.
...
@@ -76,7 +76,7 @@ Surcharge <dtml-var meta_type> properties here.
<dtml-if fields>
<dtml-if fields>
<tr>
<tr>
<td colspan="3" class="form-title">
<td colspan="3" class="form-title">
<dtml-var
"_.string.capitalize(group)"
> properties
<dtml-var
group capitalize
> properties
</td>
</td>
</tr>
</tr>
...
...
product/ERP5Form/dtml/proxyFieldTales.dtml
View file @
68bec827
...
@@ -78,7 +78,7 @@ This tab can therefore not be used.
...
@@ -78,7 +78,7 @@ This tab can therefore not be used.
<dtml-if fields>
<dtml-if fields>
<tr>
<tr>
<td colspan="3" class="form-title">
<td colspan="3" class="form-title">
<dtml-var
"_.string.capitalize(group)"
> properties
<dtml-var
group capitalize
> properties
</td>
</td>
</tr>
</tr>
...
...
product/ERP5Type/CopySupport.py
View file @
68bec827
...
@@ -34,7 +34,6 @@ from Products.CMFCore.WorkflowCore import WorkflowException
...
@@ -34,7 +34,6 @@ from Products.CMFCore.WorkflowCore import WorkflowException
from
Products.CMFCore.CatalogTool
import
CatalogTool
as
CMFCoreCatalogTool
from
Products.CMFCore.CatalogTool
import
CatalogTool
as
CMFCoreCatalogTool
from
Products.CMFActivity.Errors
import
ActivityPendingError
from
Products.CMFActivity.Errors
import
ActivityPendingError
from
cgi
import
escape
import
sys
import
sys
_marker
=
object
()
_marker
=
object
()
...
...
product/ERP5Type/patches/make_hidden_input.py
View file @
68bec827
...
@@ -18,7 +18,7 @@ Close properly the <input /> tag
...
@@ -18,7 +18,7 @@ Close properly the <input /> tag
import
ZTUtils.Zope
import
ZTUtils.Zope
from
ZTUtils.Zope
import
complex_marshal
from
ZTUtils.Zope
import
complex_marshal
import
cgi
from
Products.PythonScripts.standard
import
html_quote
from
Products.ERP5Type.Utils
import
ensure_list
from
Products.ERP5Type.Utils
import
ensure_list
def
make_hidden_input
(
*
args
,
**
kwargs
):
def
make_hidden_input
(
*
args
,
**
kwargs
):
...
@@ -39,7 +39,7 @@ def make_hidden_input(*args, **kwargs):
...
@@ -39,7 +39,7 @@ def make_hidden_input(*args, **kwargs):
d
.
update
(
arg
)
d
.
update
(
arg
)
d
.
update
(
kwargs
)
d
.
update
(
kwargs
)
hq
=
lambda
x
:
cgi
.
escape
(
x
,
quote
=
True
)
hq
=
lambda
x
:
html_quote
(
x
)
qlist
=
complex_marshal
(
ensure_list
(
d
.
items
()))
qlist
=
complex_marshal
(
ensure_list
(
d
.
items
()))
for
i
in
range
(
len
(
qlist
)):
for
i
in
range
(
len
(
qlist
)):
k
,
m
,
v
=
qlist
[
i
]
k
,
m
,
v
=
qlist
[
i
]
...
...
product/Formulator/Form.py
View file @
68bec827
...
@@ -14,7 +14,6 @@ from OFS.SimpleItem import Item
...
@@ -14,7 +14,6 @@ from OFS.SimpleItem import Item
import
Acquisition
import
Acquisition
from
six.moves.urllib.parse
import
quote
from
six.moves.urllib.parse
import
quote
import
os
import
os
import
string
from
six
import
StringIO
from
six
import
StringIO
from
.Errors
import
ValidationError
,
FormValidationError
,
FieldDisabledError
from
.Errors
import
ValidationError
,
FormValidationError
,
FieldDisabledError
...
@@ -744,7 +743,7 @@ class ZMIForm(ObjectManager, PropertyManager, RoleManager, Item, Form):
...
@@ -744,7 +743,7 @@ class ZMIForm(ObjectManager, PropertyManager, RoleManager, Item, Form):
fieldname -- the name of the field (meta_type) to add
fieldname -- the name of the field (meta_type) to add
Result -- empty string
Result -- empty string
"""
"""
title
=
string
.
strip
(
title
)
title
=
title
.
strip
(
)
if
not
title
:
if
not
title
:
title
=
id
# title is always required, use id if not provided
title
=
id
# title is always required, use id if not provided
# get the field class we want to add
# get the field class we want to add
...
@@ -786,9 +785,9 @@ class ZMIForm(ObjectManager, PropertyManager, RoleManager, Item, Form):
...
@@ -786,9 +785,9 @@ class ZMIForm(ObjectManager, PropertyManager, RoleManager, Item, Form):
try
:
try
:
result
=
self
.
settings_form
.
validate_all
(
REQUEST
)
result
=
self
.
settings_form
.
validate_all
(
REQUEST
)
except
FormValidationError
as
e
:
except
FormValidationError
as
e
:
message
=
"Validation error(s).<br />"
+
string
.
join
(
message
=
"Validation error(s).<br />"
+
"<br />"
.
join
(
[
"%s: %s"
%
(
error
.
field
.
get_value
(
'title'
),
[
"%s: %s"
%
(
error
.
field
.
get_value
(
'title'
),
error
.
error_text
)
for
error
in
e
.
errors
]
,
"<br />"
)
error
.
error_text
)
for
error
in
e
.
errors
])
return
self
.
formSettings
(
self
,
REQUEST
,
return
self
.
formSettings
(
self
,
REQUEST
,
manage_tabs_message
=
message
)
manage_tabs_message
=
message
)
# if we need to switch encoding, get xml representation before setting
# if we need to switch encoding, get xml representation before setting
...
@@ -906,7 +905,7 @@ class ZMIForm(ObjectManager, PropertyManager, RoleManager, Item, Form):
...
@@ -906,7 +905,7 @@ class ZMIForm(ObjectManager, PropertyManager, RoleManager, Item, Form):
field_ids
=
self
.
_get_field_ids
(
group
,
REQUEST
)
field_ids
=
self
.
_get_field_ids
(
group
,
REQUEST
)
if
(
to_group
!=
'Move to:'
and
if
(
to_group
!=
'Move to:'
and
self
.
move_field_group
(
field_ids
,
group
,
to_group
)):
self
.
move_field_group
(
field_ids
,
group
,
to_group
)):
fields
=
string
.
join
(
field_ids
,
", "
)
fields
=
", "
.
join
(
field_ids
)
message
=
"Fields %s transferred from %s to %s."
%
(
fields
,
message
=
"Fields %s transferred from %s to %s."
%
(
fields
,
group
,
group
,
to_group
)
to_group
)
...
@@ -920,7 +919,7 @@ class ZMIForm(ObjectManager, PropertyManager, RoleManager, Item, Form):
...
@@ -920,7 +919,7 @@ class ZMIForm(ObjectManager, PropertyManager, RoleManager, Item, Form):
def
manage_add_group
(
self
,
new_group
,
REQUEST
):
def
manage_add_group
(
self
,
new_group
,
REQUEST
):
"""Adds a new group.
"""Adds a new group.
"""
"""
group
=
string
.
strip
(
new_group
)
group
=
new_group
.
strip
(
)
if
(
group
and
group
!=
'Select group'
and
if
(
group
and
group
!=
'Select group'
and
self
.
add_group
(
group
)):
self
.
add_group
(
group
)):
message
=
"Group %s created."
%
(
group
)
message
=
"Group %s created."
%
(
group
)
...
@@ -947,7 +946,7 @@ class ZMIForm(ObjectManager, PropertyManager, RoleManager, Item, Form):
...
@@ -947,7 +946,7 @@ class ZMIForm(ObjectManager, PropertyManager, RoleManager, Item, Form):
"""Renames group.
"""Renames group.
"""
"""
if
'new_name'
in
REQUEST
:
if
'new_name'
in
REQUEST
:
new_name
=
string
.
strip
(
REQUEST
[
'new_name'
]
)
new_name
=
REQUEST
[
'new_name'
].
strip
(
)
if
self
.
rename_group
(
group
,
new_name
):
if
self
.
rename_group
(
group
,
new_name
):
message
=
"Group %s renamed to %s."
%
(
group
,
new_name
)
message
=
"Group %s renamed to %s."
%
(
group
,
new_name
)
else
:
else
:
...
...
product/Formulator/FormToXML.py
View file @
68bec827
# -*- coding: utf-8 -*-
# -*- coding: utf-8 -*-
import
six
import
six
from
cgi
import
escape
from
lxml
import
etree
from
lxml
import
etree
from
lxml.etree
import
Element
,
SubElement
,
CDATA
from
lxml.etree
import
Element
,
SubElement
from
lxml.builder
import
E
from
lxml.builder
import
E
def
formToXML
(
form
,
prologue
=
1
):
def
formToXML
(
form
,
prologue
=
1
):
...
@@ -21,7 +20,7 @@ def formToXML(form, prologue=1):
...
@@ -21,7 +20,7 @@ def formToXML(form, prologue=1):
else
:
else
:
value
=
'false'
value
=
'false'
sub_element
=
SubElement
(
form_as_xml
,
id
)
sub_element
=
SubElement
(
form_as_xml
,
id
)
sub_element
.
text
=
escape
(
str
(
value
)
).
decode
(
encoding
)
sub_element
.
text
=
str
(
value
).
decode
(
encoding
)
groups
=
SubElement
(
form_as_xml
,
'groups'
)
groups
=
SubElement
(
form_as_xml
,
'groups'
)
# export form groups
# export form groups
for
group
in
form
.
get_groups
(
include_empty
=
1
):
for
group
in
form
.
get_groups
(
include_empty
=
1
):
...
@@ -58,7 +57,7 @@ def formToXML(form, prologue=1):
...
@@ -58,7 +57,7 @@ def formToXML(form, prologue=1):
if
not
isinstance
(
value
,
six
.
string_types
):
if
not
isinstance
(
value
,
six
.
string_types
):
value
=
str
(
value
)
value
=
str
(
value
)
value_element
=
SubElement
(
values_element
,
key
)
value_element
=
SubElement
(
values_element
,
key
)
value_element
.
text
=
escape
(
str
(
value
)
).
decode
(
encoding
)
value_element
.
text
=
str
(
value
).
decode
(
encoding
)
tales_element
=
SubElement
(
field_element
,
'tales'
)
tales_element
=
SubElement
(
field_element
,
'tales'
)
items
=
field
.
tales
.
items
()
items
=
field
.
tales
.
items
()
...
@@ -66,11 +65,11 @@ def formToXML(form, prologue=1):
...
@@ -66,11 +65,11 @@ def formToXML(form, prologue=1):
for
key
,
value
in
items
:
for
key
,
value
in
items
:
if
value
:
if
value
:
tale_element
=
SubElement
(
tales_element
,
key
)
tale_element
=
SubElement
(
tales_element
,
key
)
tale_element
.
text
=
escape
(
str
(
value
.
_text
)
).
decode
(
encoding
)
tale_element
.
text
=
str
(
value
.
_text
).
decode
(
encoding
)
messages
=
SubElement
(
field_element
,
'messages'
)
messages
=
SubElement
(
field_element
,
'messages'
)
for
message_key
in
field
.
get_error_names
():
for
message_key
in
field
.
get_error_names
():
message_element
=
SubElement
(
messages
,
'message'
,
name
=
message_key
)
message_element
=
SubElement
(
messages
,
'message'
,
name
=
message_key
)
message_element
.
text
=
escape
(
field
.
get_error_message
(
message_key
)
).
decode
(
encoding
)
message_element
.
text
=
field
.
get_error_message
(
message_key
).
decode
(
encoding
)
# Special attribute for ProxyFields *delegated_list*
# Special attribute for ProxyFields *delegated_list*
delegated_list
=
getattr
(
field
,
'delegated_list'
,
[])
delegated_list
=
getattr
(
field
,
'delegated_list'
,
[])
if
delegated_list
:
if
delegated_list
:
...
@@ -78,8 +77,6 @@ def formToXML(form, prologue=1):
...
@@ -78,8 +77,6 @@ def formToXML(form, prologue=1):
delegated_list
.
sort
()
delegated_list
.
sort
()
[
SubElement
(
delegated_list_element
,
delegated
)
for
delegated
in
delegated_list
]
[
SubElement
(
delegated_list_element
,
delegated
)
for
delegated
in
delegated_list
]
form_as_string
=
etree
.
tostring
(
form_as_xml
,
encoding
=
'utf-8'
,
xml_declaration
=
True
,
pretty_print
=
True
)
if
form
.
unicode_mode
:
if
form
.
unicode_mode
:
return
etree
.
tostring
(
form_as_xml
,
encoding
=
'utf-8'
,
return
etree
.
tostring
(
form_as_xml
,
encoding
=
'utf-8'
,
xml_declaration
=
True
,
pretty_print
=
True
)
xml_declaration
=
True
,
pretty_print
=
True
)
...
...
product/Formulator/ListTextAreaField.py
View file @
68bec827
from
__future__
import
absolute_import
from
__future__
import
absolute_import
import
string
from
.DummyField
import
fields
from
.DummyField
import
fields
from
.
import
Widget
,
Validator
from
.
import
Widget
,
Validator
from
.Field
import
ZMIField
from
.Field
import
ZMIField
...
@@ -17,7 +16,7 @@ class ListTextAreaWidget(Widget.TextAreaWidget):
...
@@ -17,7 +16,7 @@ class ListTextAreaWidget(Widget.TextAreaWidget):
for
element_text
,
element_value
in
value
:
for
element_text
,
element_value
in
value
:
lines
.
append
(
"%s | %s"
%
(
element_text
,
element_value
))
lines
.
append
(
"%s | %s"
%
(
element_text
,
element_value
))
return
Widget
.
TextAreaWidget
.
render
(
self
,
field
,
key
,
return
Widget
.
TextAreaWidget
.
render
(
self
,
field
,
key
,
string
.
join
(
lines
,
'
\
n
'
),
'
\
n
'
.
join
(
lines
),
REQUEST
)
REQUEST
)
ListTextAreaWidgetInstance
=
ListTextAreaWidget
()
ListTextAreaWidgetInstance
=
ListTextAreaWidget
()
...
@@ -30,14 +29,14 @@ class ListLinesValidator(Validator.LinesValidator):
...
@@ -30,14 +29,14 @@ class ListLinesValidator(Validator.LinesValidator):
value
=
Validator
.
LinesValidator
.
validate
(
self
,
field
,
key
,
REQUEST
)
value
=
Validator
.
LinesValidator
.
validate
(
self
,
field
,
key
,
REQUEST
)
result
=
[]
result
=
[]
for
line
in
value
:
for
line
in
value
:
elements
=
string
.
split
(
line
,
"|"
)
elements
=
line
.
split
(
"|"
)
if
len
(
elements
)
>=
2
:
if
len
(
elements
)
>=
2
:
text
,
value
=
elements
[:
2
]
text
,
value
=
elements
[:
2
]
else
:
else
:
text
=
line
text
=
line
value
=
line
value
=
line
text
=
string
.
strip
(
text
)
text
=
text
.
strip
(
)
value
=
string
.
strip
(
value
)
value
=
value
.
strip
(
)
result
.
append
((
text
,
value
))
result
.
append
((
text
,
value
))
return
result
return
result
...
...
product/Formulator/Widget.py
View file @
68bec827
...
@@ -6,7 +6,7 @@ import string
...
@@ -6,7 +6,7 @@ import string
from
.DummyField
import
fields
from
.DummyField
import
fields
from
DocumentTemplate.DT_Util
import
html_quote
from
DocumentTemplate.DT_Util
import
html_quote
from
DateTime
import
DateTime
,
Timezones
from
DateTime
import
DateTime
,
Timezones
from
cgi
import
escap
e
from
Products.PythonScripts.standard
import
html_quot
e
import
types
import
types
from
DocumentTemplate.ustr
import
ustr
from
DocumentTemplate.ustr
import
ustr
from
six.moves.urllib.parse
import
urljoin
from
six.moves.urllib.parse
import
urljoin
...
@@ -441,7 +441,7 @@ class TextWidget(Widget):
...
@@ -441,7 +441,7 @@ class TextWidget(Widget):
old_value
=
[
str
(
value
)]
old_value
=
[
str
(
value
)]
value
=
[]
value
=
[]
for
line
in
old_value
:
for
line
in
old_value
:
value
.
append
(
escap
e
(
line
))
value
.
append
(
html_quot
e
(
line
))
value
=
'<br/>'
.
join
(
value
)
value
=
'<br/>'
.
join
(
value
)
extra
=
field
.
get_value
(
'extra'
)
extra
=
field
.
get_value
(
'extra'
)
...
@@ -686,7 +686,7 @@ class TextAreaWidget(Widget):
...
@@ -686,7 +686,7 @@ class TextAreaWidget(Widget):
value
=
str
(
value
)
value
=
str
(
value
)
value
=
value
.
split
(
'
\
n
'
)
value
=
value
.
split
(
'
\
n
'
)
line_separator
=
'<br/>'
line_separator
=
'<br/>'
value_list
=
[
escap
e
(
part
).
replace
(
'
\
n
'
,
line_separator
)
for
part
in
value
]
value_list
=
[
html_quot
e
(
part
).
replace
(
'
\
n
'
,
line_separator
)
for
part
in
value
]
value
=
line_separator
.
join
(
value_list
)
value
=
line_separator
.
join
(
value_list
)
return
render_element
(
"div"
,
return
render_element
(
"div"
,
css_class
=
field
.
get_value
(
'css_class'
),
css_class
=
field
.
get_value
(
'css_class'
),
...
@@ -751,7 +751,7 @@ class LinesTextAreaWidget(TextAreaWidget):
...
@@ -751,7 +751,7 @@ class LinesTextAreaWidget(TextAreaWidget):
value
=
value
.
split
(
'
\
n
'
)
value
=
value
.
split
(
'
\
n
'
)
line_separator
=
field
.
get_value
(
'view_separator'
)
line_separator
=
field
.
get_value
(
'view_separator'
)
value_list
=
[
escap
e
(
convertToString
(
part
)).
replace
(
'
\
n
'
,
line_separator
)
for
part
in
value
]
value_list
=
[
html_quot
e
(
convertToString
(
part
)).
replace
(
'
\
n
'
,
line_separator
)
for
part
in
value
]
value
=
line_separator
.
join
(
value_list
)
value
=
line_separator
.
join
(
value_list
)
return
render_element
(
"div"
,
return
render_element
(
"div"
,
css_class
=
field
.
get_value
(
'css_class'
),
css_class
=
field
.
get_value
(
'css_class'
),
...
@@ -898,14 +898,14 @@ class SingleItemsWidget(ItemsWidget):
...
@@ -898,14 +898,14 @@ class SingleItemsWidget(ItemsWidget):
item_value
=
item
item_value
=
item
if
item_value
==
value
and
not
selected_found
:
if
item_value
==
value
and
not
selected_found
:
rendered_item
=
self
.
render_selected_item
(
escap
e
(
ustr
(
item_text
)),
rendered_item
=
self
.
render_selected_item
(
html_quot
e
(
ustr
(
item_text
)),
item_value
,
item_value
,
key
,
key
,
css_class
,
css_class
,
extra_item
)
extra_item
)
selected_found
=
1
selected_found
=
1
else
:
else
:
rendered_item
=
self
.
render_item
(
escap
e
(
ustr
(
item_text
)),
rendered_item
=
self
.
render_item
(
html_quot
e
(
ustr
(
item_text
)),
item_value
,
item_value
,
key
,
key
,
css_class
,
css_class
,
...
@@ -915,7 +915,7 @@ class SingleItemsWidget(ItemsWidget):
...
@@ -915,7 +915,7 @@ class SingleItemsWidget(ItemsWidget):
# XXX We want to make sure that we always have the current value in items. -yo
# XXX We want to make sure that we always have the current value in items. -yo
if
not
selected_found
and
value
:
if
not
selected_found
and
value
:
value
=
escap
e
(
ustr
(
value
))
value
=
html_quot
e
(
ustr
(
value
))
rendered_item
=
self
.
render_selected_item
(
'??? (%s)'
%
value
,
rendered_item
=
self
.
render_selected_item
(
'??? (%s)'
%
value
,
value
,
value
,
key
,
key
,
...
@@ -934,7 +934,7 @@ class SingleItemsWidget(ItemsWidget):
...
@@ -934,7 +934,7 @@ class SingleItemsWidget(ItemsWidget):
return
''
return
''
title_list
=
[
x
[
0
]
for
x
in
field
.
get_value
(
"items"
,
REQUEST
=
REQUEST
)
if
x
[
1
]
==
value
]
title_list
=
[
x
[
0
]
for
x
in
field
.
get_value
(
"items"
,
REQUEST
=
REQUEST
)
if
x
[
1
]
==
value
]
if
len
(
title_list
)
==
0
:
if
len
(
title_list
)
==
0
:
return
"??? (%s)"
%
escap
e
(
value
)
return
"??? (%s)"
%
html_quot
e
(
value
)
else
:
else
:
return
title_list
[
0
]
return
title_list
[
0
]
return
value
return
value
...
@@ -1029,7 +1029,7 @@ class MultiItemsWidget(ItemsWidget):
...
@@ -1029,7 +1029,7 @@ class MultiItemsWidget(ItemsWidget):
if
item_value
in
value
:
if
item_value
in
value
:
rendered_item
=
self
.
render_selected_item
(
rendered_item
=
self
.
render_selected_item
(
escap
e
(
ustr
(
item_text
)),
html_quot
e
(
ustr
(
item_text
)),
item_value
,
item_value
,
key
,
key
,
css_class
,
css_class
,
...
@@ -1039,7 +1039,7 @@ class MultiItemsWidget(ItemsWidget):
...
@@ -1039,7 +1039,7 @@ class MultiItemsWidget(ItemsWidget):
selected_found
[
index
]
=
1
selected_found
[
index
]
=
1
else
:
else
:
rendered_item
=
self
.
render_item
(
rendered_item
=
self
.
render_item
(
escap
e
(
ustr
(
item_text
)),
html_quot
e
(
ustr
(
item_text
)),
item_value
,
item_value
,
key
,
key
,
css_class
,
css_class
,
...
@@ -1050,7 +1050,7 @@ class MultiItemsWidget(ItemsWidget):
...
@@ -1050,7 +1050,7 @@ class MultiItemsWidget(ItemsWidget):
for
index
in
range
(
len
(
value
)):
for
index
in
range
(
len
(
value
)):
v
=
value
[
index
]
v
=
value
[
index
]
if
index
not
in
selected_found
and
v
:
if
index
not
in
selected_found
and
v
:
v
=
escap
e
(
v
)
v
=
html_quot
e
(
v
)
rendered_item
=
self
.
render_selected_item
(
'??? (%s)'
%
v
,
rendered_item
=
self
.
render_selected_item
(
'??? (%s)'
%
v
,
v
,
v
,
key
,
key
,
...
...
product/Formulator/XMLObjects.py
View file @
68bec827
# -*- coding: utf-8 -*-
# -*- coding: utf-8 -*-
from
xml.dom.minidom
import
parse
,
parseString
,
Node
from
xml.dom.minidom
import
parse
,
parseString
,
Node
from
xml.sax.saxutils
import
unescape
# an extremely simple system for loading in XML into objects
# an extremely simple system for loading in XML into objects
class
Object
:
class
Object
:
...
@@ -41,7 +40,7 @@ def attributeToObject(parent, node):
...
@@ -41,7 +40,7 @@ def attributeToObject(parent, node):
def
textToObject
(
parent
,
node
):
def
textToObject
(
parent
,
node
):
# add this text to parents text content
# add this text to parents text content
parent
.
text
+=
unescape
(
node
.
data
)
parent
.
text
+=
node
.
data
def
processingInstructionToObject
(
parent
,
node
):
def
processingInstructionToObject
(
parent
,
node
):
# don't do anything with these
# don't do anything with these
...
...
product/Formulator/dtml/FieldHelpTopic.dtml
View file @
68bec827
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
<dtml-in get_groups>
<dtml-in get_groups>
<dtml-let group=sequence-item fields="get_fields_in_group(group)">
<dtml-let group=sequence-item fields="get_fields_in_group(group)">
<dtml-if fields>
<dtml-if fields>
<h4><i><dtml-var
"_.string.capitalize(group)"
> properties</i></h4>
<h4><i><dtml-var
group capitalize
> properties</i></h4>
<dtml-in fields>
<dtml-in fields>
<dtml-let field=sequence-item>
<dtml-let field=sequence-item>
<b><dtml-var "field.get_value('title')"> (<dtml-var "field.id">)</b>
<b><dtml-var "field.get_value('title')"> (<dtml-var "field.id">)</b>
...
...
product/Formulator/dtml/fieldEdit.dtml
View file @
68bec827
...
@@ -17,7 +17,7 @@ Edit <dtml-var meta_type> properties here.
...
@@ -17,7 +17,7 @@ Edit <dtml-var meta_type> properties here.
<dtml-if fields>
<dtml-if fields>
<tr>
<tr>
<td colspan="4" class="form-title">
<td colspan="4" class="form-title">
<dtml-var
"_.string.capitalize(group)"
> properties
<dtml-var
group capitalize
> properties
</td>
</td>
</tr>
</tr>
...
...
product/Formulator/dtml/fieldOverride.dtml
View file @
68bec827
...
@@ -14,7 +14,7 @@ Edit <dtml-var meta_type> method overrides here.
...
@@ -14,7 +14,7 @@ Edit <dtml-var meta_type> method overrides here.
<dtml-if fields>
<dtml-if fields>
<tr>
<tr>
<td colspan="3" class="form-title">
<td colspan="3" class="form-title">
<dtml-var
"_.string.capitalize(group)"
> properties
<dtml-var
group capitalize
> properties
</td>
</td>
</tr>
</tr>
...
...
product/Formulator/dtml/fieldTales.dtml
View file @
68bec827
...
@@ -21,7 +21,7 @@ This tab can therefore not be used.
...
@@ -21,7 +21,7 @@ This tab can therefore not be used.
<dtml-if fields>
<dtml-if fields>
<tr>
<tr>
<td colspan="3" class="form-title">
<td colspan="3" class="form-title">
<dtml-var
"_.string.capitalize(group)"
> properties
<dtml-var
group capitalize
> properties
</td>
</td>
</tr>
</tr>
...
...
product/HBTreeFolder2/HBTreeFolder2.py
View file @
68bec827
...
@@ -13,7 +13,7 @@
...
@@ -13,7 +13,7 @@
##############################################################################
##############################################################################
import
operator
import
operator
from
cgi
import
escap
e
from
Products.PythonScripts.standard
import
html_quot
e
from
itertools
import
chain
,
islice
from
itertools
import
chain
,
islice
import
six
import
six
try
:
try
:
...
@@ -309,8 +309,8 @@ class HBTreeFolder2Base (Persistent):
...
@@ -309,8 +309,8 @@ class HBTreeFolder2Base (Persistent):
formatted
=
[
listtext0
%
pref_rows
]
formatted
=
[
listtext0
%
pref_rows
]
for
optID
in
islice
(
self
.
objectIds
(),
b_start
-
1
,
b_end
):
for
optID
in
islice
(
self
.
objectIds
(),
b_start
-
1
,
b_end
):
optID
=
escap
e
(
optID
)
optID
=
html_quot
e
(
optID
)
formatted
.
append
(
listtext1
%
(
escape
(
optID
,
quote
=
1
),
optID
))
formatted
.
append
(
listtext1
%
(
html_quote
(
optID
),
optID
))
formatted
.
append
(
listtext2
)
formatted
.
append
(
listtext2
)
return
{
'b_start'
:
b_start
,
'b_end'
:
b_end
,
return
{
'b_start'
:
b_start
,
'b_end'
:
b_end
,
'prev_batch_url'
:
prev_url
,
'prev_batch_url'
:
prev_url
,
...
...
product/PortalTransforms/transforms/python.py
View file @
68bec827
...
@@ -15,7 +15,6 @@ Original code from active state recipe
...
@@ -15,7 +15,6 @@ Original code from active state recipe
"""
"""
__revision__
=
'$Id: python.py 3661 2005-02-23 17:05:31Z tiran $'
__revision__
=
'$Id: python.py 3661 2005-02-23 17:05:31Z tiran $'
import
string
import
keyword
,
token
,
tokenize
import
keyword
,
token
,
tokenize
from
six.moves
import
cStringIO
as
StringIO
from
six.moves
import
cStringIO
as
StringIO
...
@@ -35,7 +34,7 @@ class Parser:
...
@@ -35,7 +34,7 @@ class Parser:
def
__init__
(
self
,
raw
,
tags
,
out
):
def
__init__
(
self
,
raw
,
tags
,
out
):
""" Store the source text.
""" Store the source text.
"""
"""
self
.
raw
=
string
.
strip
(
string
.
expandtabs
(
raw
)
)
self
.
raw
=
raw
.
expandtabs
().
strip
(
)
self
.
out
=
out
self
.
out
=
out
self
.
tags
=
tags
self
.
tags
=
tags
...
@@ -46,7 +45,7 @@ class Parser:
...
@@ -46,7 +45,7 @@ class Parser:
self
.
lines
=
[
0
,
0
]
self
.
lines
=
[
0
,
0
]
pos
=
0
pos
=
0
while
1
:
while
1
:
pos
=
s
tring
.
find
(
self
.
raw
,
'
\
n
'
,
pos
)
+
1
pos
=
s
elf
.
raw
.
find
(
'
\
n
'
,
pos
)
+
1
if
not
pos
:
break
if
not
pos
:
break
self
.
lines
.
append
(
pos
)
self
.
lines
.
append
(
pos
)
self
.
lines
.
append
(
len
(
self
.
raw
))
self
.
lines
.
append
(
len
(
self
.
raw
))
...
...
product/PortalTransforms/transforms/safe_html.py
View file @
68bec827
...
@@ -3,7 +3,7 @@ from six import unichr
...
@@ -3,7 +3,7 @@ from six import unichr
from
zLOG
import
ERROR
from
zLOG
import
ERROR
from
six.moves.html_parser
import
HTMLParser
,
HTMLParseError
from
six.moves.html_parser
import
HTMLParser
,
HTMLParseError
import
re
import
re
from
cgi
import
escap
e
from
Products.PythonScripts.standard
import
html_quot
e
import
codecs
import
codecs
from
Products.PortalTransforms.interfaces
import
ITransform
from
Products.PortalTransforms.interfaces
import
ITransform
...
@@ -220,7 +220,7 @@ class StrippingParser(HTMLParser):
...
@@ -220,7 +220,7 @@ class StrippingParser(HTMLParser):
def handle_data(self, data):
def handle_data(self, data):
if self.suppress: return
if self.suppress: return
data =
escap
e(data)
data =
html_quot
e(data)
if self.original_charset and isinstance(data, str):
if self.original_charset and isinstance(data, str):
data = data.decode(self.original_charset)
data = data.decode(self.original_charset)
self.result.append(data)
self.result.append(data)
...
@@ -294,7 +294,7 @@ class StrippingParser(HTMLParser):
...
@@ -294,7 +294,7 @@ class StrippingParser(HTMLParser):
self
.
original_charset
=
charset
self
.
original_charset
=
charset
v
=
charset_parser
.
sub
(
v
=
charset_parser
.
sub
(
CharsetReplacer
(
self
.
default_encoding
),
v
)
CharsetReplacer
(
self
.
default_encoding
),
v
)
self
.
result
.
append
(
' %s="%s"'
%
(
k
,
escap
e
(
v
,
True
)))
self
.
result
.
append
(
' %s="%s"'
%
(
k
,
html_quot
e
(
v
,
True
)))
#UNUSED endTag = '</%s>' % tag
#UNUSED endTag = '</%s>' % tag
if
safeToInt
(
self
.
valid
.
get
(
tag
)):
if
safeToInt
(
self
.
valid
.
get
(
tag
)):
...
...
product/ZSQLCatalog/SQLCatalog.py
View file @
68bec827
...
@@ -49,7 +49,6 @@ from inspect import CO_VARKEYWORDS
...
@@ -49,7 +49,6 @@ from inspect import CO_VARKEYWORDS
from
functools
import
wraps
from
functools
import
wraps
import
time
import
time
from
six.moves
import
urllib
from
six.moves
import
urllib
import
string
import
pprint
import
pprint
import
re
import
re
import
warnings
import
warnings
...
@@ -1216,7 +1215,7 @@ class Catalog(Folder,
...
@@ -1216,7 +1215,7 @@ class Catalog(Folder,
words
=
0
words
=
0
obj
=
REQUEST
.
PARENTS
[
1
]
obj
=
REQUEST
.
PARENTS
[
1
]
path
=
string
.
join
(
obj
.
getPhysicalPath
(),
'/'
)
path
=
'/'
.
join
(
obj
.
getPhysicalPath
()
)
results
=
self
.
aq_parent
.
ZopeFindAndApply
(
obj
,
results
=
self
.
aq_parent
.
ZopeFindAndApply
(
obj
,
obj_metatypes
=
obj_metatypes
,
obj_metatypes
=
obj_metatypes
,
...
...
product/ZSQLCatalog/ZSQLCatalog.py
View file @
68bec827
...
@@ -35,7 +35,7 @@ from AccessControl import ClassSecurityInfo
...
@@ -35,7 +35,7 @@ from AccessControl import ClassSecurityInfo
from
DocumentTemplate.security
import
RestrictedDTML
from
DocumentTemplate.security
import
RestrictedDTML
from
Products.CMFCore.utils
import
getToolByName
from
Products.CMFCore.utils
import
getToolByName
from
Products.ERP5Type.Cache
import
clearCache
from
Products.ERP5Type.Cache
import
clearCache
import
s
tring
,
s
ys
import
sys
import
time
import
time
from
ZODB.POSException
import
ConflictError
from
ZODB.POSException
import
ConflictError
...
@@ -532,7 +532,7 @@ class ZCatalog(Folder, Persistent, Implicit):
...
@@ -532,7 +532,7 @@ class ZCatalog(Folder, Persistent, Implicit):
def
manage_edit
(
self
,
RESPONSE
,
URL1
,
threshold
=
1000
,
REQUEST
=
None
):
def
manage_edit
(
self
,
RESPONSE
,
URL1
,
threshold
=
1000
,
REQUEST
=
None
):
""" edit the catalog """
""" edit the catalog """
if
type
(
threshold
)
is
not
type
(
1
):
if
type
(
threshold
)
is
not
type
(
1
):
threshold
=
string
.
atoi
(
threshold
)
threshold
=
int
(
threshold
)
self
.
threshold
=
threshold
self
.
threshold
=
threshold
RESPONSE
.
redirect
(
URL1
+
'/manage_main?manage_tabs_message=Catalog%20Changed'
)
RESPONSE
.
redirect
(
URL1
+
'/manage_main?manage_tabs_message=Catalog%20Changed'
)
...
@@ -616,7 +616,7 @@ class ZCatalog(Folder, Persistent, Implicit):
...
@@ -616,7 +616,7 @@ class ZCatalog(Folder, Persistent, Implicit):
words
=
0
words
=
0
obj
=
REQUEST
.
PARENTS
[
1
]
obj
=
REQUEST
.
PARENTS
[
1
]
path
=
string
.
join
(
obj
.
getPhysicalPath
(),
'/'
)
path
=
'/'
.
join
(
obj
.
getPhysicalPath
()
)
results
=
self
.
ZopeFindAndApply
(
obj
,
results
=
self
.
ZopeFindAndApply
(
obj
,
...
@@ -1012,7 +1012,7 @@ class ZCatalog(Folder, Persistent, Implicit):
...
@@ -1012,7 +1012,7 @@ class ZCatalog(Folder, Persistent, Implicit):
"""
"""
Return the attribute names as a single string
Return the attribute names as a single string
"""
"""
return
string
.
join
(
self
.
names
(
sql_catalog_id
=
sql_catalog_id
).
get
(
column
,
(
''
,)),
' '
)
return
' '
.
join
(
self
.
names
(
sql_catalog_id
=
sql_catalog_id
).
get
(
column
,
(
''
,))
)
def
_searchable_arguments
(
self
,
sql_catalog_id
=
None
):
def
_searchable_arguments
(
self
,
sql_catalog_id
=
None
):
catalog
=
self
.
getSQLCatalog
(
sql_catalog_id
)
catalog
=
self
.
getSQLCatalog
(
sql_catalog_id
)
...
@@ -1178,7 +1178,7 @@ class ZCatalog(Folder, Persistent, Implicit):
...
@@ -1178,7 +1178,7 @@ class ZCatalog(Folder, Persistent, Implicit):
and
and
(
not
obj_searchterm
or
(
not
obj_searchterm
or
(
hasattr
(
ob
,
'PrincipiaSearchSource'
)
and
(
hasattr
(
ob
,
'PrincipiaSearchSource'
)
and
string
.
find
(
ob
.
PrincipiaSearchSource
(),
obj_searchterm
)
>=
0
ob
.
PrincipiaSearchSource
().
find
(
obj_searchterm
)
>=
0
))
))
and
and
(
not
obj_expr
or
expr_match
(
ob
,
obj_expr
))
(
not
obj_expr
or
expr_match
(
ob
,
obj_expr
))
...
@@ -1217,7 +1217,7 @@ class ZCatalog(Folder, Persistent, Implicit):
...
@@ -1217,7 +1217,7 @@ class ZCatalog(Folder, Persistent, Implicit):
No exceptions are raised.
No exceptions are raised.
"""
"""
script
=
REQUEST
.
script
script
=
REQUEST
.
script
if
string
.
find
(
path
,
script
)
!=
0
:
if
path
.
find
(
script
)
!=
0
:
path
=
'%s/%s'
%
(
script
,
path
)
path
=
'%s/%s'
%
(
script
,
path
)
try
:
try
:
return
REQUEST
.
resolve_url
(
path
)
return
REQUEST
.
resolve_url
(
path
)
...
@@ -1267,7 +1267,7 @@ class ZCatalog(Folder, Persistent, Implicit):
...
@@ -1267,7 +1267,7 @@ class ZCatalog(Folder, Persistent, Implicit):
if
ob
is
None
:
if
ob
is
None
:
removed
.
append
(
path
)
removed
.
append
(
path
)
continue
continue
ppath
=
string
.
join
(
ob
.
getPhysicalPath
(),
'/'
)
ppath
=
'/'
.
join
(
ob
.
getPhysicalPath
()
)
if
path
!=
ppath
:
if
path
!=
ppath
:
fixed
.
append
((
path
,
ppath
))
fixed
.
append
((
path
,
ppath
))
else
:
else
:
...
...
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