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
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
Romain Courteaud
erp5
Commits
8637adef
Commit
8637adef
authored
Jun 28, 2017
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
web: fix problems reported by pylint
parent
20542e58
Changes
18
Hide whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
43 additions
and
50 deletions
+43
-50
bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/Base_convertHtmlToSingleFile.py
...tem/portal_skins/erp5_web/Base_convertHtmlToSingleFile.py
+2
-0
bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/Form_getGroupList.xml
...nTemplateItem/portal_skins/erp5_web/Form_getGroupList.xml
+1
-1
bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/StaticWebSection_getDocumentValue.py
...ortal_skins/erp5_web/StaticWebSection_getDocumentValue.py
+0
-5
bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/WebPage_exportAsSingleFile.py
...eItem/portal_skins/erp5_web/WebPage_exportAsSingleFile.py
+2
-1
bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/WebPage_hashPublicationSectionItemList.py
..._skins/erp5_web/WebPage_hashPublicationSectionItemList.py
+3
-1
bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/WebPage_hashPublicationSectionItemList.xml
...skins/erp5_web/WebPage_hashPublicationSectionItemList.xml
+1
-1
bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/WebSection_createNewWebPage.py
...Item/portal_skins/erp5_web/WebSection_createNewWebPage.py
+1
-1
bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/WebSection_generateSectionFromCategory.py
..._skins/erp5_web/WebSection_generateSectionFromCategory.py
+5
-2
bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/WebSection_getDefaultDocumentValue.py
...rtal_skins/erp5_web/WebSection_getDefaultDocumentValue.py
+0
-5
bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/WebSection_newDefaultWebPage.py
...tem/portal_skins/erp5_web/WebSection_newDefaultWebPage.py
+0
-1
bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/WebSite_createWebSiteAccount.py
...tem/portal_skins/erp5_web/WebSite_createWebSiteAccount.py
+7
-7
bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/WebSite_getMainSectionList.py
...eItem/portal_skins/erp5_web/WebSite_getMainSectionList.py
+1
-1
bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/WebSite_logout.py
.../SkinTemplateItem/portal_skins/erp5_web/WebSite_logout.py
+1
-1
bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web_widget_library/Base_getWorkflowEventInfoList.py
.../erp5_web_widget_library/Base_getWorkflowEventInfoList.py
+6
-6
bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web_widget_library/WebSection_viewInlinePageRenderer.py
...5_web_widget_library/WebSection_viewInlinePageRenderer.py
+5
-5
bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web_widget_library/WebSection_viewSubjectIndexRenderer.py
...web_widget_library/WebSection_viewSubjectIndexRenderer.py
+0
-2
bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web_widget_library/WebSite_redirectToUserPreference.py
...p5_web_widget_library/WebSite_redirectToUserPreference.py
+0
-2
bt5/erp5_web/WorkflowTemplateItem/portal_workflow/category_publication_workflow/scripts/expireAll.py
...rkflow/category_publication_workflow/scripts/expireAll.py
+8
-8
No files found.
bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/Base_convertHtmlToSingleFile.py
View file @
8637adef
...
@@ -12,6 +12,8 @@ Export the web page and its components to a single (m)html file.
...
@@ -12,6 +12,8 @@ Export the web page and its components to a single (m)html file.
TODO: export same components into one mhtml attachment if possible.
TODO: export same components into one mhtml attachment if possible.
"""
"""
# ERP5 web uses format= argument, which is also a python builtin
# pylint: disable=redefined-builtin
from
zExceptions
import
Unauthorized
from
zExceptions
import
Unauthorized
from
base64
import
b64encode
,
b64decode
from
base64
import
b64encode
,
b64decode
...
...
bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/Form_getGroupList.xml
View file @
8637adef
...
@@ -50,7 +50,7 @@
...
@@ -50,7 +50,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
_params
</string>
</key>
<key>
<string>
_params
</string>
</key>
<value>
<string>
group_by_criterion=
[\'left\', \'right\', \'center\', \'bottom\', \'hidden\']
</string>
</value>
<value>
<string>
group_by_criterion=
(\'left\', \'right\', \'center\', \'bottom\', \'hidden\')
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
id
</string>
</key>
<key>
<string>
id
</string>
</key>
...
...
bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/StaticWebSection_getDocumentValue.py
View file @
8637adef
...
@@ -20,11 +20,6 @@
...
@@ -20,11 +20,6 @@
"""
"""
from
Products.ZSQLCatalog.SQLCatalog
import
SimpleQuery
,
ComplexQuery
from
Products.ZSQLCatalog.SQLCatalog
import
SimpleQuery
,
ComplexQuery
if
portal
is
None
:
portal
=
context
.
getPortalObject
()
if
portal
is
None
:
portal
=
context
.
getPortalObject
()
portal_catalog
=
portal
.
portal_catalog
# The list of portal types here should be large enough to include
# all portal_types defined in the various sections so that
# href tags which point to a document by reference can still work.
valid_portal_type_list
=
portal
.
getPortalDocumentTypeList
()
# Find the applicable language
# Find the applicable language
if
language
is
None
:
if
language
is
None
:
...
...
bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/WebPage_exportAsSingleFile.py
View file @
8637adef
...
@@ -3,7 +3,8 @@ Export the web page and its components to a single (m)html file.
...
@@ -3,7 +3,8 @@ Export the web page and its components to a single (m)html file.
see Base_convertHtmlToSingleFile for documentation
see Base_convertHtmlToSingleFile for documentation
"""
"""
# ERP5 web uses format= argument, which is also a python builtin
# pylint: disable=redefined-builtin
data
=
context
.
Base_convertHtmlToSingleFile
(
data
=
context
.
Base_convertHtmlToSingleFile
(
context
.
getTextContent
(
""
),
context
.
getTextContent
(
""
),
allow_script
=
allow_script
,
allow_script
=
allow_script
,
...
...
bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/WebPage_hashPublicationSectionItemList.py
View file @
8637adef
...
@@ -5,6 +5,8 @@
...
@@ -5,6 +5,8 @@
"""
"""
# Initialise result
# Initialise result
sub_field_list
=
[]
sub_field_list
=
[]
if
default_sub_field_property_dict
is
None
:
default_sub_field_property_dict
=
{}
# Maximum size of the MultiListField
# Maximum size of the MultiListField
default_sub_field_property_dict
.
update
({
default_sub_field_property_dict
.
update
({
...
@@ -17,7 +19,7 @@ default_sub_field_property_dict.update({
...
@@ -17,7 +19,7 @@ default_sub_field_property_dict.update({
})
})
z
=
0
z
=
0
for
i
in
range
(
1
):
for
_
in
range
(
1
):
new_dict
=
default_sub_field_property_dict
.
copy
()
new_dict
=
default_sub_field_property_dict
.
copy
()
new_dict
[
'title'
]
=
' '
new_dict
[
'title'
]
=
' '
new_dict
[
'key'
]
=
str
(
z
)
new_dict
[
'key'
]
=
str
(
z
)
...
...
bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/WebPage_hashPublicationSectionItemList.xml
View file @
8637adef
...
@@ -50,7 +50,7 @@
...
@@ -50,7 +50,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
_params
</string>
</key>
<key>
<string>
_params
</string>
</key>
<value>
<string>
item_list, value_list, default_sub_field_property_dict=
{}
, is_right_display=0
</string>
</value>
<value>
<string>
item_list, value_list, default_sub_field_property_dict=
None
, is_right_display=0
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
id
</string>
</key>
<key>
<string>
id
</string>
</key>
...
...
bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/WebSection_createNewWebPage.py
View file @
8637adef
request
=
context
.
REQUEST
request
=
context
.
REQUEST
request_form
=
context
.
REQUEST
.
form
request_form
=
request
.
form
from
ZTUtils
import
make_query
from
ZTUtils
import
make_query
portal
=
context
.
getPortalObject
()
portal
=
context
.
getPortalObject
()
title
=
context
.
getTitle
(
'Unknown'
)
title
=
context
.
getTitle
(
'Unknown'
)
...
...
bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/WebSection_generateSectionFromCategory.py
View file @
8637adef
...
@@ -5,6 +5,9 @@
...
@@ -5,6 +5,9 @@
category -- the category to use
category -- the category to use
"""
"""
# our pylint integration does not support global variabled in zope python script.
# pylint: disable=global-variable-undefined
from
ZODB.POSException
import
ConflictError
from
ZODB.POSException
import
ConflictError
portal
=
context
.
getPortalObject
()
portal
=
context
.
getPortalObject
()
translateString
=
context
.
Base_translateString
translateString
=
context
.
Base_translateString
...
@@ -20,7 +23,7 @@ def getNiceID(s):
...
@@ -20,7 +23,7 @@ def getNiceID(s):
s
=
s
.
lower
()
s
=
s
.
lower
()
s
=
s
.
split
()
s
=
s
.
split
()
s
=
'-'
.
join
(
s
)
s
=
'-'
.
join
(
s
)
s
=
filter
(
lambda
c
:
c
in
valid_char
,
s
)
s
=
[
c
for
c
in
s
if
c
in
valid_char
]
s
=
s
.
replace
(
'_'
,
'-'
)
s
=
s
.
replace
(
'_'
,
'-'
)
return
s
return
s
...
@@ -77,7 +80,7 @@ def createWebSectionFromCategoryValue(container, category, depth, section_id=Non
...
@@ -77,7 +80,7 @@ def createWebSectionFromCategoryValue(container, category, depth, section_id=Non
new_section
.
updateLocalRolesOnSecurityGroups
()
new_section
.
updateLocalRolesOnSecurityGroups
()
except
ConflictError
:
except
ConflictError
:
raise
raise
except
:
except
Exception
:
failed_list
.
append
(
category
.
getRelativeUrl
())
failed_list
.
append
(
category
.
getRelativeUrl
())
else
:
else
:
new_section
=
container
[
section_id
]
new_section
=
container
[
section_id
]
...
...
bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/WebSection_getDefaultDocumentValue.py
View file @
8637adef
...
@@ -24,11 +24,6 @@
...
@@ -24,11 +24,6 @@
portal skins. It is recommended to use the first approach
portal skins. It is recommended to use the first approach
to host multiple sites on a single ERP5Site instance.
to host multiple sites on a single ERP5Site instance.
"""
"""
portal_object
=
context
.
getPortalObject
()
# First find the Web Section or Web Site we belong to
current_section
=
context
.
getWebSectionValue
()
# First get all the applicable references
# First get all the applicable references
# There might be more than one reference due to security differences
# There might be more than one reference due to security differences
# (ex. a default restricted web page and a default public web page)
# (ex. a default restricted web page and a default public web page)
...
...
bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/WebSection_newDefaultWebPage.py
View file @
8637adef
request
=
context
.
REQUEST
portal
=
context
.
getPortalObject
()
portal
=
context
.
getPortalObject
()
title
=
context
.
getTitle
(
'Unknown'
)
title
=
context
.
getTitle
(
'Unknown'
)
translateString
=
context
.
Base_translateString
translateString
=
context
.
Base_translateString
...
...
bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/WebSite_createWebSiteAccount.py
View file @
8637adef
...
@@ -10,11 +10,11 @@
...
@@ -10,11 +10,11 @@
- you need to adjust group, function and site to your needs
- you need to adjust group, function and site to your needs
"""
"""
# pylint: disable=unreachable
# since the following code is just an example, we simply raise an exception so that
# since the following code is just an example, we simply raise an exception so that
# it is not executed actually.
# it is not executed actually.
raise
NotImplementedError
raise
NotImplementedError
from
Products.Formulator.Errors
import
ValidationError
,
FormValidationError
portal
=
context
.
getPortalObject
()
portal
=
context
.
getPortalObject
()
translateString
=
context
.
Base_translateString
translateString
=
context
.
Base_translateString
website
=
context
.
getWebSiteValue
()
website
=
context
.
getWebSiteValue
()
...
@@ -25,7 +25,7 @@ result, result_type = context.Base_edit(form_id, silent_mode=1, field_prefix='yo
...
@@ -25,7 +25,7 @@ result, result_type = context.Base_edit(form_id, silent_mode=1, field_prefix='yo
# Return if not appropriate
# Return if not appropriate
if
result_type
!=
'edit'
:
if
result_type
!=
'edit'
:
return
result
return
result
kw
,
encapsulated_editor_list
=
result
kw
,
_
=
result
# Set default values
# Set default values
person_group
=
kw
.
get
(
'group'
,
None
)
person_group
=
kw
.
get
(
'group'
,
None
)
...
@@ -55,11 +55,11 @@ person.validate()
...
@@ -55,11 +55,11 @@ person.validate()
#person.immediateReindexObject()
#person.immediateReindexObject()
# Create default career
# Create default career
career
=
person
.
newContent
(
portal_type
=
'Career'
,
person
.
newContent
(
portal_type
=
'Career'
,
id
=
'default_career'
,
id
=
'default_career'
,
group
=
person_group
,
group
=
person_group
,
function
=
person_function
,
function
=
person_function
,
role
=
person_role
)
role
=
person_role
)
# Create assignment
# Create assignment
assignment
=
person
.
newContent
(
portal_type
=
'Assignment'
,
assignment
=
person
.
newContent
(
portal_type
=
'Assignment'
,
group
=
person_group
,
group
=
person_group
,
...
...
bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/WebSite_getMainSectionList.py
View file @
8637adef
...
@@ -4,4 +4,4 @@
...
@@ -4,4 +4,4 @@
"""
"""
site
=
context
.
getWebSiteValue
()
site
=
context
.
getWebSiteValue
()
section_list
=
site
.
contentValues
(
portal_type
=
'Web Section'
,
sort_on
=
'int_index'
,
checked_permission
=
'View'
)
section_list
=
site
.
contentValues
(
portal_type
=
'Web Section'
,
sort_on
=
'int_index'
,
checked_permission
=
'View'
)
return
filter
(
lambda
x
:
x
.
isVisible
(),
section_list
)
return
[
x
for
x
in
section_list
if
x
.
isVisible
()]
bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/WebSite_logout.py
View file @
8637adef
...
@@ -4,7 +4,7 @@
...
@@ -4,7 +4,7 @@
website
=
context
.
getWebSiteValue
()
website
=
context
.
getWebSiteValue
()
REQUEST
=
context
.
REQUEST
REQUEST
=
context
.
REQUEST
if
REQUEST
.
has_key
(
'portal_skin'
):
if
REQUEST
.
has_key
(
'portal_skin'
):
context
.
portal_skins
.
clearSkinCookie
()
context
.
portal_skins
.
clearSkinCookie
()
REQUEST
.
RESPONSE
.
expireCookie
(
'__ac'
,
path
=
'/'
)
REQUEST
.
RESPONSE
.
expireCookie
(
'__ac'
,
path
=
'/'
)
msg
=
context
.
Base_translateString
(
'You have been logged out. Thank you for using this website.'
)
msg
=
context
.
Base_translateString
(
'You have been logged out. Thank you for using this website.'
)
return
website
.
Base_redirect
(
form_id
,
keep_items
=
{
'portal_status_message'
:
msg
},
**
kw
)
return
website
.
Base_redirect
(
form_id
,
keep_items
=
{
'portal_status_message'
:
msg
},
**
kw
)
bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web_widget_library/Base_getWorkflowEventInfoList.py
View file @
8637adef
...
@@ -7,16 +7,16 @@
...
@@ -7,16 +7,16 @@
from
Products.CMFCore.WorkflowCore
import
WorkflowException
from
Products.CMFCore.WorkflowCore
import
WorkflowException
history
=
{}
history
=
{}
workflow_id_list
=
[
workflow_id
for
workflow_id
,
workflow_state
in
context
.
getWorkflowStateItemList
()]
workflow_id_list
=
[
workflow_id
for
workflow_id
,
_
in
context
.
getWorkflowStateItemList
()]
for
wf_id
in
workflow_id_list
:
for
wf_id
in
workflow_id_list
:
try
:
try
:
history
[
wf_id
]
=
context
.
Base_getWorkflowHistoryItemList
(
workflow_id
=
wf_id
)
history
[
wf_id
]
=
context
.
Base_getWorkflowHistoryItemList
(
workflow_id
=
wf_id
)
except
WorkflowException
:
except
WorkflowException
:
# some workflow don't have history
# some workflow don't have history
pass
pass
event_list
=
[]
event_list
=
[]
for
wor
r
kflow_id
in
history
.
keys
():
for
workflow_id
in
history
.
keys
():
event_list
+=
history
[
wor
r
kflow_id
]
event_list
+=
history
[
workflow_id
]
if
sort
:
event_list
.
sort
(
key
=
lambda
x
:
x
.
time
,
reverse
=
True
)
if
sort
:
event_list
.
sort
(
key
=
lambda
x
:
x
.
time
,
reverse
=
True
)
return
event_list
return
event_list
bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web_widget_library/WebSection_viewInlinePageRenderer.py
View file @
8637adef
...
@@ -6,11 +6,11 @@
...
@@ -6,11 +6,11 @@
"""
"""
def
getInlinePage
(
reference
,
language
):
def
getInlinePage
(
reference
,
language
):
if
reference
:
if
reference
:
page
=
context
.
getDocumentValue
(
reference
)
page
=
context
.
getDocumentValue
(
reference
)
if
page
is
not
None
:
if
page
is
not
None
:
return
page
.
asStrippedHTML
()
return
page
.
asStrippedHTML
()
return
None
return
None
from
Products.ERP5Type.Cache
import
CachingMethod
from
Products.ERP5Type.Cache
import
CachingMethod
web_site_url
=
context
.
getWebSectionValue
().
absolute_url
()
web_site_url
=
context
.
getWebSectionValue
().
absolute_url
()
...
...
bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web_widget_library/WebSection_viewSubjectIndexRenderer.py
View file @
8637adef
...
@@ -9,8 +9,6 @@
...
@@ -9,8 +9,6 @@
Result is cached for high performance.
Result is cached for high performance.
"""
"""
web_site_value
=
context
.
getWebSiteValue
()
web_site_url
=
web_site_value
.
absolute_url
()
web_section_value
=
context
.
getWebSectionValue
()
web_section_value
=
context
.
getWebSectionValue
()
web_section_url
=
web_section_value
.
absolute_url
()
web_section_url
=
web_section_value
.
absolute_url
()
context
=
web_section_value
context
=
web_section_value
...
...
bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web_widget_library/WebSite_redirectToUserPreference.py
View file @
8637adef
...
@@ -7,9 +7,7 @@
...
@@ -7,9 +7,7 @@
from
zExceptions
import
Unauthorized
from
zExceptions
import
Unauthorized
# Initialize some useful variables
# Initialize some useful variables
request
=
context
.
REQUEST
portal
=
context
.
getPortalObject
()
portal
=
context
.
getPortalObject
()
website
=
context
.
getWebSiteValue
()
user
=
portal
.
portal_membership
.
getAuthenticatedMember
()
user
=
portal
.
portal_membership
.
getAuthenticatedMember
()
user_preference
=
None
user_preference
=
None
portal_preferences
=
portal
.
portal_preferences
portal_preferences
=
portal
.
portal_preferences
...
...
bt5/erp5_web/WorkflowTemplateItem/portal_workflow/category_publication_workflow/scripts/expireAll.py
View file @
8637adef
objec
t
=
state_change
[
'object'
]
documen
t
=
state_change
[
'object'
]
workflow_tool
=
objec
t
.
getPortalObject
().
portal_workflow
workflow_tool
=
documen
t
.
getPortalObject
().
portal_workflow
if
workflow_tool
.
isTransitionPossible
(
objec
t
,
'expire'
):
if
workflow_tool
.
isTransitionPossible
(
documen
t
,
'expire'
):
objec
t
.
expire
()
documen
t
.
expire
()
if
workflow_tool
.
isTransitionPossible
(
objec
t
,
'expire_protected'
):
if
workflow_tool
.
isTransitionPossible
(
documen
t
,
'expire_protected'
):
objec
t
.
expireProtected
()
documen
t
.
expireProtected
()
if
workflow_tool
.
isTransitionPossible
(
objec
t
,
'expire_published'
):
if
workflow_tool
.
isTransitionPossible
(
documen
t
,
'expire_published'
):
objec
t
.
expirePublished
()
documen
t
.
expirePublished
()
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