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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Eteri
erp5
Commits
d692e641
Commit
d692e641
authored
Nov 28, 2019
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Plain Diff
Make erp5_administration pass coding style test
/reviewed-on
!993
parents
01c1218c
00e1736b
Changes
18
Hide whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
52 additions
and
34 deletions
+52
-34
bt5/erp5_administration/ExtensionTemplateItem/portal_components/extension.erp5.ERP5Administration.py
...em/portal_components/extension.erp5.ERP5Administration.py
+3
-3
bt5/erp5_administration/ExtensionTemplateItem/portal_components/extension.erp5.ERP5Administration.xml
...m/portal_components/extension.erp5.ERP5Administration.xml
+1
-4
bt5/erp5_administration/ExtensionTemplateItem/portal_components/extension.erp5.pprofile.py
...TemplateItem/portal_components/extension.erp5.pprofile.py
+2
-1
bt5/erp5_administration/ExtensionTemplateItem/portal_components/extension.erp5.pprofile.xml
...emplateItem/portal_components/extension.erp5.pprofile.xml
+1
-4
bt5/erp5_administration/SkinTemplateItem/portal_skins/erp5_administration/Alarm_checkLocalizer.py
.../portal_skins/erp5_administration/Alarm_checkLocalizer.py
+3
-3
bt5/erp5_administration/SkinTemplateItem/portal_skins/erp5_administration/Base_viewSecurityMappingAsUser.py
...ins/erp5_administration/Base_viewSecurityMappingAsUser.py
+6
-5
bt5/erp5_administration/SkinTemplateItem/portal_skins/erp5_administration/BusinessTemplate_getModifiableFieldList.py
...administration/BusinessTemplate_getModifiableFieldList.py
+3
-3
bt5/erp5_administration/SkinTemplateItem/portal_skins/erp5_administration/BusinessTemplate_getModifiableFieldList.xml
...dministration/BusinessTemplate_getModifiableFieldList.xml
+0
-0
bt5/erp5_administration/SkinTemplateItem/portal_skins/erp5_administration/BusinessTemplate_getPythonSourceCodeMessageList.py
...ration/BusinessTemplate_getPythonSourceCodeMessageList.py
+7
-3
bt5/erp5_administration/SkinTemplateItem/portal_skins/erp5_administration/ERP5Site_checkCatalogTable.py
...l_skins/erp5_administration/ERP5Site_checkCatalogTable.py
+1
-1
bt5/erp5_administration/SkinTemplateItem/portal_skins/erp5_administration/SkinsTool_checkDuplicateSelectionName.py
...5_administration/SkinsTool_checkDuplicateSelectionName.py
+0
-0
bt5/erp5_administration/SkinTemplateItem/portal_skins/erp5_administration/SkinsTool_checkDuplicateSelectionName.xml
..._administration/SkinsTool_checkDuplicateSelectionName.xml
+0
-0
bt5/erp5_administration/SkinTemplateItem/portal_skins/erp5_administration/SkinsTool_getDuplicateSelectionNameDict.py
...administration/SkinsTool_getDuplicateSelectionNameDict.py
+0
-0
bt5/erp5_administration/SkinTemplateItem/portal_skins/erp5_administration/SkinsTool_getDuplicateSelectionNameDict.xml
...dministration/SkinsTool_getDuplicateSelectionNameDict.xml
+0
-0
bt5/erp5_administration/bt/skip_coding_style_test
bt5/erp5_administration/bt/skip_coding_style_test
+0
-1
product/ERP5/tests/testFieldLibraryGuideline.py
product/ERP5/tests/testFieldLibraryGuideline.py
+1
-1
product/ERP5Type/CodingStyle.py
product/ERP5Type/CodingStyle.py
+19
-5
product/ERP5Type/mixin/constraint.py
product/ERP5Type/mixin/constraint.py
+5
-0
No files found.
bt5/erp5_administration/ExtensionTemplateItem/portal_components/extension.erp5.ERP5Administration.py
View file @
d692e641
...
...
@@ -102,8 +102,8 @@ def MessageCatalog_getNotTranslatedMessageDict(self):
"""
not_translated_message_dict
=
{}
messages
=
MessageCatalog_getMessageDict
(
self
)
for
k
,
v
in
messages
.
iteritems
():
if
not
len
(
v
)
or
not
len
(
filter
(
lambda
x
:
x
,
v
.
values
()))
:
for
k
,
v
in
messages
.
iteritems
():
if
not
[
x
for
x
in
v
.
values
()
if
x
]
:
not_translated_message_dict
[
k
]
=
v
return
not_translated_message_dict
...
...
@@ -153,7 +153,7 @@ def checkConversionToolAvailability(self):
_
,
html_result
=
temp_document
.
convert
(
format
=
'html'
)
except
ConflictError
:
raise
except
:
#Which Errors should we catch ?
except
Exception
:
#Transformation failed
message
=
'Conversion tool got unexpected error:
\
n
%s'
%
''
.
join
(
ExceptionFormatter
.
format_exception
(
*
sys
.
exc_info
()))
else
:
...
...
bt5/erp5_administration/ExtensionTemplateItem/portal_components/extension.erp5.ERP5Administration.xml
View file @
d692e641
...
...
@@ -45,10 +45,7 @@
<item>
<key>
<string>
text_content_warning_message
</string>
</key>
<value>
<tuple>
<string>
W:106, 29: map/filter on lambda could be replaced by comprehension (deprecated-lambda)
</string>
<string>
W:156, 2: No exception type(s) specified (bare-except)
</string>
</tuple>
<tuple/>
</value>
</item>
<item>
...
...
bt5/erp5_administration/ExtensionTemplateItem/portal_components/extension.erp5.pprofile.py
View file @
d692e641
from
zpprofile
import
getProfiler
,
getStatisticalProfilerAndThread
# these names are used in external methods
from
zpprofile
import
getProfiler
,
getStatisticalProfilerAndThread
# pylint: disable=unused-import
\ No newline at end of file
bt5/erp5_administration/ExtensionTemplateItem/portal_components/extension.erp5.pprofile.xml
View file @
d692e641
...
...
@@ -43,10 +43,7 @@
<item>
<key>
<string>
text_content_warning_message
</string>
</key>
<value>
<tuple>
<string>
W: 1, 0: Unused getProfiler imported from zpprofile (unused-import)
</string>
<string>
W: 1, 0: Unused getStatisticalProfilerAndThread imported from zpprofile (unused-import)
</string>
</tuple>
<tuple/>
</value>
</item>
<item>
...
...
bt5/erp5_administration/SkinTemplateItem/portal_skins/erp5_administration/Alarm_checkLocalizer.py
View file @
d692e641
...
...
@@ -6,13 +6,13 @@ alarm_warn_ratio = 0.25
localizer
=
context
.
Localizer
for
message_catalog
in
localizer
.
objectValues
(
'MessageCatalog'
):
all
=
len
(
message_catalog
.
MessageCatalog_getMessageDict
().
keys
())
all
_messages
=
len
(
message_catalog
.
MessageCatalog_getMessageDict
().
keys
())
not_translated
=
len
(
message_catalog
.
MessageCatalog_getNotTranslatedMessageDict
().
keys
())
enable_warning
=
not_translated
>
all
*
alarm_warn_ratio
enable_warning
=
not_translated
>
all
_messages
*
alarm_warn_ratio
if
enable_warning
:
# we have more than allowed number of untranslated messages,
# fire alarm
context
.
log
(
"Too many untranslated Localizer messages for %s %s/%s"
%
(
message_catalog
,
all
,
not_translated
))
context
.
log
(
"Too many untranslated Localizer messages for %s %s/%s"
%
(
message_catalog
,
all
_messages
,
not_translated
))
return
True
return
False
bt5/erp5_administration/SkinTemplateItem/portal_skins/erp5_administration/Base_viewSecurityMappingAsUser.py
View file @
d692e641
...
...
@@ -4,17 +4,18 @@ security_category_dict = {}
# XXX This is a duplicate of logic present deep inside ERP5GroupManager.getGroupsForPrincipal()
# Please refactor into an accessible method so this code can be removed
def
getDefaultSecurityCategoryMapping
():
return
((
'ERP5Type_getSecurityCategoryFromAssignment'
,
context
.
getPortalObject
().
getPortalAssignmentBaseCategoryList
()
),)
return
((
'ERP5Type_getSecurityCategoryFromAssignment'
,
context
.
getPortalObject
().
getPortalAssignmentBaseCategoryList
()
),)
getSecurityCategoryMapping
=
getattr
(
context
,
'ERP5Type_getSecurityCategoryMapping'
,
getDefaultSecurityCategoryMapping
)
# XXX end of code duplication
for
method_id
,
base_category_list
in
getSecurityCategoryMapping
():
try
:
security_category_dict
.
setdefault
(
tuple
(
base_category_list
),
[]).
extend
(
getattr
(
context
,
method_id
)(
base_category_list
,
login
,
context
,
''
))
except
:
# XXX: it is not possible to log message with traceback from python script
except
Exception
:
# XXX: it is not possible to log message with traceback from python script
print
'It was not possible to invoke method %s with base_category_list %s'
%
(
method_id
,
base_category_list
)
for
base_category_list
,
category_value_list
in
security_category_dict
.
items
():
...
...
bt5/erp5_
forge/SkinTemplateItem/portal_skins/erp5_toolbox
/BusinessTemplate_getModifiableFieldList.py
→
bt5/erp5_
administration/SkinTemplateItem/portal_skins/erp5_administration
/BusinessTemplate_getModifiableFieldList.py
View file @
d692e641
...
...
@@ -21,11 +21,11 @@ field_library_id_dict = {
modified_object_dict
=
{}
def
calculateFieldLibraryID
(
id
):
def
calculateFieldLibraryID
(
bt_title
):
# The field library name could be automatically calculated or hardcoded in
# the script
return
field_library_id_dict
.
get
(
id
)
or
'Base_view%sFieldLibrary'
%
\
''
.
join
([
x
.
capitalize
()
for
x
in
id
.
split
(
'_'
)[
1
:]])
return
field_library_id_dict
.
get
(
bt_title
)
or
'Base_view%sFieldLibrary'
%
\
''
.
join
([
x
.
capitalize
()
for
x
in
bt_title
.
split
(
'_'
)[
1
:]])
def
getForm
(
skin_folder
,
form_id
):
try
:
...
...
bt5/erp5_
forge/SkinTemplateItem/portal_skins/erp5_toolbox
/BusinessTemplate_getModifiableFieldList.xml
→
bt5/erp5_
administration/SkinTemplateItem/portal_skins/erp5_administration
/BusinessTemplate_getModifiableFieldList.xml
View file @
d692e641
File moved
bt5/erp5_administration/SkinTemplateItem/portal_skins/erp5_administration/BusinessTemplate_getPythonSourceCodeMessageList.py
View file @
d692e641
...
...
@@ -71,9 +71,13 @@ for script_container in script_container_list:
# Check components
for
component_id
in
(
context
.
getTemplateExtensionIdList
()
+
context
.
getTemplateDocumentIdList
()
+
context
.
getTemplateTestIdList
()):
context
.
getTemplateExtensionIdList
()
+
context
.
getTemplateDocumentIdList
()
+
context
.
getTemplateMixinIdList
()
+
context
.
getTemplateTestIdList
()
+
context
.
getTemplateModuleComponentIdList
()
+
context
.
getTemplateToolComponentIdList
()
):
checkComponent
(
portal
.
portal_components
[
component_id
])
return
line_list
bt5/erp5_administration/SkinTemplateItem/portal_skins/erp5_administration/ERP5Site_checkCatalogTable.py
View file @
d692e641
...
...
@@ -54,7 +54,7 @@ if catalog_uid_list is None:
'tag'
:
tag
,
'fixit'
:
fixit
,
}
for
activity
in
xrange
(
activity_count
):
for
_
in
xrange
(
activity_count
):
if
len
(
catalog_uid_list
)
==
0
:
result_list
.
append
(
'No more uids to check, stop spawning activities.'
)
break
...
...
bt5/erp5_
forge/SkinTemplateItem/portal_skins/erp5_toolbox
/SkinsTool_checkDuplicateSelectionName.py
→
bt5/erp5_
administration/SkinTemplateItem/portal_skins/erp5_administration
/SkinsTool_checkDuplicateSelectionName.py
View file @
d692e641
File moved
bt5/erp5_
forge/SkinTemplateItem/portal_skins/erp5_toolbox
/SkinsTool_checkDuplicateSelectionName.xml
→
bt5/erp5_
administration/SkinTemplateItem/portal_skins/erp5_administration
/SkinsTool_checkDuplicateSelectionName.xml
View file @
d692e641
File moved
bt5/erp5_
forge/SkinTemplateItem/portal_skins/erp5_toolbox
/SkinsTool_getDuplicateSelectionNameDict.py
→
bt5/erp5_
administration/SkinTemplateItem/portal_skins/erp5_administration
/SkinsTool_getDuplicateSelectionNameDict.py
View file @
d692e641
File moved
bt5/erp5_
forge/SkinTemplateItem/portal_skins/erp5_toolbox
/SkinsTool_getDuplicateSelectionNameDict.xml
→
bt5/erp5_
administration/SkinTemplateItem/portal_skins/erp5_administration
/SkinsTool_getDuplicateSelectionNameDict.xml
View file @
d692e641
File moved
bt5/erp5_administration/bt/skip_coding_style_test
deleted
100644 → 0
View file @
01c1218c
1
\ No newline at end of file
product/ERP5/tests/testFieldLibraryGuideline.py
View file @
d692e641
...
...
@@ -46,7 +46,7 @@ class TestFieldLibraryGuideline(ERP5TypeTestCase):
return
(
'erp5_base'
,
'erp5_crm'
,
'erp5_
forge
'
,
'erp5_
administration
'
,
)
def
beforeTearDown
(
self
):
...
...
product/ERP5Type/CodingStyle.py
View file @
d692e641
...
...
@@ -77,18 +77,32 @@ def getSkinPrefixList(self):
# Add other prefix
skin_prefix_list
.
extend
((
'ERP5Type'
,
'Module'
,
'Brain'
,
# Catalog brains
'DCWorkflow'
,
# some workflow script use this, not sure it's correct.
'SkinsTool'
,
'Entity'
,
# A base class for Person / Organisation
'Zuite'
,
# Products.Zelenium test suites
'Form'
,
# Acceptable for ERP5 Forms which will soon become portal types too
# ERP5Form
'Form'
,
'ListBox'
,
'DCWorkflow'
,
# some workflow script use this, not sure it's correct.
'Zuite'
,
# from Zelenium
'Brain'
,
# Catalog brains
'PlanningBox'
,
'OOoChart'
,
))
return
set
(
skin_prefix_list
)
# Some skin names that does not respect our conventions but are ignored, for example
# when this naming is used by zope.
ignored_skin_id_set
=
{
'twiddleAuthCookie'
,
'setAuthCookie'
,
}
# Generic method to check consistency of a skin item
def
checkConsistency
(
self
,
fixit
=
0
,
source_code
=
None
):
"""
...
...
@@ -103,7 +117,7 @@ def checkConsistency(self, fixit=0, source_code=None):
# Make sure id is acceptable
document_id
=
self
.
id
if
document_id
!=
document_id
.
lower
():
if
document_id
!=
document_id
.
lower
()
and
document_id
not
in
ignored_skin_id_set
:
# Only test prefix with big caps
prefix
=
document_id
.
split
(
'_'
)[
0
]
if
prefix
not
in
getSkinPrefixList
(
self
):
...
...
product/ERP5Type/mixin/constraint.py
View file @
d692e641
...
...
@@ -93,6 +93,11 @@ class ConstraintMixin(IdAsReferenceMixin('_constraint'), Predicate):
return
self
.
_checkConsistency
(
obj
,
fixit
,
**
kw
)
def
_checkConsistency
(
self
,
obj
,
fixit
=
0
,
**
kw
):
"""Implementation of constraint logic.
"""
raise
NotImplementedError
()
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'fixConsistency'
)
def
fixConsistency
(
self
,
obj
,
**
kw
):
...
...
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