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
1
Issues
1
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
Roque
erp5
Commits
b5193345
Commit
b5193345
authored
Oct 01, 2022
by
Kazuhiko Shiozaki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
py2/py3: 2to3 -f except
parent
b21f83fc
Changes
49
Hide whitespace changes
Inline
Side-by-side
Showing
49 changed files
with
87 additions
and
83 deletions
+87
-83
bt5/erp5_administration/SkinTemplateItem/portal_skins/erp5_administration/ERP5Site_dumpPortalSkinsContent.py
...ns/erp5_administration/ERP5Site_dumpPortalSkinsContent.py
+1
-1
bt5/erp5_advanced_ecommerce/SkinTemplateItem/portal_skins/erp5_advanced_ecommerce/Resource_addToShoppingCart.py
...ins/erp5_advanced_ecommerce/Resource_addToShoppingCart.py
+1
-1
bt5/erp5_api_style/SkinTemplateItem/portal_skins/erp5_api_style/ERP5Site_asjIOStyle.py
...teItem/portal_skins/erp5_api_style/ERP5Site_asjIOStyle.py
+1
-1
bt5/erp5_apparel/SkinTemplateItem/portal_skins/erp5_apparel/ApparelFabricItem_fastInput.py
.../portal_skins/erp5_apparel/ApparelFabricItem_fastInput.py
+1
-1
bt5/erp5_base/ModuleComponentTemplateItem/portal_components/module.erp5.ImageUtil.py
...ntTemplateItem/portal_components/module.erp5.ImageUtil.py
+1
-1
bt5/erp5_base/SkinTemplateItem/portal_skins/erp5_base/Person_shiftDefaultCareer.py
...eItem/portal_skins/erp5_base/Person_shiftDefaultCareer.py
+1
-1
bt5/erp5_commerce/SkinTemplateItem/portal_skins/erp5_commerce/Resource_addToShoppingCart.py
.../portal_skins/erp5_commerce/Resource_addToShoppingCart.py
+1
-1
bt5/erp5_content_translation/SkinTemplateItem/portal_skins/erp5_content_translation/Base_editContentTranslationMessage.py
...content_translation/Base_editContentTranslationMessage.py
+1
-1
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testERP5Catalog.py
...mplateItem/portal_components/test.erp5.testERP5Catalog.py
+2
-1
bt5/erp5_dms/DocumentTemplateItem/portal_components/document.erp5.PDFDocument.py
...mplateItem/portal_components/document.erp5.PDFDocument.py
+3
-3
bt5/erp5_dms/SkinTemplateItem/portal_skins/erp5_dms/Document_getPreviewAsHTML.py
...teItem/portal_skins/erp5_dms/Document_getPreviewAsHTML.py
+1
-1
bt5/erp5_dms/SkinTemplateItem/portal_skins/erp5_dms/Document_tryToConvertToBaseFormat.py
...ortal_skins/erp5_dms/Document_tryToConvertToBaseFormat.py
+4
-4
bt5/erp5_dms/SkinTemplateItem/portal_skins/erp5_dms/Document_tryToUpdateBaseMetadata.py
...portal_skins/erp5_dms/Document_tryToUpdateBaseMetadata.py
+2
-2
bt5/erp5_dms/SkinTemplateItem/portal_skins/erp5_dms/ERP5Type_getSecurityCategoryFromAssignmentTree.py
...rp5_dms/ERP5Type_getSecurityCategoryFromAssignmentTree.py
+1
-1
bt5/erp5_email_reader/DocumentTemplateItem/portal_components/document.erp5.EmailReader.py
...mplateItem/portal_components/document.erp5.EmailReader.py
+1
-1
bt5/erp5_forge/ModuleComponentTemplateItem/portal_components/module.erp5.Git.py
...omponentTemplateItem/portal_components/module.erp5.Git.py
+7
-7
bt5/erp5_forge/ModuleComponentTemplateItem/portal_components/module.erp5.Subversion.py
...tTemplateItem/portal_components/module.erp5.Subversion.py
+1
-1
bt5/erp5_forge/ModuleComponentTemplateItem/portal_components/module.erp5.SubversionClient.py
...ateItem/portal_components/module.erp5.SubversionClient.py
+6
-6
bt5/erp5_forge/ModuleComponentTemplateItem/portal_components/module.erp5.WorkingCopy.py
...TemplateItem/portal_components/module.erp5.WorkingCopy.py
+2
-2
bt5/erp5_forge/SkinTemplateItem/portal_skins/erp5_vcs/BusinessTemplate_doSvnCheckout.py
...m/portal_skins/erp5_vcs/BusinessTemplate_doSvnCheckout.py
+2
-2
bt5/erp5_forge/SkinTemplateItem/portal_skins/erp5_vcs/BusinessTemplate_doVcsCommit.py
...tem/portal_skins/erp5_vcs/BusinessTemplate_doVcsCommit.py
+1
-1
bt5/erp5_forge/SkinTemplateItem/portal_skins/erp5_vcs/BusinessTemplate_doVcsUpdate.py
...tem/portal_skins/erp5_vcs/BusinessTemplate_doVcsUpdate.py
+1
-1
bt5/erp5_forge/SkinTemplateItem/portal_skins/erp5_vcs/BusinessTemplate_handleException.py
...portal_skins/erp5_vcs/BusinessTemplate_handleException.py
+3
-3
bt5/erp5_full_text_myisam_catalog/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/SQLCatalog_deferFullTextIndexActivity.py
...rp5_mysql_innodb/SQLCatalog_deferFullTextIndexActivity.py
+1
-1
bt5/erp5_full_text_sphinxse_catalog/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/SQLCatalog_deferFullTextIndexActivity.py
...rp5_mysql_innodb/SQLCatalog_deferFullTextIndexActivity.py
+1
-1
bt5/erp5_graph_editor/SkinTemplateItem/portal_skins/erp5_graph_editor/DCWorkflow_edit.py
...ateItem/portal_skins/erp5_graph_editor/DCWorkflow_edit.py
+1
-1
bt5/erp5_hal_json_style/SkinTemplateItem/portal_skins/erp5_hal_json_style/Workflow_statusModify.py
...portal_skins/erp5_hal_json_style/Workflow_statusModify.py
+2
-2
bt5/erp5_inotify/ToolComponentTemplateItem/portal_components/tool.erp5.InotifyTool.py
...ntTemplateItem/portal_components/tool.erp5.InotifyTool.py
+1
-1
bt5/erp5_invoicing/ModuleComponentTemplateItem/portal_components/module.erp5.TestInvoiceMixin.py
...ateItem/portal_components/module.erp5.TestInvoiceMixin.py
+1
-1
bt5/erp5_json_form/TestTemplateItem/portal_components/test.erp5.testJSONForm.py
...tTemplateItem/portal_components/test.erp5.testJSONForm.py
+2
-2
bt5/erp5_knowledge_pad/SkinTemplateItem/portal_skins/erp5_knowledge_pad/KnowledgeBox_baseEdit.py
.../portal_skins/erp5_knowledge_pad/KnowledgeBox_baseEdit.py
+1
-1
bt5/erp5_maileva_connector/DocumentTemplateItem/portal_components/document.erp5.MailevaSOAPConnector.py
...m/portal_components/document.erp5.MailevaSOAPConnector.py
+2
-2
bt5/erp5_ooo_import/SkinTemplateItem/portal_skins/erp5_ooo_import/Base_importFileLineDefaultScript.py
...skins/erp5_ooo_import/Base_importFileLineDefaultScript.py
+2
-2
bt5/erp5_promise/SkinTemplateItem/portal_skins/erp5_promise/Alarm_checkPromiseBt5.py
...teItem/portal_skins/erp5_promise/Alarm_checkPromiseBt5.py
+1
-1
bt5/erp5_real_time_inventory_accounting_test/TestTemplateItem/portal_components/test.erp5.testRealTimeInventoryAccounting.py
...l_components/test.erp5.testRealTimeInventoryAccounting.py
+1
-1
bt5/erp5_simulation/SkinTemplateItem/portal_skins/erp5_simulation/Base_editConfiguration.py
...em/portal_skins/erp5_simulation/Base_editConfiguration.py
+1
-1
bt5/erp5_sql_browser/SkinTemplateItem/portal_skins/erp5_sql_browser/ZMySQLDAConnection_getQueryResultAsJSON.py
...p5_sql_browser/ZMySQLDAConnection_getQueryResultAsJSON.py
+1
-1
bt5/erp5_test_result/DocumentTemplateItem/portal_components/document.erp5.ERP5ProjectUnitTestDistributor.py
...omponents/document.erp5.ERP5ProjectUnitTestDistributor.py
+1
-1
bt5/erp5_test_result/DocumentTemplateItem/portal_components/document.erp5.ERP5ScalabilityDistributor.py
...al_components/document.erp5.ERP5ScalabilityDistributor.py
+1
-1
bt5/erp5_tiosafe_core/DocumentTemplateItem/portal_components/document.erp5.IntegrationModule.py
...Item/portal_components/document.erp5.IntegrationModule.py
+1
-1
bt5/erp5_tiosafe_core/DocumentTemplateItem/portal_components/document.erp5.WebServiceRequest.py
...Item/portal_components/document.erp5.WebServiceRequest.py
+1
-1
bt5/erp5_tiosafe_core/SkinTemplateItem/portal_skins/erp5_integration/WebServiceRequest_test.py
...m/portal_skins/erp5_integration/WebServiceRequest_test.py
+1
-1
bt5/erp5_travel_expense/SkinTemplateItem/portal_skins/erp5_hr_request/ExpenseValidationRequest_createPurchaseTransaction.py
...est/ExpenseValidationRequest_createPurchaseTransaction.py
+1
-1
bt5/erp5_ui_test/TestTemplateItem/portal_components/test.erp5.testListBox.py
...stTemplateItem/portal_components/test.erp5.testListBox.py
+5
-5
bt5/erp5_ui_test_core/ExtensionTemplateItem/portal_components/extension.erp5.ERP5Zuite.py
...emplateItem/portal_components/extension.erp5.ERP5Zuite.py
+1
-1
bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web_widget_library/WebSite_registerUser.py
...tal_skins/erp5_web_widget_library/WebSite_registerUser.py
+1
-1
bt5/erp5_web_service/ModuleComponentTemplateItem/portal_components/module.erp5.SFTPConnection.py
...plateItem/portal_components/module.erp5.SFTPConnection.py
+7
-7
bt5/erp5_web_service/ModuleComponentTemplateItem/portal_components/module.erp5.SOAPWSDLConnection.py
...eItem/portal_components/module.erp5.SOAPWSDLConnection.py
+1
-1
product/ERP5Type/tests/Python3StyleTest.py
product/ERP5Type/tests/Python3StyleTest.py
+3
-0
No files found.
bt5/erp5_administration/SkinTemplateItem/portal_skins/erp5_administration/ERP5Site_dumpPortalSkinsContent.py
View file @
b5193345
...
...
@@ -21,7 +21,7 @@ def getSkinHash(skin, skin_container):
content
=
skin
.
formXML
()
if
isinstance
(
content
,
unicode
):
content
=
content
.
encode
(
'utf8'
,
'repr'
)
except
AttributeError
,
e
:
except
AttributeError
as
e
:
# This can happen with dead proxy fields.
content
=
"broken form %s"
%
e
content
=
'ignore'
...
...
bt5/erp5_advanced_ecommerce/SkinTemplateItem/portal_skins/erp5_advanced_ecommerce/Resource_addToShoppingCart.py
View file @
b5193345
...
...
@@ -22,7 +22,7 @@ if form_id is not None:
# button itself
try
:
form
.
validate_all_to_request
(
request
)
except
FormValidationError
,
validation_errors
:
except
FormValidationError
as
validation_errors
:
# Pack errors into the request
field_errors
=
form
.
ErrorFields
(
validation_errors
)
request
.
set
(
'field_errors'
,
field_errors
)
...
...
bt5/erp5_api_style/SkinTemplateItem/portal_skins/erp5_api_style/ERP5Site_asjIOStyle.py
View file @
b5193345
...
...
@@ -112,7 +112,7 @@ for erp5_action_key in erp5_action_dict.keys():
if
mode
!=
"allDocs"
:
return
result
result_list
+=
result
except
ValueError
,
e
:
except
ValueError
as
e
:
try
:
error_dict
.
update
(
json
.
loads
(
str
(
e
)))
except
ValueError
:
...
...
bt5/erp5_apparel/SkinTemplateItem/portal_skins/erp5_apparel/ApparelFabricItem_fastInput.py
View file @
b5193345
...
...
@@ -196,7 +196,7 @@ try:
cell
.
edit
(
quantity
=
total_quantity
)
except
FormValidationError
,
validation_errors
:
except
FormValidationError
as
validation_errors
:
redirect_url
=
'%s/view?%s'
%
(
context
.
absolute_url
()
,
'portal_status_message=%s'
%
localizer
.
erp5_ui
.
gettext
(
"input failed."
)
)
...
...
bt5/erp5_base/ModuleComponentTemplateItem/portal_components/module.erp5.ImageUtil.py
View file @
b5193345
...
...
@@ -35,7 +35,7 @@ SVG_DEFAULT_NAMESPACE = "http://www.w3.org/2000/svg"
def
getDataURI
(
url
):
try
:
data
=
urllib2
.
urlopen
(
url
)
except
Exception
,
e
:
except
Exception
as
e
:
raise
ConversionError
(
"Error to transform url (%s) into data uri. ERROR = %s"
%
(
url
,
Exception
(
e
)))
return
'data:%s;base64,%s'
%
(
data
.
info
()[
"content-type"
],
data
.
read
().
encode
(
"base64"
).
replace
(
'
\
n
'
,
""
))
...
...
bt5/erp5_base/SkinTemplateItem/portal_skins/erp5_base/Person_shiftDefaultCareer.py
View file @
b5193345
...
...
@@ -23,7 +23,7 @@ else:
new_id
=
person
.
generateNewId
()
try
:
default_career
.
setId
(
new_id
)
except
ActivityPendingError
,
error
:
except
ActivityPendingError
as
error
:
message
=
Base_translateString
(
"%s"
%
error
)
return
context
.
Base_redirect
(
form_id
=
form_id
,
selection_name
=
selection_name
,
...
...
bt5/erp5_commerce/SkinTemplateItem/portal_skins/erp5_commerce/Resource_addToShoppingCart.py
View file @
b5193345
...
...
@@ -14,7 +14,7 @@ if form_id is not None:
# button itself
try
:
params
=
form
.
validate_all_to_request
(
request
)
except
FormValidationError
,
validation_errors
:
except
FormValidationError
as
validation_errors
:
# Pack errors into the request
field_errors
=
form
.
ErrorFields
(
validation_errors
)
request
.
set
(
'field_errors'
,
field_errors
)
...
...
bt5/erp5_content_translation/SkinTemplateItem/portal_skins/erp5_content_translation/Base_editContentTranslationMessage.py
View file @
b5193345
...
...
@@ -29,7 +29,7 @@ form = getattr(context,form_id)
try
:
# Validate
form
.
validate_all_to_request
(
request
)
except
FormValidationError
,
validation_errors
:
except
FormValidationError
as
validation_errors
:
# Pack errors into the request
field_errors
=
form
.
ErrorFields
(
validation_errors
)
request
.
set
(
'field_errors'
,
field_errors
)
...
...
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testERP5Catalog.py
View file @
b5193345
...
...
@@ -100,7 +100,8 @@ class TransactionThread(threading.Thread):
# Login
newSecurityManager
(
None
,
portal_value
.
acl_users
.
getUser
(
'ERP5TypeTestCase'
))
self
.
payload
(
portal_value
=
portal_value
)
except
Exception
as
self
.
exception
:
# pylint: disable=redefine-in-handler
except
Exception
as
e
:
# pylint: disable=redefine-in-handler
self
.
exception
=
e
# pylint: disable=redefine-in-handler
if
six
.
PY2
:
self
.
exception
.
__traceback__
=
sys
.
exc_info
()[
2
]
...
...
bt5/erp5_dms/DocumentTemplateItem/portal_components/document.erp5.PDFDocument.py
View file @
b5193345
...
...
@@ -280,7 +280,7 @@ class PDFDocument(Image):
'-noframes'
,
'-i'
,
tmp
.
name
]
try
:
command_result
=
Popen
(
command
,
stdout
=
PIPE
).
communicate
()[
0
]
except
OSError
,
e
:
except
OSError
as
e
:
if
e
.
errno
==
errno
.
ENOENT
:
raise
ConversionError
(
'pdftohtml was not found'
)
raise
...
...
@@ -309,7 +309,7 @@ class PDFDocument(Image):
command
=
[
'pdf2djvu'
,
tmp
.
name
]
try
:
command_result
=
Popen
(
command
,
stdout
=
PIPE
).
communicate
()[
0
]
except
OSError
,
e
:
except
OSError
as
e
:
if
e
.
errno
==
errno
.
ENOENT
:
raise
ConversionError
(
'pdf2djvu was not found'
)
raise
...
...
@@ -338,7 +338,7 @@ class PDFDocument(Image):
command
=
[
'pdfinfo'
,
'-meta'
,
'-box'
,
tmp
.
name
]
try
:
command_result
=
Popen
(
command
,
stdout
=
PIPE
).
communicate
()[
0
]
except
OSError
,
e
:
except
OSError
as
e
:
if
e
.
errno
==
errno
.
ENOENT
:
raise
ConversionError
(
'pdfinfo was not found'
)
raise
...
...
bt5/erp5_dms/SkinTemplateItem/portal_skins/erp5_dms/Document_getPreviewAsHTML.py
View file @
b5193345
...
...
@@ -8,7 +8,7 @@ try:
return
result
if
not
context
.
hasBaseData
():
error_message
=
context
.
Base_translateString
(
"This document is not converted yet."
)
except
Exception
,
e
:
except
Exception
as
e
:
from
erp5.component.module.Log
import
log
log
(
"asStrippedHTML"
,
str
(
e
))
error_message
=
"%s %s"
%
(
context
.
Base_translateString
(
"Preview Error:"
),
...
...
bt5/erp5_dms/SkinTemplateItem/portal_skins/erp5_dms/Document_tryToConvertToBaseFormat.py
View file @
b5193345
...
...
@@ -11,13 +11,13 @@ if context.getExternalProcessingState() not in ('converted', 'empty'):
return
context
.
convertToBaseFormat
()
except
ConflictError
:
raise
except
ConversionError
,
e
:
except
ConversionError
as
e
:
message
=
'Conversion Error: %s'
%
(
str
(
e
)
or
'undefined.'
)
except
Fault
,
e
:
except
Fault
as
e
:
message
=
'XMLFault: %s'
%
(
repr
(
e
)
or
'undefined.'
)
except
SocketError
,
e
:
except
SocketError
as
e
:
message
=
'Socket Error: %s'
%
(
repr
(
e
)
or
'undefined.'
)
except
Exception
,
e
:
except
Exception
as
e
:
message
=
'Problem: %s'
%
(
repr
(
e
)
or
'undefined.'
)
# reach here, then exception was raised, message must be logged in workflow
# do not simply raise but rather change external processing state
...
...
bt5/erp5_dms/SkinTemplateItem/portal_skins/erp5_dms/Document_tryToUpdateBaseMetadata.py
View file @
b5193345
...
...
@@ -7,9 +7,9 @@ try:
return
context
.
updateBaseMetadata
(
**
kw
)
except
ConflictError
:
raise
except
ConversionError
,
e
:
except
ConversionError
as
e
:
message
=
'Conversion Error: %s'
%
(
str
(
e
)
or
'undefined.'
)
except
Exception
,
e
:
except
Exception
as
e
:
message
=
'Problem: %s'
%
(
repr
(
e
)
or
'undefined.'
)
# reach here, then exception was raised, message must be logged in workflow
...
...
bt5/erp5_dms/SkinTemplateItem/portal_skins/erp5_dms/ERP5Type_getSecurityCategoryFromAssignmentTree.py
View file @
b5193345
...
...
@@ -44,7 +44,7 @@ for assignment in person_object.contentValues(filter={'portal_type': 'Assignment
cdict
=
category_dict
.
copy
()
cdict
[
base_category
]
=
'/'
.
join
(
grouplist
[:
-
i
])
category_list
.
append
(
cdict
)
except
RuntimeError
,
e
:
except
RuntimeError
as
e
:
log
(
str
(
e
))
return
category_list
bt5/erp5_email_reader/DocumentTemplateItem/portal_components/document.erp5.EmailReader.py
View file @
b5193345
...
...
@@ -330,7 +330,7 @@ class EmailReader(ExternalSource):
# This is very sequential and could be improved probably
try
:
message_uid_list
=
self
.
_getMailServer
().
getMessageUIDList
(
message_folder
=
message_folder
)
except
ValueError
,
error_message
:
# Use a better exception here XXX
except
ValueError
as
error_message
:
# Use a better exception here XXX
message_uid_list
=
[]
# Reduce list size based on asumption of growing sequence of uids
latest_uid
=
self
.
_latest_uid
.
get
(
message_folder
,
0
)
...
...
bt5/erp5_forge/ModuleComponentTemplateItem/portal_components/module.erp5.Git.py
View file @
b5193345
...
...
@@ -67,7 +67,7 @@ class Git(WorkingCopy):
argv
=
[
'git'
]
try
:
return
subprocess
.
Popen
(
argv
+
list
(
args
),
**
kw
)
except
OSError
,
e
:
except
OSError
as
e
:
from
zLOG
import
LOG
,
WARNING
LOG
(
'Git'
,
WARNING
,
'will not work as the executable cannot be executed, perhaps not '
...
...
@@ -117,7 +117,7 @@ class Git(WorkingCopy):
env
.
update
(
ERP5_GIT_USERNAME
=
userpwd
[
0
],
ERP5_GIT_PASSWORD
=
userpwd
[
1
])
try
:
return
self
.
git
(
*
args
,
**
kw
)
except
GitError
,
e
:
except
GitError
as
e
:
message
=
'Authentication failed'
if
message
in
str
(
e
):
raise
GitLoginError
(
userpwd
and
message
or
...
...
@@ -148,7 +148,7 @@ class Git(WorkingCopy):
local
,
remote
=
self
.
git
(
'rev-parse'
,
'--symbolic-full-name'
,
'HEAD'
,
'@{u}'
).
splitlines
()
remote
=
remote
[:
13
]
==
'refs/remotes/'
and
remote
[
13
:]
or
None
except
GitError
,
e
:
except
GitError
as
e
:
local
=
e
.
stdout
.
splitlines
()[
0
]
remote
=
None
if
local
!=
'HEAD'
:
...
...
@@ -293,7 +293,7 @@ class Git(WorkingCopy):
try
:
return
self
.
git
(
'show'
,
'HEAD:'
+
self
.
prefix
+
path
,
strip
=
False
,
cwd
=
self
.
toplevel
)
except
GitError
,
e
:
except
GitError
as
e
:
err
=
e
.
args
[
0
]
if
' does not exist in '
in
err
or
' exists on disk, but not in '
in
err
:
raise
NotVersionedError
(
path
)
...
...
@@ -350,7 +350,7 @@ class Git(WorkingCopy):
push_args
=
'push'
,
'--porcelain'
,
remote
,
'%s:%s'
%
(
src
,
dst
)
try
:
self
.
remote_git
(
*
push_args
)
except
GitError
,
e
:
except
GitError
as
e
:
# first check why we could not push
status
=
[
x
for
x
in
e
.
stdout
.
splitlines
()
if
x
[:
1
]
==
'!'
]
if
(
len
(
status
)
!=
1
or
...
...
@@ -365,7 +365,7 @@ class Git(WorkingCopy):
# TODO: solve conflicts on */bt/revision automatically
try:
self.git(merge, '
@
{
u
}
', env=env)
except GitError
,
e:
except GitError
as
e:
# XXX: how to know how it failed ?
try:
self.git(merge, '
--
abort
')
...
...
@@ -377,7 +377,7 @@ class Git(WorkingCopy):
reset += 1
# retry to push everything
self.remote_git(*push_args)
except (GitError, GitLoginError)
,
e:
except (GitError, GitLoginError)
as
e:
self.git('
reset
', '
--
soft
', '
@
{
%
u
}
' % reset)
if isinstance(e, GitLoginError):
raise
...
...
bt5/erp5_forge/ModuleComponentTemplateItem/portal_components/module.erp5.Subversion.py
View file @
b5193345
...
...
@@ -145,7 +145,7 @@ class Subversion(WorkingCopy):
try
:
return
self
.
_getClient
().
cat
(
os
.
path
.
join
(
self
.
working_copy
,
path
),
Revision
(
opt_revision_kind
.
base
))
except
ClientError
,
e
:
except
ClientError
as
e
:
if
e
.
args
[
1
][
-
1
][
1
]
in
(
errno
.
ENOENT
,
svn_err
.
entry_not_found
):
raise
NotVersionedError
(
path
)
raise
...
...
bt5/erp5_forge/ModuleComponentTemplateItem/portal_components/module.erp5.SubversionClient.py
View file @
b5193345
...
...
@@ -271,7 +271,7 @@ try:
return
Revision
(
self
.
client
.
checkin
(
path
,
log_message
=
log_message
or
'none'
,
recurse
=
recurse
))
except
pysvn
.
ClientError
,
error
:
except
pysvn
.
ClientError
as
error
:
excep
=
self
.
getException
()
if
excep
:
raise
excep
# pylint: disable=raising-bad-type
...
...
@@ -281,7 +281,7 @@ try:
def
update
(
self
,
path
):
try
:
return
[
Revision
(
x
)
for
x
in
self
.
client
.
update
(
path
)]
except
pysvn
.
ClientError
,
error
:
except
pysvn
.
ClientError
as
error
:
excep
=
self
.
getException
()
if
excep
:
raise
excep
# pylint: disable=raising-bad-type
...
...
@@ -293,7 +293,7 @@ try:
# Zope, convert the objects.
try
:
status_list
=
[
Status
(
x
)
for
x
in
self
.
client
.
status
(
path
=
path
,
**
kw
)]
except
pysvn
.
ClientError
,
error
:
except
pysvn
.
ClientError
as
error
:
excep
=
self
.
getException
()
if
excep
:
raise
excep
# pylint: disable=raising-bad-type
...
...
@@ -328,7 +328,7 @@ try:
def
log
(
self
,
path
):
try
:
log_list
=
self
.
client
.
log
(
path
)
except
pysvn
.
ClientError
,
error
:
except
pysvn
.
ClientError
as
error
:
if
'path not found'
in
error
.
args
[
0
]:
return
excep
=
self
.
getException
()
...
...
@@ -361,7 +361,7 @@ try:
path
=
os
.
path
.
realpath
(
path
)
try
:
entry
=
self
.
client
.
info
(
path
=
path
)
except
pysvn
.
ClientError
,
error
:
except
pysvn
.
ClientError
as
error
:
excep
=
self
.
getException
()
if
excep
:
raise
excep
# pylint: disable=raising-bad-type
...
...
@@ -381,7 +381,7 @@ try:
def
ls
(
self
,
path
):
try
:
dict_list
=
self
.
client
.
ls
(
url_or_path
=
path
,
recurse
=
False
)
except
pysvn
.
ClientError
,
error
:
except
pysvn
.
ClientError
as
error
:
if
'non-existent'
in
error
.
args
[
0
]:
return
excep
=
self
.
getException
()
...
...
bt5/erp5_forge/ModuleComponentTemplateItem/portal_components/module.erp5.WorkingCopy.py
View file @
b5193345
...
...
@@ -269,7 +269,7 @@ class WorkingCopy(Implicit):
try
:
with
open
(
os
.
path
.
join
(
self
.
working_copy
,
path
),
'rU'
)
as
f
:
text
=
f
.
read
()
except
IOError
,
e
:
except
IOError
as
e
:
if
e
.
errno
==
errno
.
EISDIR
:
return
'%s<hr/>%r is a folder!'
%
(
head
,
path
)
if
e
.
errno
!=
errno
.
ENOENT
:
...
...
@@ -369,7 +369,7 @@ class BusinessTemplateWorkingCopy(BusinessTemplateFolder):
try
:
try
:
file_obj
=
open
(
path
,
'r+b'
)
except
IOError
,
e
:
except
IOError
as
e
:
if
e
.
errno
==
errno
.
EISDIR
:
shutil
.
rmtree
(
path
,
ignore_errors
=
True
)
elif
e
.
errno
!=
errno
.
ENOENT
:
...
...
bt5/erp5_forge/SkinTemplateItem/portal_skins/erp5_vcs/BusinessTemplate_doSvnCheckout.py
View file @
b5193345
...
...
@@ -3,10 +3,10 @@ from erp5.component.module.SubversionClient import SubversionSSLTrustError, Subv
vcs_tool
=
context
.
getVcsTool
()
try
:
entry_dict
=
vcs_tool
.
checkout
(
context
,
url
)
except
SubversionSSLTrustError
,
error
:
except
SubversionSSLTrustError
as
error
:
context
.
REQUEST
.
set
(
'portal_status_message'
,
'SSL Certificate was not recognized'
)
return
context
.
asContext
(
trust_dict
=
error
.
getTrustDict
(),
caller
=
'info'
).
BusinessTemplate_viewSvnSSLTrustDialog
()
except
SubversionLoginError
,
error1
:
except
SubversionLoginError
as
error1
:
context
.
REQUEST
.
set
(
'portal_status_message'
,
'Server needs authentication, no cookie found'
)
return
context
.
asContext
(
caller
=
'info'
,
realm
=
error1
.
getRealm
(),
username
=
vcs_tool
.
getPreferredUsername
()).
BusinessTemplate_viewSvnLoginDialog
()
return
entry_dict
bt5/erp5_forge/SkinTemplateItem/portal_skins/erp5_vcs/BusinessTemplate_doVcsCommit.py
View file @
b5193345
...
...
@@ -52,5 +52,5 @@ try:
modified
=
commit_dict
[
'modified'
],
removed
=
commit_dict
[
'removed'
]
)
except
Exception
,
error
:
except
Exception
as
error
:
return
context
.
BusinessTemplate_handleException
(
error
,
script
.
id
,
commit_dict
)
bt5/erp5_forge/SkinTemplateItem/portal_skins/erp5_vcs/BusinessTemplate_doVcsUpdate.py
View file @
b5193345
...
...
@@ -8,7 +8,7 @@ if keep:
try
:
new_bt
=
context
.
getVcsTool
().
update
(
commit_dict
[
'keep'
])
except
Exception
,
error
:
except
Exception
as
error
:
return
context
.
BusinessTemplate_handleException
(
error
,
script
.
id
,
commit_dict
)
...
...
bt5/erp5_forge/SkinTemplateItem/portal_skins/erp5_vcs/BusinessTemplate_handleException.py
View file @
b5193345
...
...
@@ -4,15 +4,15 @@ import json
try
:
raise
exception
except
SubversionSSLTrustError
,
e
:
except
SubversionSSLTrustError
as
e
:
message
=
'SSL Certificate was not recognized'
kw
=
dict
(
trust_dict
=
e
.
getTrustDict
())
method
=
'BusinessTemplate_viewSvnSSLTrustDialog'
except
SubversionLoginError
,
e
:
except
SubversionLoginError
as
e
:
message
=
'Server needs authentication, no cookie found'
kw
=
dict
(
realm
=
e
.
getRealm
(),
username
=
context
.
getVcsTool
().
getPreferredUsername
())
method
=
'BusinessTemplate_viewSvnLoginDialog'
except
GitLoginError
,
e
:
except
GitLoginError
as
e
:
message
=
str
(
e
)
kw
=
dict
(
remote_url
=
context
.
getVcsTool
().
getRemoteUrl
())
method
=
'BusinessTemplate_viewGitLoginDialog'
...
...
bt5/erp5_full_text_myisam_catalog/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/SQLCatalog_deferFullTextIndexActivity.py
View file @
b5193345
...
...
@@ -26,7 +26,7 @@ for path in path_list:
raise
except
Unauthorized
:
# should happen in tricky testERP5Catalog tests only
continue
except
Exception
,
e
:
except
Exception
as
e
:
exception
=
e
failed_path_list
.
append
(
path
)
else
:
...
...
bt5/erp5_full_text_sphinxse_catalog/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/SQLCatalog_deferFullTextIndexActivity.py
View file @
b5193345
...
...
@@ -26,7 +26,7 @@ for path in path_list:
raise
except
Unauthorized
:
# should happen in tricky testERP5Catalog tests only
continue
except
Exception
,
e
:
except
Exception
as
e
:
exception
=
e
failed_path_list
.
append
(
path
)
else
:
...
...
bt5/erp5_graph_editor/SkinTemplateItem/portal_skins/erp5_graph_editor/DCWorkflow_edit.py
View file @
b5193345
...
...
@@ -6,7 +6,7 @@ form = getattr(context, form_id)
try
:
# Validate
form
.
validate_all_to_request
(
request
,
key_prefix
=
'my_'
)
except
FormValidationError
,
validation_errors
:
except
FormValidationError
as
validation_errors
:
# Pack errors into the request
result
=
{}
result
[
'field_errors'
]
=
{}
...
...
bt5/erp5_hal_json_style/SkinTemplateItem/portal_skins/erp5_hal_json_style/Workflow_statusModify.py
View file @
b5193345
...
...
@@ -18,7 +18,7 @@ try:
request
.
set
(
'editable_mode'
,
1
)
form
.
validate_all_to_request
(
request
)
request
.
set
(
'editable_mode'
,
editable_mode
)
except
FormValidationError
,
validation_errors
:
except
FormValidationError
as
validation_errors
:
# Pack errors into the request
field_errors
=
form
.
ErrorFields
(
validation_errors
)
request
.
set
(
'field_errors'
,
field_errors
)
...
...
@@ -69,7 +69,7 @@ try:
context
,
doaction_param_list
[
'workflow_action'
],
**
doaction_param_list
)
except
ValidationFailed
,
error_message
:
except
ValidationFailed
as
error_message
:
if
getattr
(
error_message
,
'msg'
,
None
):
# use of Message class to store message+mapping+domain
message
=
error_message
.
msg
...
...
bt5/erp5_inotify/ToolComponentTemplateItem/portal_components/tool.erp5.InotifyTool.py
View file @
b5193345
...
...
@@ -86,7 +86,7 @@ class InotifyTool(TimerServiceMixin, BaseTool):
p
=
os
.
path
.
join
(
inode_path
,
name
)
try
:
s
=
os
.
lstat
(
p
)
except
OSError
,
e
:
except
OSError
as
e
:
if
e
.
errno
!=
errno
.
ENOENT
:
raise
else
:
...
...
bt5/erp5_invoicing/ModuleComponentTemplateItem/portal_components/module.erp5.TestInvoiceMixin.py
View file @
b5193345
...
...
@@ -985,7 +985,7 @@ class TestInvoiceMixin(TestPackingListMixin):
"""
try
:
self
.
tic
()
except
RuntimeError
,
exc
:
except
RuntimeError
as
exc
:
invoice
=
sequence
.
get
(
'invoice'
)
# check which activities are failing
self
.
assertTrue
(
str
(
exc
).
startswith
(
'tic is looping forever.'
),
...
...
bt5/erp5_json_form/TestTemplateItem/portal_components/test.erp5.testJSONForm.py
View file @
b5193345
...
...
@@ -153,7 +153,7 @@ return json.dumps({
try
:
getattr
(
self
.
portal
,
method
)(
json_data
,
list_error
=
True
)
raise
ValueError
(
"No error raised during processing"
)
except
ValueError
,
e
:
except
ValueError
as
e
:
self
.
assertEqual
(
error
,
json
.
loads
(
str
(
e
)))
def
test_call_valid_datetime_format
(
self
):
...
...
@@ -211,6 +211,6 @@ return json.dumps({
try
:
getattr
(
self
.
portal
,
method
)(
json_data
,
list_error
=
True
)
raise
ValueError
(
"No error raised during processing"
)
except
ValueError
,
e
:
except
ValueError
as
e
:
self
.
assertEqual
(
error
,
json
.
loads
(
str
(
e
)))
bt5/erp5_knowledge_pad/SkinTemplateItem/portal_skins/erp5_knowledge_pad/KnowledgeBox_baseEdit.py
View file @
b5193345
...
...
@@ -16,7 +16,7 @@ form = getattr(box, form_id)
try
:
# Validate
form
.
validate_all_to_request
(
request
,
key_prefix
=
form_fields_main_prefix
)
except
FormValidationError
,
validation_errors
:
except
FormValidationError
as
validation_errors
:
# Pack errors into the request
field_errors
=
form
.
ErrorFields
(
validation_errors
)
request
.
set
(
'field_errors'
,
field_errors
)
...
...
bt5/erp5_maileva_connector/DocumentTemplateItem/portal_components/document.erp5.MailevaSOAPConnector.py
View file @
b5193345
...
...
@@ -70,11 +70,11 @@ class MailevaSOAPConnector(XMLObject):
try
:
response
=
suds
.
client
.
Client
(
url
=
self
.
getProperty
(
'submit_url_string'
),
transport
=
authenticated
).
service
.
submit
(
__inject
=
{
'msg'
:
maileva_exchange
.
getRequest
()})
maileva_exchange
.
activate
().
MailevaExchange_processResponse
(
response
)
except
socket
.
error
,
e
:
except
socket
.
error
as
e
:
if
e
.
errno
==
socket
.
errno
.
ECONNREFUSED
:
if
runtime_environment
:
runtime_environment
.
edit
(
max_retry
=
None
)
except
Exception
,
e
:
except
Exception
as
e
:
maileva_exchange
.
activate
().
MailevaExchange_processResponse
(
str
(
e
),
failed
=
True
)
...
...
bt5/erp5_ooo_import/SkinTemplateItem/portal_skins/erp5_ooo_import/Base_importFileLineDefaultScript.py
View file @
b5193345
...
...
@@ -57,7 +57,7 @@ else:
**
imported_line_property_dict
)
except
ConflictError
:
raise
except
Exception
,
error
:
except
Exception
as
error
:
translated_msg
=
Message
(
'erp5_ui'
,
'An error Occurred while creating object: ${error}'
,
mapping
=
dict
(
error
=
Message
(
'erp5_ui'
,
...
...
@@ -75,7 +75,7 @@ else:
new_object
.
edit
(
**
category_dict
)
except
ConflictError
:
raise
except
Exception
,
error
:
except
Exception
as
error
:
#context.log('category: %s' %category)
translated_msg
=
Message
(
'erp5_ui'
,
...
...
bt5/erp5_promise/SkinTemplateItem/portal_skins/erp5_promise/Alarm_checkPromiseBt5.py
View file @
b5193345
...
...
@@ -18,7 +18,7 @@ try:
message_list
=
template_tool
.
upgradeSite
(
bt5_list
,
dry_run
=
True
,
update_catalog
=
CATALOG_UPDATABLE
)
severity
=
len
(
message_list
)
except
BusinessTemplateUnknownError
,
error
:
except
BusinessTemplateUnknownError
as
error
:
severity
=
-
1
detail
=
str
(
error
)
...
...
bt5/erp5_real_time_inventory_accounting_test/TestTemplateItem/portal_components/test.erp5.testRealTimeInventoryAccounting.py
View file @
b5193345
...
...
@@ -54,7 +54,7 @@ class TestRealTimeInventoryAccountingMixin:
self
.
portal
.
portal_workflow
.
doActionFor
(
document
,
workflow_method_id
)
else
:
getattr
(
document
,
workflow_method_id
)()
except
ValidationFailed
,
error
:
except
ValidationFailed
as
error
:
self
.
fail
(
"Transition '%s' on %r should have succeeded (%s)"
%
\
(
workflow_method_id
,
document
,
sorted
([
m
.
message
for
m
in
error
.
msg
])))
...
...
bt5/erp5_simulation/SkinTemplateItem/portal_skins/erp5_simulation/Base_editConfiguration.py
View file @
b5193345
...
...
@@ -33,7 +33,7 @@ try:
# Update basic attributes
context
.
updateConfiguration
(
**
kw
)
context
.
reindexObject
()
except
FormValidationError
,
validation_errors
:
except
FormValidationError
as
validation_errors
:
# Pack errors into the request
field_errors
=
form
.
ErrorFields
(
validation_errors
)
request
.
set
(
'field_errors'
,
field_errors
)
...
...
bt5/erp5_sql_browser/SkinTemplateItem/portal_skins/erp5_sql_browser/ZMySQLDAConnection_getQueryResultAsJSON.py
View file @
b5193345
...
...
@@ -8,7 +8,7 @@ response = container.REQUEST.RESPONSE
start
=
time
.
time
()
try
:
results
=
context
.
manage_test
(
query
)
except
Exception
,
e
:
except
Exception
as
e
:
response
.
setStatus
(
500
)
try
:
response
.
write
(
str
(
e
[
1
]))
...
...
bt5/erp5_test_result/DocumentTemplateItem/portal_components/document.erp5.ERP5ProjectUnitTestDistributor.py
View file @
b5193345
...
...
@@ -271,7 +271,7 @@ class ERP5ProjectUnitTestDistributor(XMLObject):
if
test_node
.
getValidationState
()
!=
'validated'
:
try
:
test_node
.
validate
()
except
Exception
,
e
:
except
Exception
as
e
:
LOG
(
'Test Node Validate'
,
ERROR
,
'%s'
%
e
)
if
test_node
is
None
:
test_node
=
test_node_module
.
newContent
(
portal_type
=
"Test Node"
,
title
=
title
,
computer_guid
=
computer_guid
,
...
...
bt5/erp5_test_result/DocumentTemplateItem/portal_components/document.erp5.ERP5ScalabilityDistributor.py
View file @
b5193345
...
...
@@ -128,7 +128,7 @@ class ERP5ScalabilityDistributor(ERP5ProjectUnitTestDistributor, object):
if
test_node
.
getValidationState
()
!=
'validated'
:
try
:
test_node
.
validate
()
except
Exception
,
e
:
except
Exception
as
e
:
LOG
(
'Test Node Validate'
,
ERROR
,
'%s'
%
e
)
return
test_node
return
None
...
...
bt5/erp5_tiosafe_core/DocumentTemplateItem/portal_components/document.erp5.IntegrationModule.py
View file @
b5193345
...
...
@@ -87,7 +87,7 @@ class IntegrationModule(XMLObject):
return
self
.
getObjectList
(
id
=
item
)
else
:
return
self
.
getObjectList
[
item
]
except
ValueError
,
msg
:
except
ValueError
as
msg
:
raise
KeyError
(
msg
)
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
...
...
bt5/erp5_tiosafe_core/DocumentTemplateItem/portal_components/document.erp5.WebServiceRequest.py
View file @
b5193345
...
...
@@ -184,7 +184,7 @@ class WebServiceRequest(XMLObject, ZopePageTemplate):
# Call the method
try
:
url
,
xml
=
callRequest
(
self
,
method_name
,
*
args
,
**
kw
)
except
ConnectionError
,
msg
:
except
ConnectionError
as
msg
:
if
test_mode
:
error
=
msg
url
=
connection
.
url
...
...
bt5/erp5_tiosafe_core/SkinTemplateItem/portal_skins/erp5_integration/WebServiceRequest_test.py
View file @
b5193345
...
...
@@ -20,7 +20,7 @@ if context.getLastRequestError() is None:
for
obj
in
object_list
:
try
:
xml
=
obj
.
asXML
(
debug
=
True
)
except
(
ValueError
,
NotImplementedError
)
,
msg
:
except
(
ValueError
,
NotImplementedError
)
as
msg
:
error
=
msg
continue
if
not
xml
:
...
...
bt5/erp5_travel_expense/SkinTemplateItem/portal_skins/erp5_hr_request/ExpenseValidationRequest_createPurchaseTransaction.py
View file @
b5193345
...
...
@@ -47,7 +47,7 @@ from Products.ERP5Type.Core.Workflow import ValidationFailed
from
zExceptions
import
Redirect
try
:
transaction
.
Base_checkConsistency
()
except
ValidationFailed
,
error_message
:
except
ValidationFailed
as
error_message
:
if
getattr
(
error_message
,
'msg'
,
None
):
# use of Message class to store message+mapping+domain
message
=
error_message
.
msg
...
...
bt5/erp5_ui_test/TestTemplateItem/portal_components/test.erp5.testListBox.py
View file @
b5193345
...
...
@@ -239,7 +239,7 @@ class TestListBox(ERP5TypeTestCase):
request
[
'here'
]
=
portal
.
foo_module
try
:
listbox
.
get_value
(
'default'
,
render_format
=
'list'
,
REQUEST
=
request
)
except
UnicodeError
,
e
:
except
UnicodeError
as
e
:
self
.
fail
(
'Rendering failed: %s'
%
e
)
self
.
assertIn
(
u"
\
xe9
lisa"
,
listbox
.
render
(
REQUEST
=
request
))
...
...
@@ -269,7 +269,7 @@ class TestListBox(ERP5TypeTestCase):
request
[
'here'
]
=
portal
.
foo_module
try
:
listbox
.
get_value
(
'default'
,
render_format
=
'list'
,
REQUEST
=
request
)
except
UnicodeError
,
e
:
except
UnicodeError
as
e
:
self
.
fail
(
'Rendering failed: %s'
%
e
)
self
.
assertIn
(
u"
\
xe9
lisa"
,
listbox
.
render
(
REQUEST
=
request
))
...
...
@@ -303,7 +303,7 @@ class TestListBox(ERP5TypeTestCase):
request
[
'here'
]
=
portal
.
foo_module
try
:
listbox
.
get_value
(
'default'
,
render_format
=
'list'
,
REQUEST
=
request
)
except
UnicodeError
,
e
:
except
UnicodeError
as
e
:
self
.
fail
(
'Rendering failed: %s'
%
e
)
self
.
assertIn
(
u"http://example.com/?
\
xe9
lisa"
,
listbox
.
render
(
REQUEST
=
request
))
...
...
@@ -337,7 +337,7 @@ class TestListBox(ERP5TypeTestCase):
request
[
'here'
]
=
portal
.
foo_module
try
:
listbox
.
get_value
(
'default'
,
render_format
=
'list'
,
REQUEST
=
request
)
except
UnicodeError
,
e
:
except
UnicodeError
as
e
:
self
.
fail
(
'Rendering failed: %s'
%
e
)
self
.
assertIn
(
u"http://example.com/?
\
xe9
lisa"
,
listbox
.
render
(
REQUEST
=
request
))
...
...
@@ -359,7 +359,7 @@ class TestListBox(ERP5TypeTestCase):
listbox
.
get_value
(
'default'
,
render_format
=
'list'
,
REQUEST
=
request
)
try
:
self
.
commit
()
except
TypeError
,
e
:
except
TypeError
as
e
:
self
.
fail
(
'Unable to commit transaction: %s'
%
e
)
def
test_06_LineFields
(
self
,
quiet
=
0
,
run
=
run_all_test
):
...
...
bt5/erp5_ui_test_core/ExtensionTemplateItem/portal_components/extension.erp5.ERP5Zuite.py
View file @
b5193345
...
...
@@ -36,7 +36,7 @@ def urlread(url, safe_return=0):
import
urllib
try
:
return
urllib
.
urlopen
(
url
).
read
()
except
IOError
,
e
:
except
IOError
as
e
:
if
safe_return
:
# Return an Selenium test code that will obviously fail. This
# prevent zelenium test run get Stalled.
...
...
bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web_widget_library/WebSite_registerUser.py
View file @
b5193345
...
...
@@ -36,7 +36,7 @@ try:
user
=
context
.
WebSite_createUser
(
**
kwargs
)
log
(
user
)
msg
=
'Thank you for registering. Your password will be sent to the email address that you provided once your account has been validated by the appropriate department.'
except
Exception
,
e
:
except
Exception
as
e
:
msg
=
str
(
e
)
return
req
.
RESPONSE
.
redirect
(
context
.
absolute_url
()
+
'?portal_status_message='
+
msg
)
bt5/erp5_web_service/ModuleComponentTemplateItem/portal_components/module.erp5.SFTPConnection.py
View file @
b5193345
...
...
@@ -94,14 +94,14 @@ class SFTPConnection:
raise
SFTPError
(
"No password or private_key defined"
)
# Connect
self
.
conn
=
SFTPClient
.
from_transport
(
self
.
transport
)
except
(
gaierror
,
error
)
,
msg
:
except
(
gaierror
,
error
)
as
msg
:
raise
SFTPError
(
str
(
msg
)
+
' while establishing connection to %s'
%
(
self
.
url
,))
# Go to specified directory
try
:
schema
.
path
.
rstrip
(
'/'
)
if
len
(
schema
.
path
):
self
.
conn
.
chdir
(
schema
.
path
)
except
IOError
,
msg
:
except
IOError
as
msg
:
raise
SFTPError
(
str
(
msg
)
+
' while changing to dir -%r-'
%
(
schema
.
path
,))
return
self
...
...
@@ -113,7 +113,7 @@ class SFTPConnection:
serialized_data
=
Binary
(
str
(
data
))
try
:
self
.
conn
.
putfo
(
StringIO
(
str
(
serialized_data
)),
filepath
,
confirm
=
confirm
)
except
error
,
msg
:
except
error
as
msg
:
raise
SFTPError
(
str
(
msg
)
+
' while writing file %s on %s'
%
(
filepath
,
path
))
def
_getFile
(
self
,
filepath
):
...
...
@@ -125,7 +125,7 @@ class SFTPConnection:
tmp_file
=
self
.
conn
.
file
(
filepath
,
'rb'
)
tmp_file
.
seek
(
0
)
return
tmp_file
.
read
()
except
error
,
msg
:
except
error
as
msg
:
raise
SFTPError
(
str
(
msg
)
+
' while retrieving file %s from %s'
%
(
filepath
,
self
.
url
))
def
readBinaryFile
(
self
,
filepath
):
...
...
@@ -149,7 +149,7 @@ class SFTPConnection:
if
sort_on
:
return
[
x
.
filename
for
x
in
sorted
(
self
.
conn
.
listdir_attr
(
path
),
key
=
operator
.
attrgetter
(
sort_on
))]
return
self
.
conn
.
listdir
(
path
)
except
(
EOFError
,
error
)
,
msg
:
except
(
EOFError
,
error
)
as
msg
:
raise
SFTPError
(
str
(
msg
)
+
' while trying to list %s on %s'
%
(
path
,
self
.
url
))
def
getDirectoryFileList
(
self
,
path
):
...
...
@@ -160,14 +160,14 @@ class SFTPConnection:
"""Delete the file"""
try
:
self
.
conn
.
unlink
(
filepath
)
except
error
,
msg
:
except
error
as
msg
:
raise
SFTPError
(
str
(
msg
)
+
'while trying to delete %s on %s'
%
(
filepath
,
self
.
url
))
def
renameFile
(
self
,
old_path
,
new_path
):
"""Rename a file"""
try
:
self
.
conn
.
rename
(
old_path
,
new_path
)
except
error
,
msg
:
except
error
as
msg
:
raise
SFTPError
(
'%s while trying to rename "%s" to "%s" on %s.'
%
\
(
str
(
msg
),
old_path
,
new_path
,
self
.
url
))
...
...
bt5/erp5_web_service/ModuleComponentTemplateItem/portal_components/module.erp5.SOAPWSDLConnection.py
View file @
b5193345
...
...
@@ -156,7 +156,7 @@ class MethodWrapper(object):
def
__call__
(
self
,
*
args
,
**
kw
):
try
:
return
self
.
_method
(
*
args
,
**
kw
)
except
SOAPpy
.
Types
.
faultType
,
exception
:
except
SOAPpy
.
Types
.
faultType
as
exception
:
raise
SOAPWSDLException
(
*
exception
())
# SOAPpy says nothing about thread-safeness of parsed WSDL.
...
...
product/ERP5Type/tests/Python3StyleTest.py
View file @
b5193345
...
...
@@ -78,6 +78,9 @@ class Python3StyleTest(ERP5TypeTestCase):
def
test_applyFixApplied
(
self
):
self
.
_testFixer
(
'apply'
)
def
test_exceptFixApplied
(
self
):
self
.
_testFixer
(
'except'
)
def
test_hasKeyFixApplied
(
self
):
self
.
_testFixer
(
'has_key'
)
...
...
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