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
Titouan Soulard
erp5
Commits
debb2043
Commit
debb2043
authored
Feb 18, 2021
by
Julien Muchembled
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wip
parent
ea5e3ed7
Changes
70
Show whitespace changes
Inline
Side-by-side
Showing
70 changed files
with
246 additions
and
251 deletions
+246
-251
bt5/erp5_archive/WorkflowTemplateItem/portal_workflow/archive_inventory_workflow/scripts/validateConsistency.py
...archive_inventory_workflow/scripts/validateConsistency.py
+1
-1
bt5/erp5_archive/WorkflowTemplateItem/portal_workflow/archive_workflow/scripts/checkArchive.py
.../portal_workflow/archive_workflow/scripts/checkArchive.py
+4
-4
bt5/erp5_base/MixinTemplateItem/portal_components/mixin.erp5.BuilderMixin.py
...TemplateItem/portal_components/mixin.erp5.BuilderMixin.py
+8
-7
bt5/erp5_calendar/SkinTemplateItem/portal_skins/erp5_calendar/PersonModule_getLeaveRequestReportLineList.py
...p5_calendar/PersonModule_getLeaveRequestReportLineList.py
+2
-2
bt5/erp5_certificate_authority/ToolComponentTemplateItem/portal_components/tool.erp5.CertificateAuthorityTool.py
...m/portal_components/tool.erp5.CertificateAuthorityTool.py
+2
-2
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testERP5Catalog.py
...mplateItem/portal_components/test.erp5.testERP5Catalog.py
+1
-1
bt5/erp5_credential/SkinTemplateItem/portal_skins/erp5_credential/Credential_updatePersonPassword.py
..._skins/erp5_credential/Credential_updatePersonPassword.py
+4
-4
bt5/erp5_mrp/TestTemplateItem/portal_components/test.erp5.testProductionOrder.py
...teItem/portal_components/test.erp5.testProductionOrder.py
+2
-2
bt5/erp5_payroll/SkinTemplateItem/portal_skins/erp5_payroll/PaySheetModelLine_asCellRange.py
...ortal_skins/erp5_payroll/PaySheetModelLine_asCellRange.py
+3
-2
bt5/erp5_payroll/SkinTemplateItem/portal_skins/erp5_payroll/PaySheetTransaction_getODTDataDict.py
..._skins/erp5_payroll/PaySheetTransaction_getODTDataDict.py
+3
-3
bt5/erp5_payroll/SkinTemplateItem/portal_skins/erp5_payroll/PaySheetTransaction_getYearToDateWorkTimeSalary.py
...ayroll/PaySheetTransaction_getYearToDateWorkTimeSalary.py
+1
-1
bt5/erp5_project/SkinTemplateItem/portal_skins/erp5_project/Project_getMonthlyReportSectionList.py
...skins/erp5_project/Project_getMonthlyReportSectionList.py
+1
-1
bt5/erp5_syncml/DocumentTemplateItem/portal_components/document.erp5.SyncMLSubscription.py
...tem/portal_components/document.erp5.SyncMLSubscription.py
+6
-6
bt5/erp5_syncml/ModuleComponentTemplateItem/portal_components/module.erp5.XMLSyncUtils.py
...emplateItem/portal_components/module.erp5.XMLSyncUtils.py
+3
-4
bt5/erp5_tiosafe_core/ExtensionTemplateItem/portal_components/extension.erp5.TioSafeNodeConduit.py
...em/portal_components/extension.erp5.TioSafeNodeConduit.py
+4
-3
bt5/erp5_tiosafe_core/ExtensionTemplateItem/portal_components/extension.erp5.TioSafeResourceConduit.py
...ortal_components/extension.erp5.TioSafeResourceConduit.py
+8
-6
bt5/erp5_tiosafe_core/ModuleComponentTemplateItem/portal_components/module.erp5.AccountingERP5IntegrationConduit.py
...omponents/module.erp5.AccountingERP5IntegrationConduit.py
+1
-1
bt5/erp5_tiosafe_core/ModuleComponentTemplateItem/portal_components/module.erp5.ERP5NodeConduit.py
...lateItem/portal_components/module.erp5.ERP5NodeConduit.py
+3
-2
bt5/erp5_tiosafe_core/ModuleComponentTemplateItem/portal_components/module.erp5.ERP5ResourceConduit.py
...Item/portal_components/module.erp5.ERP5ResourceConduit.py
+9
-7
bt5/erp5_tiosafe_core/ModuleComponentTemplateItem/portal_components/module.erp5.ERP5TransactionConduit.py
...m/portal_components/module.erp5.ERP5TransactionConduit.py
+1
-1
bt5/erp5_tiosafe_core/ModuleComponentTemplateItem/portal_components/module.erp5.TioSafeNodeConduit.py
...eItem/portal_components/module.erp5.TioSafeNodeConduit.py
+4
-3
bt5/erp5_tiosafe_core/ModuleComponentTemplateItem/portal_components/module.erp5.TioSafeResourceConduit.py
...m/portal_components/module.erp5.TioSafeResourceConduit.py
+8
-6
bt5/erp5_travel_expense/SkinTemplateItem/portal_skins/erp5_hr_request/ExpenseValidationRequest_createPurchaseTransaction.py
...est/ExpenseValidationRequest_createPurchaseTransaction.py
+2
-4
bt5/erp5_user_tutorial_ui_test/SkinTemplateItem/portal_skins/erp5_user_tutorial_ui_test/Zuite_checkPortalCatalog.py
...ns/erp5_user_tutorial_ui_test/Zuite_checkPortalCatalog.py
+1
-1
product/ERP5/Document/BusinessTemplate.py
product/ERP5/Document/BusinessTemplate.py
+11
-10
product/ERP5/Document/SQLNonContinuousIncreasingIdGenerator.py
...ct/ERP5/Document/SQLNonContinuousIncreasingIdGenerator.py
+1
-1
product/ERP5/Document/ZODBContinuousIncreasingIdGenerator.py
product/ERP5/Document/ZODBContinuousIncreasingIdGenerator.py
+1
-1
product/ERP5/ERP5Site.py
product/ERP5/ERP5Site.py
+2
-2
product/ERP5/Tool/IdTool.py
product/ERP5/Tool/IdTool.py
+13
-21
product/ERP5/Tool/TemplateTool.py
product/ERP5/Tool/TemplateTool.py
+3
-3
product/ERP5/bootstrap/erp5_core/DocumentTemplateItem/portal_components/document.erp5.Amount.py
...entTemplateItem/portal_components/document.erp5.Amount.py
+2
-3
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_getOwnerId.py
...kinTemplateItem/portal_skins/erp5_core/Base_getOwnerId.py
+1
-1
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/BusinessTemplate_getModifiableFieldList.py
...kins/erp5_core/BusinessTemplate_getModifiableFieldList.py
+2
-2
product/ERP5/bootstrap/erp5_core/ToolComponentTemplateItem/portal_components/tool.erp5.IntrospectionTool.py
...lateItem/portal_components/tool.erp5.IntrospectionTool.py
+0
-5
product/ERP5/bootstrap/erp5_core/ToolComponentTemplateItem/portal_components/tool.erp5.SimulationTool.py
...emplateItem/portal_components/tool.erp5.SimulationTool.py
+7
-9
product/ERP5/tests/testInventoryAPI.py
product/ERP5/tests/testInventoryAPI.py
+2
-2
product/ERP5/tests/testXHTML.py
product/ERP5/tests/testXHTML.py
+2
-1
product/ERP5Form/Form.py
product/ERP5Form/Form.py
+4
-3
product/ERP5Form/PDFParser.py
product/ERP5Form/PDFParser.py
+3
-3
product/ERP5Form/Tool/SelectionTool.py
product/ERP5Form/Tool/SelectionTool.py
+2
-2
product/ERP5OOo/tests/testOOoStyleWithFlare.py
product/ERP5OOo/tests/testOOoStyleWithFlare.py
+1
-1
product/ERP5Security/ERP5KeyAuthPlugin.py
product/ERP5Security/ERP5KeyAuthPlugin.py
+2
-3
product/ERP5Security/__init__.py
product/ERP5Security/__init__.py
+13
-11
product/ERP5Type/Cache.py
product/ERP5Type/Cache.py
+2
-2
product/ERP5Type/CopySupport.py
product/ERP5Type/CopySupport.py
+2
-2
product/ERP5Type/Tool/MemcachedTool.py
product/ERP5Type/Tool/MemcachedTool.py
+2
-2
product/ERP5Type/Utils.py
product/ERP5Type/Utils.py
+2
-2
product/ERP5Type/mixin/matrix.py
product/ERP5Type/mixin/matrix.py
+3
-3
product/ERP5Type/patches/DateTimePatch.py
product/ERP5Type/patches/DateTimePatch.py
+8
-8
product/ERP5Type/patches/sqltest.py
product/ERP5Type/patches/sqltest.py
+2
-3
product/Formulator/Validator.py
product/Formulator/Validator.py
+3
-3
product/Formulator/XMLToForm.py
product/Formulator/XMLToForm.py
+0
-1
product/HBTreeFolder2/HBTreeFolder2.py
product/HBTreeFolder2/HBTreeFolder2.py
+2
-2
product/Localizer/__init__.py
product/Localizer/__init__.py
+2
-2
product/PortalTransforms/libtransforms/commandtransform.py
product/PortalTransforms/libtransforms/commandtransform.py
+1
-1
product/ZLDAPMethods/LM.py
product/ZLDAPMethods/LM.py
+2
-2
product/ZMySQLDA/db.py
product/ZMySQLDA/db.py
+2
-2
product/ZSQLCatalog/ColumnMap.py
product/ZSQLCatalog/ColumnMap.py
+3
-1
product/ZSQLCatalog/Extensions/zsqlbrain.py
product/ZSQLCatalog/Extensions/zsqlbrain.py
+2
-2
product/ZSQLCatalog/Operator/OperatorBase.py
product/ZSQLCatalog/Operator/OperatorBase.py
+2
-2
product/ZSQLCatalog/Query/AutoQuery.py
product/ZSQLCatalog/Query/AutoQuery.py
+2
-2
product/ZSQLCatalog/Query/Query.py
product/ZSQLCatalog/Query/Query.py
+3
-3
product/ZSQLCatalog/Query/SimpleQuery.py
product/ZSQLCatalog/Query/SimpleQuery.py
+1
-1
product/ZSQLCatalog/SearchKey/DateTimeKey.py
product/ZSQLCatalog/SearchKey/DateTimeKey.py
+1
-1
product/ZSQLCatalog/SearchKey/SearchKey.py
product/ZSQLCatalog/SearchKey/SearchKey.py
+9
-9
product/ZSQLCatalog/SearchText/SearchTextParser.py
product/ZSQLCatalog/SearchText/SearchTextParser.py
+1
-1
product/ZSQLCatalog/ZSQLCatalog.py
product/ZSQLCatalog/ZSQLCatalog.py
+10
-11
product/ZSQLCatalog/tests/testSQLCatalog.py
product/ZSQLCatalog/tests/testSQLCatalog.py
+1
-1
product/Zelenium/zuite.py
product/Zelenium/zuite.py
+6
-5
tests/__init__.py
tests/__init__.py
+18
-19
No files found.
bt5/erp5_archive/WorkflowTemplateItem/portal_workflow/archive_inventory_workflow/scripts/validateConsistency.py
View file @
debb2043
...
...
@@ -21,4 +21,4 @@ if node is None:
# use of the constraint
error_list
=
inventory
.
checkConsistency
()
if
len
(
error_list
)
>
0
:
raise
ValidationFailed
(
error_list
[
0
].
getTranslatedMessage
()
,
)
raise
ValidationFailed
(
error_list
[
0
].
getTranslatedMessage
())
bt5/erp5_archive/WorkflowTemplateItem/portal_workflow/archive_workflow/scripts/checkArchive.py
View file @
debb2043
...
...
@@ -11,7 +11,7 @@ catalog_id = archive.getCatalogId()
if
"deferred"
not
in
archive
.
getDeferredConnectionId
():
msg
=
Message
(
domain
=
'ui'
,
message
=
'Deferred connection ID choose is not a deferred connection.'
)
raise
ValidationFailed
(
msg
,
)
raise
ValidationFailed
(
msg
)
def
sort_max_date
(
a
,
b
):
return
cmp
(
a
.
getStopDateRangeMax
(),
b
.
getStopDateRangeMax
())
...
...
@@ -32,7 +32,7 @@ if archive.getStopDateRangeMax() is not None:
break
if
previous_archive
.
getStopDateRangeMax
().
Date
()
!=
min_stop_date
:
msg
=
Message
(
domain
=
'ui'
,
message
=
'Archive are not contiguous.'
)
raise
ValidationFailed
(
msg
,
)
raise
ValidationFailed
(
msg
)
else
:
previous_archive_list
=
[
x
.
getObject
()
for
x
in
archive
.
portal_catalog
(
portal_type
=
"Archive"
,
validation_state
=
'ready'
)]
...
...
@@ -47,7 +47,7 @@ else:
break
if
previous_archive
.
getStopDateRangeMax
().
Date
()
!=
min_stop_date
:
msg
=
Message
(
domain
=
'ui'
,
message
=
'Archive are not contiguous.'
)
raise
ValidationFailed
(
msg
,
)
raise
ValidationFailed
(
msg
)
# Check the catalog
...
...
@@ -57,4 +57,4 @@ previous_archive_list = [x.getObject() for x in archive.portal_catalog(portal_ty
for
arch
in
previous_archive_list
:
if
arch
.
getCatalogId
()
==
catalog_id
and
arch
is
not
previous_archive
:
msg
=
Message
(
domain
=
'ui'
,
message
=
'Use of a former catalog is prohibited.'
)
raise
ValidationFailed
(
msg
,
)
raise
ValidationFailed
(
msg
)
bt5/erp5_base/MixinTemplateItem/portal_components/mixin.erp5.BuilderMixin.py
View file @
debb2043
...
...
@@ -290,8 +290,8 @@ class BuilderMixin(XMLObject, Amount, Predicate):
for
movement
in
select_method
(
**
kw
):
movement
=
movement
.
getObject
()
if
movement
in
movement_set
:
raise
SelectMethodError
(
'%s returned %s twice or more'
%
\
(
method_id
,
movement
.
getRelativeUrl
()))
raise
SelectMethodError
(
'%s returned %s twice or more'
%
(
method_id
,
movement
.
getRelativeUrl
()))
movement_set
.
add
(
movement
)
movement_list
.
append
(
movement
)
...
...
@@ -493,7 +493,7 @@ class BuilderMixin(XMLObject, Amount, Predicate):
if
delivery
is
None
:
if
not
self
.
isDeliveryCreatable
():
raise
SelectMethodError
(
'No updatable delivery found with %s for %s'
\
raise
SelectMethodError
(
'No updatable delivery found with %s for %s'
%
(
self
.
getPath
(),
movement_group_node_list
))
delivery
=
self
.
_createDelivery
(
delivery_module
,
...
...
@@ -661,8 +661,9 @@ class BuilderMixin(XMLObject, Amount, Predicate):
else
:
movement_list
=
movement_group_node
.
getMovementList
()
if
len
(
movement_list
)
!=
1
:
raise
CollectError
(
"DeliveryBuilder: %s unable to distinct those
\
movements: %s"
%
(
self
.
getId
(),
str
(
movement_list
)))
raise
CollectError
(
"DeliveryBuilder: %s unable to distinct those movements: %s"
%
(
self
.
getId
(),
movement_list
))
else
:
# XXX Hardcoded value
base_id
=
'movement'
...
...
@@ -720,8 +721,8 @@ class BuilderMixin(XMLObject, Amount, Predicate):
membership_criterion_base_category_list
=
movement
.
\
getVariationBaseCategoryList
())
else
:
raise
MatrixError
(
'Cell: %s already exists on %s'
%
\
(
str
(
cell_key
),
str
(
delivery_line
)
))
raise
MatrixError
(
'Cell: %s already exists on %s'
%
(
cell_key
,
delivery_line
))
object_to_update
=
cell
self
.
_setUpdated
(
object_to_update
,
'cell'
)
self
.
_setDeliveryMovementProperties
(
...
...
bt5/erp5_calendar/SkinTemplateItem/portal_skins/erp5_calendar/PersonModule_getLeaveRequestReportLineList.py
View file @
debb2043
...
...
@@ -42,7 +42,7 @@ for person in person_value_list:
resource
=
inventory
.
resource_relative_url
if
inventory
.
resource_uid
in
presence_resource_uid_list
:
raise
ValueError
(
"This report does not work when same resource are"
\
raise
ValueError
(
"This report does not work when same resource are"
" used in presence and leave."
)
person_time
=
(
person_planned_time
-
person
.
getAvailableTime
(
...
...
bt5/erp5_certificate_authority/ToolComponentTemplateItem/portal_components/tool.erp5.CertificateAuthorityTool.py
View file @
debb2043
...
...
@@ -230,7 +230,7 @@ class CertificateAuthorityTool(BaseTool):
except
Exception
:
# do not raise during cleanup
pass
reraise
(
e
[
0
],
e
[
1
],
e
[
2
]
)
reraise
(
*
e
)
finally
:
self
.
_unlockCertificateAuthority
()
...
...
@@ -273,7 +273,7 @@ class CertificateAuthorityTool(BaseTool):
except
Exception
:
# do not raise during cleanup
pass
reraise
(
e
[
0
],
e
[
1
],
e
[
2
]
)
reraise
(
*
e
)
finally
:
self
.
_unlockCertificateAuthority
()
...
...
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testERP5Catalog.py
View file @
debb2043
...
...
@@ -2155,7 +2155,7 @@ class TestERP5Catalog(ERP5TypeTestCase, LogInterceptor):
result
=
query
(
'SELECT * FROM roles_and_users WHERE allowedRolesAndUsers LIKE "%s:%%" AND uid = %i'
%
(
line
[
'allowedRolesAndUsers'
],
uid
)
)
self
.
assertNotEqual
(
len
(
result
),
0
,
'No line found for allowedRolesAndUsers=%r and uid=%i'
%
(
line
[
'allowedRolesAndUsers'
],
uid
))
else
:
raise
Exception
(
'Malformed allowedRolesAndUsers value: %
r'
%
(
line
[
'allowedRolesAndUsers'
],
)
)
raise
Exception
(
'Malformed allowedRolesAndUsers value: %
(allowedRolesAndUsers)r'
%
line
)
# Check that object that 'bar' can view because of 'Author' role can *not*
# be found when searching for his other 'Whatever' role.
...
...
bt5/erp5_credential/SkinTemplateItem/portal_skins/erp5_credential/Credential_updatePersonPassword.py
View file @
debb2043
...
...
@@ -14,16 +14,16 @@ if context.getPassword():
if
login
.
getReference
()
==
reference
:
break
else
:
raise
RuntimeError
(
'Person %s does not have a validated Login with reference %r'
%
\
(
person
.
getRelativeUrl
(),
reference
))
raise
RuntimeError
(
'Person %s does not have a validated Login with reference %r'
%
(
person
.
getRelativeUrl
(),
reference
))
else
:
# BBB when login reference is not set in Credential Update document.
if
login_list
:
user_id
=
person
.
Person_getUserId
()
login
=
sorted
(
login_list
,
key
=
lambda
x
:
x
.
getReference
()
==
user_id
,
reverse
=
True
)[
0
]
else
:
raise
RuntimeError
(
'Person %s does not have a validated Login with reference %r'
%
\
(
person
.
getRelativeUrl
(),
reference
))
raise
RuntimeError
(
'Person %s does not have a validated Login with reference %r'
%
(
person
.
getRelativeUrl
(),
reference
))
else
:
# BBB
login
=
person
...
...
bt5/erp5_mrp/TestTemplateItem/portal_components/test.erp5.testProductionOrder.py
View file @
debb2043
...
...
@@ -696,8 +696,8 @@ class TestProductionOrderMixin(TestOrderMixin):
LOG
(
'object.getDeliveryValue()'
,
0
,
delivery_value
)
if
delivery_value
is
not
None
:
LOG
(
'object.getDeliveryValue().getQuantity()'
,
0
,
delivery_value
.
getQuantity
())
raise
AssertionError
(
"Attribute: %s, Value: %s, Result: %s"
%
\
(
attribute
,
value
,
getattr
(
object
,
attribute
)()))
raise
AssertionError
(
"Attribute: %s, Value: %s, Result: %s"
%
(
attribute
,
value
,
getattr
(
object
,
attribute
)()))
def
stepCheckProductionSimulation
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
...
...
bt5/erp5_payroll/SkinTemplateItem/portal_skins/erp5_payroll/PaySheetModelLine_asCellRange.py
View file @
debb2043
...
...
@@ -45,8 +45,9 @@ if matrixbox :
translateString
(
'${contribution_share_title} (Amount or Percent)'
,
mapping
=
dict
(
contribution_share_title
=
category_item
[
0
]))))
else
:
raise
ValueError
(
"PaySheetModelLine_asCellRange: the two categories "
\
"must could be only contribution_share and salary_range"
)
raise
ValueError
(
"%s: base category must be either contribution_share or salary_range"
%
script
.
id
)
cell_range
.
append
(
category_cell_range
)
cell_range
=
filter
(
lambda
x
:
x
!=
[],
cell_range
)
...
...
bt5/erp5_payroll/SkinTemplateItem/portal_skins/erp5_payroll/PaySheetTransaction_getODTDataDict.py
View file @
debb2043
...
...
@@ -105,9 +105,9 @@ def getSocialOrganisationValue():
business_path_list
=
business_process
.
getTradeModelPathValueList
(
trade_phase
=
\
'payroll/invoicing/social_security'
,
context
=
context
)
if
len
(
business_path_list
)
>
1
:
raise
NotImplementedError
(
'For now, it can not support more
'
\
'
than one business_path with same trade_phase. '
\
'
%s have same trade_phase'
%
repr
(
business_path_list
)
)
raise
NotImplementedError
(
'For now, it can not support more
'
'
than one business_path with same trade_phase.'
'
%r have same trade_phase'
%
business_path_list
)
if
len
(
business_path_list
)
==
1
:
business_path
=
business_path_list
[
0
]
return
business_path
.
getSourceSectionValue
()
...
...
bt5/erp5_payroll/SkinTemplateItem/portal_skins/erp5_payroll/PaySheetTransaction_getYearToDateWorkTimeSalary.py
View file @
debb2043
...
...
@@ -22,7 +22,7 @@ for paysheet in paysheet_list:
if
annotation_line
is
None
:
annotation_line
=
getattr
(
paysheet
,
'work_time_annotation_line'
,
None
)
if
annotation_line
is
None
:
raise
ValueError
(
"Paysheet %s has no Annotation Line with reference work_time_annotation_line"
\
raise
ValueError
(
"Paysheet %s has no Annotation Line with reference work_time_annotation_line"
%
paysheet
.
getRelativeUrl
())
nb_heures
=
annotation_line
.
getQuantity
()
yearly_work_time
+=
nb_heures
...
...
bt5/erp5_project/SkinTemplateItem/portal_skins/erp5_project/Project_getMonthlyReportSectionList.py
View file @
debb2043
...
...
@@ -97,7 +97,7 @@ for task_line in result_list:
source_uid
=
task_line
.
node_uid
if
source_uid
is
None
:
# This should not happens, so display an error message
raise
ValueError
(
context
.
Base_translateString
(
\
raise
ValueError
(
context
.
Base_translateString
(
"This task should have a source : ${task_relative_url}"
,
mapping
=
{
'task_relative_url'
:
task_line
.
getRelativeUrl
()}))
source_dict
=
source_uid_dict
.
get
(
source_uid
,
None
)
...
...
bt5/erp5_syncml/DocumentTemplateItem/portal_components/document.erp5.SyncMLSubscription.py
View file @
debb2043
...
...
@@ -402,11 +402,11 @@ class SyncMLSubscription(XMLObject):
try:
user = user_folder.getUserById(user_id).__of__(user_folder) # __of__ might got AttributeError
except AttributeError:
raise ValueError("
User
%
s
cannot
be
found
in
user
folder
,
\
synchronization
cannot
work
with
this
kind
of
user
" % (user_id,)
)
raise ValueError("
User
%
s
cannot
be
found
in
user
folder
,
"
"
synchronization
cannot
work
with
this
kind
of
user
" % user_id
)
if user is None:
raise ValueError("
User
%
s
cannot
be
found
in
user
folder
,
\
synchronization
cannot
work
with
this
kind
of
user
" % (user_id,)
)
raise ValueError("
User
%
s
cannot
be
found
in
user
folder
,
"
"
synchronization
cannot
work
with
this
kind
of
user
" % user_id
)
else:
newSecurityManager(None, user)
else:
...
...
@@ -1036,10 +1036,10 @@ class SyncMLSubscription(XMLObject):
else:
result_list = query_method(**kw)
else:
raise KeyError('This Subscriber %s provide no list method:%r'
\
raise KeyError('This Subscriber %s provide no list method:%r'
% (self.getPath(), list_method_id))
else:
raise KeyError('This Subscriber %s provide no list method with id:%r'
\
raise KeyError('This Subscriber %s provide no list method with id:%r'
% (self.getPath(), list_method_id))
return result_list
...
...
bt5/erp5_syncml/ModuleComponentTemplateItem/portal_components/module.erp5.XMLSyncUtils.py
View file @
debb2043
...
...
@@ -62,8 +62,8 @@ def encode(format, string_to_encode): # pylint: disable=redefined-builtin
#elif format is .... put here the other formats
else
:
#if there is no format corresponding with format, raise an error
LOG
(
'encode : unknown or not implemented format : '
,
INFO
,
format
)
raise
ValueError
(
"Sorry, the server ask for the format %s but
\
it's unknow
or not implemented"
%
format
)
raise
ValueError
(
"Sorry, the server ask for the format %s but
"
" it's unknown
or not implemented"
%
format
)
def
decode
(
format
,
string_to_decode
):
# pylint: disable=redefined-builtin
"""
...
...
@@ -77,8 +77,7 @@ def decode(format, string_to_decode): # pylint: disable=redefined-builtin
#elif format is .... put here the other formats
else
:
#if there is no format corresponding with format, raise an error
LOG
(
'decode : unknown or not implemented format :'
,
INFO
,
format
)
raise
ValueError
(
"Sorry, the format %s is unknow or
\
not implemented"
%
format
)
raise
ValueError
(
"Sorry, the format %s is unknown or not implemented"
%
format
)
def
isDecodeEncodeTheSame
(
string_encoded
,
string_decoded
,
format
):
# pylint: disable=redefined-builtin
"""
...
...
bt5/erp5_tiosafe_core/ExtensionTemplateItem/portal_components/extension.erp5.TioSafeNodeConduit.py
View file @
debb2043
...
...
@@ -102,9 +102,10 @@ class TioSafeNodeConduit(TioSafeBaseConduit):
try
:
previous_value
=
previous_xml
[
0
].
text
except
IndexError
:
raise
IndexError
(
'Too little or too many value, only one is required for %s'
%
(
previous_xml
))
raise
IndexError
(
'Too little or too many value, only one is required for %s'
%
previous_xml
)
# check if it'a work on person or on address
if
tag
in
[
'street'
,
'zip'
,
'city'
,
'country'
]:
...
...
bt5/erp5_tiosafe_core/ExtensionTemplateItem/portal_components/extension.erp5.TioSafeResourceConduit.py
View file @
debb2043
...
...
@@ -164,9 +164,10 @@ class TioSafeResourceConduit(TioSafeBaseConduit):
try
:
previous_value
=
previous_xml
[
0
].
text
except
IndexError
:
raise
ValueError
(
'Too little or too many value, only one is required for %s'
%
(
previous_xml
))
raise
ValueError
(
'Too little or too many value, only one is required for %s'
%
previous_xml
)
# check if it'a work on product or on categories
if
tag
.
split
(
'['
)[
0
]
==
'category'
:
...
...
@@ -268,9 +269,10 @@ class TioSafeResourceConduit(TioSafeBaseConduit):
previous_xml
[
0
].
text
,
)
except
IndexError
:
raise
IndexError
(
'Too little or too many value, only one is required for %s'
%
(
previous_xml
))
raise
IndexError
(
'Too little or too many value, only one is required for %s'
%
previous_xml
)
# retrieve the current value to check if exists a conflict
current_value
=
etree
.
XML
(
document
.
asXML
()).
xpath
(
tag
)[
0
].
text
...
...
bt5/erp5_tiosafe_core/ModuleComponentTemplateItem/portal_components/module.erp5.AccountingERP5IntegrationConduit.py
View file @
debb2043
...
...
@@ -78,7 +78,7 @@ class AccountingERP5IntegrationConduit(TioSafeBaseConduit):
'PP'
,
'SA'
,
'SR'
,
'VP'
,
'VR'
):
return
'Payment Transaction'
else
:
raise
Exception
(
"getObjectType: ERROR journal code unknow"
)
raise
Exception
(
"getObjectType: ERROR journal code unknow
n
"
)
def
constructContent
(
self
,
object
,
object_id
,
portal_type
):
# pylint: disable=redefined-builtin
"""
...
...
bt5/erp5_tiosafe_core/ModuleComponentTemplateItem/portal_components/module.erp5.ERP5NodeConduit.py
View file @
debb2043
...
...
@@ -76,7 +76,7 @@ class ERP5NodeConduit(TioSafeBaseConduit):
if
len
(
stc_list
)
==
0
:
self
.
_createSaleTradeCondition
(
object
,
**
kw
)
elif
len
(
stc_list
)
>
1
:
raise
ValueError
(
"Multiple trade condition (%s) retrieved for %s"
\
raise
ValueError
(
"Multiple trade condition (%s) retrieved for %s"
%
([
x
.
path
for
x
in
stc_list
],
object
.
getTitle
()))
else
:
stc
=
stc_list
[
0
].
getObject
()
...
...
@@ -155,7 +155,8 @@ class ERP5NodeConduit(TioSafeBaseConduit):
if
link_object
is
not
None
:
document
.
setCareerSubordinationValue
(
link_object
)
else
:
raise
ValueError
(
"Impossible to find organisation %s in %s"
%
(
organisation_gid
,
synchronization_list
))
raise
ValueError
(
"Impossible to find organisation %s in %s"
%
(
organisation_gid
,
synchronization_list
))
document
.
reindexObject
()
return
[]
...
...
bt5/erp5_tiosafe_core/ModuleComponentTemplateItem/portal_components/module.erp5.ERP5ResourceConduit.py
View file @
debb2043
...
...
@@ -141,7 +141,7 @@ class ERP5ResourceConduit(TioSafeBaseConduit):
conflict_list
=
self
.
_createMapping
(
sub_object
,
mapping_list
)
if
len
(
conflict_list
):
raise
ValueError
(
"Conflict on creation of resource, should not happen, conflict = %r"
%
(
conflict_list
)
)
raise
ValueError
(
"Conflict on creation of resource, should not happen, conflict = %r"
%
conflict_list
)
self
.
newObject
(
object
=
sub_object
,
...
...
@@ -376,9 +376,10 @@ class ERP5ResourceConduit(TioSafeBaseConduit):
try
:
previous_value
=
previous_xml
[
0
].
text
except
IndexError
:
raise
IndexError
(
'Too little or too many value, only one is required for %s'
%
(
previous_xml
,
))
raise
IndexError
(
'Too little or too many value, only one is required for %s'
%
previous_xml
)
if
isinstance
(
previous_value
,
unicode
):
previous_value
=
previous_value
.
encode
(
'utf-8'
)
...
...
@@ -545,9 +546,10 @@ class ERP5ResourceConduit(TioSafeBaseConduit):
try
:
previous_value
=
previous_xml
[
0
].
text
except
IndexError
:
raise
IndexError
(
'Too little or too many value, only one is required for %s'
%
(
previous_xml
))
raise
IndexError
(
'Too little or too many value, only one is required for %s'
%
previous_xml
)
if
isinstance
(
previous_value
,
unicode
):
previous_value
=
previous_value
.
encode
(
'utf-8'
)
...
...
bt5/erp5_tiosafe_core/ModuleComponentTemplateItem/portal_components/module.erp5.ERP5TransactionConduit.py
View file @
debb2043
...
...
@@ -285,7 +285,7 @@ class ERP5TransactionConduit(TioSafeBaseConduit):
break
# in the worse case save the line with the unknown product
if
link_object
is
None
:
raise
ValueError
(
"Impossible to find related resource for gid %s"
%
(
link_gid
)
)
raise
ValueError
(
"Impossible to find related resource for gid %s"
%
link_gid
)
# set the resource in the dict
movement_dict_value
[
tag
]
=
link_object
...
...
bt5/erp5_tiosafe_core/ModuleComponentTemplateItem/portal_components/module.erp5.TioSafeNodeConduit.py
View file @
debb2043
...
...
@@ -104,9 +104,10 @@ class TioSafeNodeConduit(TioSafeBaseConduit):
try
:
previous_value
=
previous_xml
[
0
].
text
except
IndexError
:
raise
IndexError
(
'Too little or too many value, only one is required for %s'
%
(
previous_xml
))
raise
IndexError
(
'Too little or too many value, only one is required for %s'
%
previous_xml
)
# check if it'a work on person or on address
if
tag
in
[
'street'
,
'zip'
,
'city'
,
'country'
]:
...
...
bt5/erp5_tiosafe_core/ModuleComponentTemplateItem/portal_components/module.erp5.TioSafeResourceConduit.py
View file @
debb2043
...
...
@@ -145,9 +145,10 @@ class TioSafeResourceConduit(TioSafeBaseConduit):
try
:
previous_value
=
previous_xml
[
0
].
text
except
IndexError
:
raise
ValueError
(
'Too little or too many value, only one is required for %s'
%
(
previous_xml
))
raise
ValueError
(
'Too little or too many value, only one is required for %s'
%
previous_xml
)
if
isinstance
(
previous_value
,
unicode
):
previous_value
=
previous_value
.
encode
(
'utf-8'
)
...
...
@@ -206,9 +207,10 @@ class TioSafeResourceConduit(TioSafeBaseConduit):
selected_previous_xml
[
0
].
text
,
)
except
IndexError
:
raise
IndexError
(
'Too little or too many value, only one is required for %s'
%
(
previous_xml
))
raise
IndexError
(
'Too little or too many value, only one is required for %s'
%
previous_xml
)
LOG
(
"TiosafeResourceConduit.del"
,
300
,
"will remove category %s from %s"
%
(
tag
,
previous_xml
.
text
))
# retrieve the current value to check if exists a conflict
current_value
=
etree
.
XML
(
object_xml
).
xpath
(
tag
)[
0
].
text
...
...
bt5/erp5_travel_expense/SkinTemplateItem/portal_skins/erp5_hr_request/ExpenseValidationRequest_createPurchaseTransaction.py
View file @
debb2043
...
...
@@ -56,10 +56,8 @@ except ValidationFailed, error_message:
if
len
(
message
)
>
2000
:
# too long message will generate a too long URI
# that would become an error.
message
=
"%s ..."
%
message
[:(
2000
-
4
)]
raise
Redirect
(
"%s?portal_status_message=%s"
%
(
context
.
getAbsoluteUrl
(),
message
))
context
.
Base_redirect
(
keep_items
=
{
'portal_status_message'
:
message
})
transaction
.
confirm
()
return
transaction
.
getRelativeUrl
()
bt5/erp5_user_tutorial_ui_test/SkinTemplateItem/portal_skins/erp5_user_tutorial_ui_test/Zuite_checkPortalCatalog.py
View file @
debb2043
...
...
@@ -19,7 +19,7 @@ for result in result_list:
raise
RuntimeError
(
"One property is not the same that you wanted : you asked '%s' and expecting '%s' but get '%s'"
%
(
key
,
kw
[
key
],
method
()))
# check that every object are owner by you
if
strict_check_mode
and
object
.
Base_getOwnerId
()
not
in
[
owner_id
,
functional_test_username
,
'System Processes'
,
'zope'
,
functional_another_test_username
]:
raise
RuntimeError
(
"You have try to clean an item who haven't you as owner : %s is owned by %s and you are %s"
%
\
raise
RuntimeError
(
"You have try to clean an item who haven't you as owner : %s is owned by %s and you are %s"
%
(
object
.
getTitle
(),
object
.
Base_getOwnerId
(),
owner_id
))
if
strict_check_mode
and
max_count
is
not
None
:
...
...
product/ERP5/Document/BusinessTemplate.py
View file @
debb2043
...
...
@@ -2094,7 +2094,7 @@ class RegisteredSkinSelectionTemplateItem(BaseTemplateItem):
if
skin_selection_id
in
selection_list
:
self
.
_objects
.
setdefault
(
skin_folder_id
,
[]).
append
(
skin_selection_id
)
else
:
raise
NotFound
(
'No skin selection %s found for skin folder %s.'
\
raise
NotFound
(
'No skin selection %s found for skin folder %s.'
%
(
skin_selection_id
,
skin_folder_id
))
# Function to generate XML Code Manually
...
...
@@ -2575,8 +2575,8 @@ class PortalTypeWorkflowChainTemplateItem(BaseTemplateItem):
'in chain for portal_type %s'
%
(
workflow_name
,
portal_type
))
self
.
_objects
.
setdefault
(
portal_type
,
[]).
append
(
workflow
)
elif
not
self
.
is_bt_for_diff
:
raise
NotFound
(
'No workflow chain found for portal type %s.
This '
\
'is probably a sign of a missing dependency.'
\
raise
NotFound
(
'No workflow chain found for portal type %s.
'
' This is probably a sign of a missing dependency.'
%
portal_type
)
# Function to generate XML Code Manually
...
...
@@ -2692,8 +2692,8 @@ class PortalTypeWorkflowChainTemplateItem(BaseTemplateItem):
# improve the error message
for
wf_id
in
self
.
_objects
[
path
]:
if
wf_id
.
startswith
(
'-'
):
raise
ValueError
(
'"%s" is not a workflow ID for %s'
%
\
(
wf_id
,
portal_type
))
raise
ValueError
(
'"%s" is not a workflow ID for %s'
%
(
wf_id
,
portal_type
))
chain_dict
[
chain_key
]
=
self
.
_objects
[
path
]
else
:
if
context
.
portal_types
.
getTypeInfo
(
portal_type
)
is
None
:
...
...
@@ -2913,8 +2913,8 @@ class PortalTypeAllowedContentTypeTemplateItem(BaseTemplateItem):
if
type_information
is
None
:
if
not
property_list
:
continue
raise
AttributeError
(
"Portal type '%s' not found while
"
\
"installing %s"
%
(
portal_id
,
self
.
getTitle
()))
raise
AttributeError
(
"Portal type '%s' not found while
installing %s"
%
(
portal_id
,
self
.
getTitle
()))
old_property_list
=
old_objects
.
get
(
key
,
())
object_property_list
=
getattr
(
type_information
,
self
.
class_property
,
())
# merge differences between portal types properties
...
...
@@ -6046,8 +6046,9 @@ Business Template is a set of definitions, such as skins, portal types and categ
"""
missing_dep_list
=
self
.
getMissingDependencyList
()
if
len
(
missing_dep_list
)
!=
0
:
raise
BusinessTemplateMissingDependency
(
'Impossible to install %s, please install the following dependencies before: %s'
\
%
(
self
.
getTitle
(),
repr
(
missing_dep_list
)))
raise
BusinessTemplateMissingDependency
(
'Impossible to install %s, please install the following dependencies before: %r'
%
(
self
.
getTitle
(),
missing_dep_list
))
security
.
declareProtected
(
Permissions
.
ManagePortal
,
'getMissingDependencyList'
)
def
getMissingDependencyList
(
self
):
...
...
product/ERP5/Document/SQLNonContinuousIncreasingIdGenerator.py
View file @
debb2043
...
...
@@ -69,7 +69,7 @@ class SQLNonContinuousIncreasingIdGenerator(IdGenerator):
"""
# Check the arguments
if
id_group
in
(
None
,
'None'
):
raise
ValueError
(
'%
s is not a valid group Id.'
%
(
repr
(
id_group
),
)
)
raise
ValueError
(
'%
r is not a valid group Id.'
%
id_group
)
if
default
is
None
:
default
=
0
...
...
product/ERP5/Document/ZODBContinuousIncreasingIdGenerator.py
View file @
debb2043
...
...
@@ -55,7 +55,7 @@ class ZODBContinuousIncreasingIdGenerator(IdGenerator):
persistent.
"""
if
id_group
in
(
None
,
'None'
):
raise
ValueError
(
'%
s is not a valid group Id.'
%
(
repr
(
id_group
),
)
)
raise
ValueError
(
'%
r is not a valid group Id.'
%
id_group
)
if
default
is
None
:
default
=
0
last_id_dict
=
getattr
(
self
,
'last_id_dict'
,
None
)
...
...
product/ERP5/ERP5Site.py
View file @
debb2043
...
...
@@ -500,8 +500,8 @@ class ERP5Site(ResponseHeaderGenerator, FolderMixIn, PortalObjectBase, CacheCook
pass
else
:
if
portal_activities
.
countMessage
(
path
=
ob
.
getPath
())
>
0
:
raise
ActivityPendingError
(
'Sorry, pending activities prevent '
\
+
'
changing id at this current stage'
)
raise
ActivityPendingError
(
'Sorry, pending activities prevent
changing id at this current stage'
)
# Search for categories that have to be updated in sub objects.
ob
.
_recursiveSetActivityAfterTag
(
ob
)
...
...
product/ERP5/Tool/IdTool.py
View file @
debb2043
...
...
@@ -114,7 +114,7 @@ class IdTool(BaseTool):
Generate the next id in the sequence of ids of a particular group
"""
if
id_group
in
(
None
,
'None'
):
raise
ValueError
(
'%
s is not a valid id_group'
%
(
repr
(
id_group
),
)
)
raise
ValueError
(
'%
r is not a valid id_group'
%
id_group
)
# for compatibilty with sql data, must not use id_group as a list
if
not
isinstance
(
id_group
,
str
):
id_group
=
repr
(
id_group
)
...
...
@@ -174,7 +174,7 @@ class IdTool(BaseTool):
Generate a list of next ids in the sequence of ids of a particular group
"""
if
id_group
in
(
None
,
'None'
):
raise
ValueError
(
'%
s is not a valid id_group'
%
(
repr
(
id_group
),
)
)
raise
ValueError
(
'%
r is not a valid id_group'
%
id_group
)
# for compatibilty with sql data, must not use id_group as a list
if
not
isinstance
(
id_group
,
str
):
id_group
=
repr
(
id_group
)
...
...
@@ -208,17 +208,13 @@ class IdTool(BaseTool):
# XXX It's temporary, a New API will be implemented soon
# the code will be change
portal
=
self
.
getPortalObject
()
query
=
getattr
(
portal
,
'IdTool_zGenerateId'
,
None
)
commit
=
getattr
(
portal
,
'IdTool_zCommit'
,
None
)
if
query
is
None
or
commit
is
None
:
portal_catalog
=
getattr
(
self
,
'portal_catalog'
).
getSQLCatalog
()
query
=
getattr
(
portal_catalog
,
'z_portal_ids_generate_id'
)
commit
=
getattr
(
portal_catalog
,
'z_portal_ids_commit'
)
if
None
in
(
query
,
commit
):
raise
AttributeError
(
'Error while generating Id: '
\
'idTool_zGenerateId and/or idTool_zCommit could not '
\
'be found.'
)
try
:
query
=
portal
.
IdTool_zGenerateId
commit
=
portal
.
IdTool_zCommit
except
AttributeError
:
portal_catalog
=
portal
.
portal_catalog
.
getSQLCatalog
()
query
=
portal_catalog
.
z_portal_ids_generate_id
commit
=
portal_catalog
.
z_portal_ids_commit
try
:
result
=
query
(
id_group
=
id_group
,
id_count
=
id_count
,
default
=
default
)
finally
:
...
...
@@ -304,14 +300,10 @@ class IdTool(BaseTool):
# XXX It's temporary, a New API will be implemented soon
# the code will be change
portal
=
self
.
getPortalObject
()
query
=
getattr
(
portal
,
'IdTool_zGetLastId'
,
None
)
if
query
is
None
:
portal_catalog
=
getattr
(
self
,
'portal_catalog'
).
getSQLCatalog
()
query
=
getattr
(
portal_catalog
,
'z_portal_ids_get_last_id'
)
if
query
is
None
:
raise
AttributeError
(
'Error while getting last Id: '
\
'IdTool_zGetLastId could not '
\
'be found.'
)
try
:
query
=
portal
.
IdTool_zGetLastId
except
AttributeError
:
query
=
portal
.
portal_catalog
.
getSQLCatalog
().
z_portal_ids_get_last_id
result
=
query
(
id_group
=
id_group
)
if
len
(
result
):
try
:
...
...
product/ERP5/Tool/TemplateTool.py
View file @
debb2043
...
...
@@ -944,7 +944,7 @@ class TemplateTool (BaseTool):
undependent_list.append(dependency_id)
if len(sorted_bt_list) != len(bt_list):
raise NotImplementedError("Circular dependencies on %s" %
reverse_dependency_dict.keys(
))
raise NotImplementedError("Circular dependencies on %s" %
list(reverse_dependency_dict
))
else:
return sorted_bt_list
...
...
@@ -1192,7 +1192,7 @@ class TemplateTool (BaseTool):
candidate.uid))
break
else:
raise BusinessTemplateMissingDependency("Unable to resolve dependencies for %s, options are %s"
\
raise BusinessTemplateMissingDependency("Unable to resolve dependencies for %s, options are %s"
% (dep_id, provider_list))
if len(template_title_list) > 0:
...
...
@@ -1224,7 +1224,7 @@ class TemplateTool (BaseTool):
if not checkAvailability(i[1].replace(".bt5", ""))]
if not install_dependency and len(missing_dependency_list) > 0:
raise BusinessTemplateMissingDependency("Impossible to install, please install the following dependencies before: %s"
\
raise BusinessTemplateMissingDependency("Impossible to install, please install the following dependencies before: %s"
% [x[1] for x in missing_dependency_list])
activate_kw = dict(activity="SQLQueue", tag="start_%s" % (time.time()))
...
...
product/ERP5/bootstrap/erp5_core/DocumentTemplateItem/portal_components/document.erp5.Amount.py
View file @
debb2043
...
...
@@ -303,13 +303,12 @@ class Amount(Base, VariatedMixin):
variation_list
=
[]
for
property_id
,
property_value
in
property_dict
.
items
():
if
property_id
not
in
variation_list
:
raise
KeyError
(
"Can not set the property variation '%s'"
%
\
property_id
)
raise
KeyError
(
"Can not set the property variation %r"
%
property_id
)
else
:
try
:
self
.
setProperty
(
property_id
,
property_value
)
except
KeyError
:
LOG
(
"Amount"
,
ERROR
,
"Can not set %s with value %s on %s"
%
\
LOG
(
"Amount"
,
ERROR
,
"Can not set %s with value %s on %s"
%
(
property_id
,
property_value
,
self
.
getRelativeUrl
()))
raise
...
...
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_getOwnerId.py
View file @
debb2043
...
...
@@ -3,4 +3,4 @@ local_role_list = context.get_local_roles()
for
group
,
role_list
in
local_role_list
:
if
'Owner'
in
role_list
:
return
group
raise
ValueError
(
'Context (%
s) has no owner (see local roles).'
%
(
repr
(
context
),
)
)
raise
ValueError
(
'Context (%
r) has no owner (see local roles).'
%
context
)
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/BusinessTemplate_getModifiableFieldList.py
View file @
debb2043
...
...
@@ -120,8 +120,8 @@ for skin_folder_id in skin_id_list:
# As the form will be deleted, no need to manage its fields
pass
else
:
raise
KeyError
(
'Unexpected form handling %s for %s'
%
\
(
modified_object_dict
[
form_path
],
form_path
))
raise
KeyError
(
'Unexpected form handling %s for %s'
%
(
modified_object_dict
[
form_path
],
form_path
))
elif
form_id
not
in
(
field_library_id
,
alternate_field_library_id
,
'Base_viewFieldLibrary'
,):
# Check that proxy field are proxified to field library
...
...
product/ERP5/bootstrap/erp5_core/ToolComponentTemplateItem/portal_components/tool.erp5.IntrospectionTool.py
View file @
debb2043
...
...
@@ -186,8 +186,6 @@ class IntrospectionTool(LogMixin, BaseTool):
raise
IOError
(
'The file path must be relative not absolute'
)
instance_home
=
getConfiguration
().
instancehome
file_path
=
os
.
path
.
join
(
instance_home
,
file_path
)
if
not
os
.
path
.
exists
(
file_path
):
raise
IOError
(
'The file: %s does not exist.'
%
file_path
)
if
compressed
:
tmp_file_path
=
tempfile
.
mktemp
(
dir
=
tmp_file_path
)
...
...
@@ -235,9 +233,6 @@ class IntrospectionTool(LogMixin, BaseTool):
Do a 'tail -f -n line_number filename'
"""
log_file
=
os
.
path
.
join
(
getConfiguration
().
instancehome
,
file_name
)
if
not
os
.
path
.
exists
(
log_file
):
raise
IOError
(
'The file: %s does not exist.'
%
log_file
)
char_per_line
=
75
with
open
(
log_file
,
'r'
)
as
tailed_file
:
...
...
product/ERP5/bootstrap/erp5_core/ToolComponentTemplateItem/portal_components/tool.erp5.SimulationTool.py
View file @
debb2043
...
...
@@ -196,7 +196,7 @@ class SimulationTool(BaseTool):
if
not
as_text
:
prop_value
=
category_tool
.
getCategoryValue
(
prop
)
if
prop_value
is
None
:
raise
ValueError
(
'Category %s does not exist
s
'
%
prop
)
raise
ValueError
(
'Category %s does not exist'
%
prop
)
property_uid_list
.
append
(
prop_value
.
getUid
())
else
:
property_uid_list
.
append
(
prop
)
...
...
@@ -205,7 +205,7 @@ class SimulationTool(BaseTool):
if
not
as_text
:
prop_value
=
category_tool
.
getCategoryValue
(
property_item
)
if
prop_value
is
None
:
raise
ValueError
(
'Category %s does not exist
s
'
%
property_item
)
raise
ValueError
(
'Category %s does not exist'
%
property_item
)
property_uid_list
.
append
(
prop_value
.
getUid
())
else
:
property_uid_list
.
append
(
property_item
)
...
...
@@ -217,7 +217,7 @@ class SimulationTool(BaseTool):
if
not
as_text
:
prop_value
=
category_tool
.
getCategoryValue
(
property_item
)
if
prop_value
is
None
:
raise
ValueError
(
'Category %s does not exist
s
'
%
property_item
)
raise
ValueError
(
'Category %s does not exist'
%
property_item
)
tmp_uid_list
.
append
(
prop_value
.
getUid
())
else
:
tmp_uid_list
.
append
(
property_item
)
...
...
@@ -1140,14 +1140,12 @@ class SimulationTool(BaseTool):
return
result
total_result
=
0.0
if
len
(
result
)
>
0
:
if
len
(
result
)
!=
1
:
raise
ValueError
(
'Sorry we must have only one'
)
result
=
result
[
0
]
if
result
:
result
,
=
result
if
hasattr
(
result
,
"converted_quantity"
)
:
try
:
total_result
=
result
.
converted_quantity
e
lse
:
e
xcept
AttributeError
:
inventory
=
result
.
total_quantity
if
inventory
is
not
None
:
total_result
=
inventory
...
...
product/ERP5/tests/testInventoryAPI.py
View file @
debb2043
...
...
@@ -2994,11 +2994,11 @@ class TestInventoryCacheTable(InventoryAPITestCase):
# Leads to rasing exception instead of calling self.assert[...] method.
if
not
success
:
if
ordered_check
:
raise
AssertionError
(
'Line %r
\
n
do not match
\
n
%r'
%
\
raise
AssertionError
(
'Line %r
\
n
do not match
\
n
%r'
%
(
inventory_list
[
inventory_position
],
criterion_dict
))
else
:
raise
AssertionError
(
'No line in %r
\
n
match
\
n
%r'
%
\
raise
AssertionError
(
'No line in %r
\
n
match
\
n
%r'
%
(
inventory_list
,
criterion_dict
))
# Check all expected lines have been found.
self
.
assertFalse
(
inventory_list
)
...
...
product/ERP5/tests/testXHTML.py
View file @
debb2043
...
...
@@ -244,7 +244,8 @@ class TestXHTMLMixin(ERP5TypeTestCase):
stdout
,
stderr
=
Popen
(
args
,
stdin
=
PIPE
,
stdout
=
PIPE
,
stderr
=
PIPE
,
close_fds
=
True
).
communicate
(
body
)
except
OSError
,
e
:
raise
OSError
(
'%r
\
n
%r'
%
(
os
.
environ
,
e
))
e
.
strerror
+=
'
\
n
%r'
%
os
.
environ
raise
if
stdout
:
error_list
.
append
((
check_path
,
stdout
))
if
error_list
:
...
...
product/ERP5Form/Form.py
View file @
debb2043
...
...
@@ -1402,9 +1402,10 @@ def get_field_meta_type_and_proxy_flag(field):
try
:
return
field
.
getRecursiveTemplateField
().
meta_type
,
True
except
AttributeError
:
raise
AttributeError
(
'The proxy target of %s.%s field does not '
\
'exists. Please check the field setting.'
%
\
(
field
.
aq_parent
.
id
,
field
.
getId
()))
raise
AttributeError
(
'The proxy target of %s.%s field does not exist.'
' Please check the field settings.'
%
(
field
.
aq_parent
.
id
,
field
.
getId
()))
else
:
return
field
.
meta_type
,
False
...
...
product/ERP5Form/PDFParser.py
View file @
debb2043
...
...
@@ -80,8 +80,8 @@ class PDFParser:
command_output
=
commands
.
getstatusoutput
(
'pdfinfo %s'
%
\
temp_pdf_name
)
if
command_output
[
0
]
!=
0
:
raise
ValueError
(
'Error: convert command failed with the following'
\
'error message :
\
n
%s'
%
command_output
[
1
])
raise
ValueError
(
'Error: convert command failed with the following'
' error message:
\
n
%s'
%
command_output
[
1
])
# get the pdf page size
rawstr
=
r'''
...
...
@@ -176,7 +176,7 @@ class PDFParser:
command_output
=
commands
.
getstatusoutput
(
'pdftk %s output %s flatten'
\
%
(
temp_input_name
,
temp_output_name
))
if
command_output
[
0
]
!=
0
:
raise
IOError
(
"pdftk failed with the following error %s"
\
raise
IOError
(
"pdftk failed with the following error %s"
%
command_output
[
1
])
temp_output
=
open
(
temp_output_name
,
'rb'
)
temp_output
.
seek
(
0
)
...
...
product/ERP5Form/Tool/SelectionTool.py
View file @
debb2043
...
...
@@ -1258,8 +1258,8 @@ class SelectionTool( BaseTool, SimpleItem ):
relation_index
+=
1
if
not
relation_field_found
:
# We didn't find the field...
raise
SelectionError
(
"SelectionTool: can not find the relation
"
\
" field %s"
%
index
)
raise
SelectionError
(
"SelectionTool: can not find the relation
field %s"
%
index
)
else
:
# Field found
field_key
=
field
.
generate_field_key
()
...
...
product/ERP5OOo/tests/testOOoStyleWithFlare.py
View file @
debb2043
...
...
@@ -28,7 +28,7 @@
from
__future__
import
absolute_import
import
unittest
from
Products.ERP5OOo.tests
.testOOoStyle
import
TestOOoStyle
from
.testOOoStyle
import
TestOOoStyle
class
TestOOoStyleWithFlare
(
TestOOoStyle
):
"""Tests ODF styles for ERP5 with Flare."""
...
...
product/ERP5Security/ERP5KeyAuthPlugin.py
View file @
debb2043
...
...
@@ -95,17 +95,16 @@ class CesarCipher:
crypted_letter
=
str
(
ord
(
login
[
i
])
+
self
.
encrypted_key
[
delta
])
#ord is the inverse of chr() for 8-bit (1111 1111 = 256)
#so crypted_letter max id 512
#we ajust leng
ht
to be able to decrypt by block
#we ajust leng
th
to be able to decrypt by block
crypted_letter
=
crypted_letter
.
rjust
(
self
.
block_length
,
'0'
)
crypted_login
+=
crypted_letter
return
crypted_login
def
decrypt
(
self
,
crypted_login
):
login
=
''
#check lenght of the string
clogin_length
=
len
(
crypted_login
)
if
clogin_length
%
self
.
block_length
!=
0
:
raise
ValueError
(
"
Lenght is not good
"
)
raise
ValueError
(
"
Invalid length
"
)
#decrypt block per block
position
=
0
key_length
=
len
(
self
.
encrypted_key
)
...
...
product/ERP5Security/__init__.py
View file @
debb2043
...
...
@@ -73,17 +73,19 @@ def _setUserNameForAccessLog(username, REQUEST):
def
initialize
(
context
):
from
.
import
ERP5UserManager
from
.
import
ERP5LoginUserManager
from
.
import
ERP5GroupManager
from
.
import
ERP5RoleManager
from
.
import
ERP5UserFactory
from
.
import
ERP5KeyAuthPlugin
from
.
import
ERP5ExternalAuthenticationPlugin
from
.
import
ERP5BearerExtractionPlugin
from
.
import
ERP5ExternalOauth2ExtractionPlugin
from
.
import
ERP5AccessTokenExtractionPlugin
from
.
import
ERP5DumbHTTPExtractionPlugin
from
.
import
(
ERP5UserManager
,
ERP5LoginUserManager
,
ERP5GroupManager
,
ERP5RoleManager
,
ERP5UserFactory
,
ERP5KeyAuthPlugin
,
ERP5ExternalAuthenticationPlugin
,
ERP5BearerExtractionPlugin
,
ERP5ExternalOauth2ExtractionPlugin
,
ERP5AccessTokenExtractionPlugin
,
ERP5DumbHTTPExtractionPlugin
,
)
registerMultiPlugin
(
ERP5UserManager
.
ERP5UserManager
.
meta_type
)
registerMultiPlugin
(
ERP5LoginUserManager
.
ERP5LoginUserManager
.
meta_type
)
...
...
product/ERP5Type/Cache.py
View file @
debb2043
...
...
@@ -243,8 +243,8 @@ class CachingMethod:
cache_factory is the id of the cache_factory to use.
"""
if
not
callable
(
callable_object
):
raise
CachedMethodError
(
"callable_object %
s is not callable"
%
str
(
callable_object
))
raise
CachedMethodError
(
"callable_object %
r is not callable"
%
(
callable_object
,
))
if
not
id
:
raise
CachedMethodError
(
"id must be specified"
)
self
.
id
=
id
...
...
product/ERP5Type/CopySupport.py
View file @
debb2043
...
...
@@ -163,8 +163,8 @@ class CopyContainer:
pass
# There is no activity tool
else
:
if
portal_activities
.
countMessage
(
path
=
ob
.
getPath
())
>
0
:
raise
ActivityPendingError
(
'Sorry, pending activities prevent '
\
+
'
changing id at this current stage'
)
raise
ActivityPendingError
(
'Sorry, pending activities prevent
changing id at this current stage'
)
# Search for categories that have to be updated in sub objects.
self
.
_recursiveSetActivityAfterTag
(
ob
)
...
...
product/ERP5Type/Tool/MemcachedTool.py
View file @
debb2043
...
...
@@ -247,7 +247,7 @@ if memcache is not None:
def
_prefixKey
(
self
,
key
):
if
not
isinstance
(
key
,
basestring
):
raise
TypeError
(
'Key %
s is not a string. Only strings are supported as key in SharedDict'
%
(
repr
(
key
),
))
raise
TypeError
(
'Key %
r is not a string. Only strings are supported as key in SharedDict'
%
(
key
,
))
return
'%s_%s'
%
(
self
.
prefix
,
key
)
def
__getitem__
(
self
,
key
):
...
...
@@ -318,7 +318,7 @@ else:
if this function is called and memcachedtool is disabled, fail loudly
with a meaningfull message.
"""
raise
RuntimeError
(
'MemcachedTool is disabled. You should ask the'
\
raise
RuntimeError
(
'MemcachedTool is disabled. You should ask the'
' server administrator to enable it by installing python-memcached.'
)
memcached_tool_configure
=
failingMethod
...
...
product/ERP5Type/Utils.py
View file @
debb2043
...
...
@@ -254,7 +254,7 @@ def convertToUpperCase(key):
return
_cached_convertToUpperCase
[
key
]
except
KeyError
:
if
not
isinstance
(
key
,
basestring
):
raise
TypeError
(
'%
s
is not a string'
%
(
key
,))
raise
TypeError
(
'%
r
is not a string'
%
(
key
,))
_cached_convertToUpperCase
[
key
]
=
''
.
join
([
part
.
capitalize
()
for
part
in
key
.
split
(
'_'
)])
return
_cached_convertToUpperCase
[
key
]
...
...
@@ -279,7 +279,7 @@ def convertToMixedCase(key):
a method name according to the ERP5 naming conventions
"""
if
not
isinstance
(
key
,
basestring
):
raise
TypeError
(
'%
s
is not a string'
%
(
key
,))
raise
TypeError
(
'%
r
is not a string'
%
(
key
,))
parts
=
str
(
key
).
split
(
'_'
,
1
)
if
len
(
parts
)
==
2
:
parts
[
1
]
=
convertToUpperCase
(
parts
[
1
])
...
...
product/ERP5Type/mixin/matrix.py
View file @
debb2043
...
...
@@ -199,8 +199,8 @@ class Matrix(object):
"""
script
=
self
.
_getTypeBasedMethod
(
'asCellRange'
,
**
kw
)
if
script
is
None
:
raise
UnboundLocalError
(
"Did not find cell range script for portal type: %r"
%
\
self
.
getPortalType
())
raise
LookupError
(
"Did not find cell range script for portal type: %r"
%
self
.
getPortalType
())
cell_range
=
script
(
base_id
=
base_id
,
matrixbox
=
0
,
**
kw
)
self
.
_setCellRange
(
base_id
=
base_id
,
*
cell_range
)
...
...
@@ -334,7 +334,7 @@ class Matrix(object):
cell_id
=
self
.
keyToId
(
kw
,
base_id
=
base_id
)
if
cell_id
is
None
:
raise
KeyError
(
'Invalid key:
%s'
%
str
(
kw
))
raise
KeyError
(
'Invalid key:
'
+
str
(
kw
))
cell
=
self
.
get
(
cell_id
)
if
cell
is
not
None
:
...
...
product/ERP5Type/patches/DateTimePatch.py
View file @
debb2043
...
...
@@ -129,16 +129,16 @@ def DateTime_parse(self, st, datefmt=getDefaultDateFormat()):
# Check for month name:
if
MonthNumbers
.
has_key
(
s
):
v
=
MonthNumbers
[
s
]
if
month
is
None
:
month
=
v
else
:
raise
SyntaxError
(
st
)
if
month
is
None
:
month
=
v
continue
# Check for time modifier:
if
s
in
TimeModifiers
:
if
tm
is
None
:
tm
=
s
else
:
raise
SyntaxError
(
st
)
el
if
s
in
TimeModifiers
:
if
tm
is
None
:
tm
=
s
continue
# Check for and skip day of week:
if
DayOfWeekNames
.
has_key
(
s
):
el
if
DayOfWeekNames
.
has_key
(
s
):
continue
raise
SyntaxError
(
st
)
...
...
product/ERP5Type/patches/sqltest.py
View file @
debb2043
...
...
@@ -83,9 +83,8 @@ if 1: # For easy diff with original
if
args
.
has_key
(
'optional'
)
and
args
[
'optional'
]:
return
''
else
:
err
=
'Invalid empty string value for <em>%s</em>'
%
name
raise
ValueError
(
err
)
raise
ValueError
(
'Invalid empty string value for <em>%s</em>'
%
name
)
if
not
vs
:
if
self
.
optional
:
return
''
...
...
product/Formulator/Validator.py
View file @
debb2043
...
...
@@ -98,9 +98,9 @@ class StringBaseValidator(Validator):
value
=
REQUEST
.
get
(
key
,
REQUEST
.
get
(
'default_%s'
%
(
key
,
)))
if
value
is
None
:
if
field
.
get_value
(
'required'
):
raise
Exception
(
'Required field %
s has not been transmitted. Check that all required fields are in visible groups.'
%
(
repr
(
field
.
id
),
)
)
raise
Exception
(
'Required field %
r has not been transmitted. Check that all required fields are in visible groups.'
%
field
.
id
)
else
:
raise
KeyError
(
'Field %
s is not present in request object.'
%
(
repr
(
field
.
id
),
)
)
raise
KeyError
(
'Field %
r is not present in request object.'
%
field
.
id
)
if
isinstance
(
value
,
str
):
if
field
.
has_value
(
'whitespace_preserve'
):
if
not
field
.
get_value
(
'whitespace_preserve'
):
...
...
@@ -538,7 +538,7 @@ class MultiSelectionValidator(Validator):
def
validate
(
self
,
field
,
key
,
REQUEST
):
if
REQUEST
.
get
(
'default_%s'
%
(
key
,
))
is
None
:
raise
KeyError
(
'Field %
s is not present in request object (marker field default_%s not found).'
%
(
repr
(
field
.
id
)
,
key
))
raise
KeyError
(
'Field %
r is not present in request object (marker field default_%s not found).'
%
(
field
.
id
,
key
))
values
=
REQUEST
.
get
(
key
,
[])
# NOTE: a hack to deal with single item selections
if
not
isinstance
(
values
,
list
):
...
...
product/Formulator/XMLToForm.py
View file @
debb2043
# -*- coding: utf-8 -*-
from
__future__
import
absolute_import
# -*- coding: utf-8 -*-
from
.
import
XMLObjects
from
Products.Formulator.TALESField
import
TALESMethod
from
Products.Formulator.MethodField
import
Method
...
...
product/HBTreeFolder2/HBTreeFolder2.py
View file @
debb2043
...
...
@@ -449,8 +449,8 @@ class HBTreeFolder2Base (Persistent):
def
_checkId
(
self
,
id
,
allow_dup
=
0
):
if
not
allow_dup
and
self
.
has_key
(
id
):
raise
BadRequestException
(
'The id "%s" is invalid--'
'
it is already in use.'
%
id
)
raise
BadRequestException
(
'The id %r is invalid--
it is already in use.'
%
id
)
def
_setObject
(
self
,
id
,
object
,
roles
=
None
,
user
=
None
,
set_owner
=
1
):
...
...
product/Localizer/__init__.py
View file @
debb2043
...
...
@@ -42,10 +42,10 @@ def initialize(context):
# (this is a common mistake).
filename
=
os
.
path
.
split
(
os
.
path
.
split
(
__file__
)[
0
])[
1
]
if
filename
!=
'Localizer'
:
message
=
(
raise
RuntimeError
(
"The Localizer product must be installed within the 'Products'"
" folder with the name 'Localizer' (not '%s')."
)
%
filename
raise
RuntimeError
(
message
)
)
# XXX This code has been written by Cornel Nitu, it may be a solution to
# upgrade instances.
...
...
product/PortalTransforms/libtransforms/commandtransform.py
View file @
debb2043
...
...
@@ -161,7 +161,7 @@ class subprocesstransform:
stderr
=
PIPE
,
close_fds
=
True
)
data_out
,
data_err
=
process
.
communicate
(
input
=
data
)
if
process
.
returncode
:
raise
OSError
(
data_err
)
raise
OSError
(
data_err
)
# XXX
cache
.
setData
(
data_out
)
return
cache
...
...
product/ZLDAPMethods/LM.py
View file @
debb2043
...
...
@@ -60,7 +60,7 @@ class ERP5LDIFRecordList(LDIFRecordList):
if
dn
!=
None
:
raise
ValueError
(
'Two lines starting with dn: in one record.'
)
if
not
is_dn
(
attr_value
):
raise
ValueError
(
'No valid string-representation of distinguished name %
s.'
%
(
repr
(
attr_value
)
))
raise
ValueError
(
'No valid string-representation of distinguished name %
r.'
%
(
attr_value
,
))
dn
=
attr_value
elif
attr_type
==
'version'
and
dn
is
None
:
version
=
1
...
...
@@ -71,7 +71,7 @@ class ERP5LDIFRecordList(LDIFRecordList):
if
changetype
!=
None
:
raise
ValueError
(
'Two lines starting with changetype: in one record.'
)
if
not
valid_changetype_dict
.
has_key
(
attr_value
):
raise
ValueError
(
'changetype value %
s is invalid.'
%
(
repr
(
attr_value
)
))
raise
ValueError
(
'changetype value %
r is invalid.'
%
(
attr_value
,
))
changetype
=
attr_value
attr_type
,
attr_value
=
self
.
_parseAttrTypeandValue
()
modify_list
=
[]
...
...
product/ZMySQLDA/db.py
View file @
debb2043
...
...
@@ -97,8 +97,8 @@ MySQLdb_version_required = (0,9,2)
_v
=
getattr
(
_mysql
,
'version_info'
,
(
0
,
0
,
0
))
if
_v
<
MySQLdb_version_required
:
raise
NotSupportedError
(
"ZMySQLDA requires at least MySQLdb %s, %s found"
%
\
(
MySQLdb_version_required
,
_v
))
raise
NotSupportedError
(
"ZMySQLDA requires at least MySQLdb %s, %s found"
%
(
MySQLdb_version_required
,
_v
))
from
MySQLdb.converters
import
conversions
from
MySQLdb.constants
import
FIELD_TYPE
,
CR
,
ER
,
CLIENT
...
...
product/ZSQLCatalog/ColumnMap.py
View file @
debb2043
...
...
@@ -195,7 +195,9 @@ class ColumnMap(object):
if
alias
is
not
None
:
self
.
resolveTable
(
table_name
,
alias
,
group
=
group
)
elif
alias
is
not
None
and
alias
!=
existing_value
:
raise
ValueError
(
'Table %r for group %r is aliased as %r, can
\
'
t alias it now as %r'
%
(
table_name
,
group
,
existing_value
,
alias
))
raise
ValueError
(
"Table %r for group %r is aliased as %r, can't alias it now as %r"
%
(
table_name
,
group
,
existing_value
,
alias
))
def
_mapColumns
(
self
,
column_table_map
,
table_usage_dict
,
column_name_set
,
group
,
vote_result_dict
):
mapping_dict
=
{}
...
...
product/ZSQLCatalog/Extensions/zsqlbrain.py
View file @
debb2043
...
...
@@ -52,8 +52,8 @@ class ZSQLBrain(Acquisition.Implicit):
def
getObject
(
self
,
REQUEST
=
None
):
"""Try to return the object for this record"""
if
'path'
not
in
dir
(
self
)
and
'PATH'
not
in
dir
(
self
):
raise
ValueError
(
"Unable to getObject from ZSQLBrain if ZSQL Method
"
\
"does not retrieves
the `path` column from catalog table."
)
raise
ValueError
(
"Unable to getObject from ZSQLBrain if ZSQL Method
does"
" not retrieve
the `path` column from catalog table."
)
obj
=
self
.
aq_parent
.
unrestrictedTraverse
(
self
.
getPath
())
if
obj
is
None
:
if
REQUEST
is
None
:
...
...
product/ZSQLCatalog/Operator/OperatorBase.py
View file @
debb2043
...
...
@@ -151,8 +151,8 @@ class OperatorBase(object):
valueDefaultSearchTextRenderer
)(
value
)
def
asSQLExpression
(
self
,
column
,
value_list
,
only_group_columns
):
raise
NotImplementedError
(
'This method must be overloaded by a subclass
'
\
'to be able to get an SQL representation of this operator.'
)
raise
NotImplementedError
(
'This method must be overloaded by a subclass
'
'
to be able to get an SQL representation of this operator.'
)
def
__repr__
(
self
):
return
'<%s(%r) at %s>'
%
(
self
.
__class__
.
__name__
,
self
.
getOperator
(),
id
(
self
))
...
...
product/ZSQLCatalog/Query/AutoQuery.py
View file @
debb2043
...
...
@@ -60,7 +60,7 @@ class AutoQuery(Query):
self
.
operator
=
operator
self
.
ignore_empty_string
=
kw
.
pop
(
'ignore_empty_string'
,
True
)
if
'key'
in
kw
and
len
(
kw
)
>
2
:
raise
ValueError
(
'"key" parameter cannot be used when more than one column is given. key=%
r'
%
(
kw
[
'key'
],
)
)
raise
ValueError
(
'"key" parameter cannot be used when more than one column is given. key=%
(key)r'
%
kw
)
self
.
search_key
=
kw
.
pop
(
'key'
,
None
)
def
_createWrappedQuery
(
self
,
sql_catalog
):
...
...
@@ -107,7 +107,7 @@ class AutoQuery(Query):
if
self
.
table_alias_list
is
not
None
:
query
.
setTableAliasList
(
self
.
table_alias_list
)
if
query
is
None
:
raise
ValueError
(
'%r failed generating a query from its parameters.'
%
(
self
,
)
)
raise
ValueError
(
'%r failed generating a query from its parameters.'
%
self
)
self
.
wrapped_query
=
query
def
_asSearchTextExpression
(
self
,
sql_catalog
,
column
=
None
):
...
...
product/ZSQLCatalog/Query/Query.py
View file @
debb2043
...
...
@@ -45,13 +45,13 @@ class Query(object):
"""
To enable SQL rendering, overload this method in a subclass.
"""
raise
TypeError
(
'A %s cannot be rendered as an SQL expression.'
%
(
self
.
__class__
.
__name__
,
)
)
raise
TypeError
(
'A %s cannot be rendered as an SQL expression.'
%
self
.
__class__
.
__name__
)
def
_asSearchTextExpression
(
self
,
sql_catalog
,
column
=
None
):
"""
To enable Search Text rendering, overload this method in a subclass.
"""
raise
TypeError
(
'A %s cannot be rendered as a SearchText expression.'
%
(
self
.
__class__
.
__name__
,
)
)
raise
TypeError
(
'A %s cannot be rendered as a SearchText expression.'
%
self
.
__class__
.
__name__
)
def
asSearchTextExpression
(
self
,
sql_catalog
,
column
=
None
):
return
self
.
_asSearchTextExpression
(
sql_catalog
,
column
=
column
)[
1
]
...
...
@@ -60,7 +60,7 @@ class Query(object):
"""
This method must always be overloaded by subclasses.
"""
raise
NotImplementedError
(
'%s is incompletely implemented.'
%
(
self
.
__class__
.
__name__
,
)
)
raise
NotImplementedError
(
'%s is incompletely implemented.'
%
self
.
__class__
.
__name__
)
verifyClass
(
IQuery
,
Query
)
product/ZSQLCatalog/Query/SimpleQuery.py
View file @
debb2043
...
...
@@ -67,7 +67,7 @@ class SimpleQuery(Query):
"""
self
.
search_key
=
search_key
if
len
(
kw
)
!=
1
:
raise
ValueError
(
'SimpleQuery can support one and one only column. Got %r.'
%
(
kw
,
)
)
raise
ValueError
(
'SimpleQuery can support one and one only column. Got %r.'
%
kw
)
self
.
column
,
value
=
kw
.
popitem
()
# Usability improvement code (those changes should not be needed when
# this Query is instanciated by a SearchKey, as operator should be correct
...
...
product/ZSQLCatalog/SearchKey/DateTimeKey.py
View file @
debb2043
...
...
@@ -141,7 +141,7 @@ def getPeriodBoundaries(value):
elif
isinstance
(
value
,
DateTime
):
raise
TypeError
(
'Impossible to guess a precision from a DateTime type.'
)
else
:
raise
TypeError
(
'Unknown date type: %r'
%
(
value
))
raise
TypeError
(
'Unknown date type: %r'
%
(
value
,
))
delta
=
delta_list
[
delimiter_count
]
if
callable
(
delta
):
delta
=
delta
(
first_date
)
...
...
product/ZSQLCatalog/SearchKey/SearchKey.py
View file @
debb2043
...
...
@@ -243,21 +243,21 @@ class SearchKey(object):
comparison_operator
=
single_operator_dict
[
value_range
]
elif
value_range
in
dual_operator_dict
:
if
not
isinstance
(
actual_value
,
(
tuple
,
list
)):
raise
TypeError
(
'Operator %r requires value to be a '
\
'tuple/list. (%r)'
%
(
value_range
,
search_value
))
raise
TypeError
(
'Operator %r requires value to be a tuple/list. (%r)'
%
(
value_range
,
search_value
))
if
len
(
actual_value
)
!=
2
:
raise
TypeError
(
'Operator %r requires value to have a length '
\
'of 2. len(%r) = %i (%r)'
%
(
value_range
,
actual_value
,
len
(
actual_value
),
search_value
))
raise
TypeError
(
'Operator %r requires value to have a length of 2. len(%r) = %s (%r)'
%
(
value_range
,
actual_value
,
len
(
actual_value
),
search_value
))
comparison_operator
=
dual_operator_dict
[
value_range
]
logical_operator
=
'and'
else
:
raise
ValueError
(
'Unknown "range" value in %r'
%
(
search_value
,
)
)
raise
ValueError
(
'Unknown "range" value in %r'
%
search_value
)
if
value_operator
is
not
None
:
if
not
isinstance
(
value_operator
,
basestring
):
raise
TypeError
(
'Operator must be of a string type. Got a %r'
%
\
(
type
(
value_operator
),
))
raise
TypeError
(
'Operator must be of a string type. Got a %r'
%
type
(
value_operator
))
value_operator
=
value_operator
.
lower
()
if
not
isinstance
(
actual_value
,
(
tuple
,
list
)):
raise
TypeError
(
'When specifying an operator, query must be a list.'
)
...
...
product/ZSQLCatalog/SearchText/SearchTextParser.py
View file @
debb2043
...
...
@@ -52,7 +52,7 @@ class ParserPool(object):
parser_registry
=
self
.
parser_registry
name
=
'.'
.
join
((
parser
.
__module__
,
parser
.
__name__
))
if
name
in
parser_registry
:
raise
ValueError
(
'Duplicate parser for name %r'
%
(
name
,
)
)
raise
ValueError
(
'Duplicate parser for name %r'
%
name
)
parser_registry
[
name
]
=
parser
return
name
...
...
product/ZSQLCatalog/ZSQLCatalog.py
View file @
debb2043
...
...
@@ -294,8 +294,8 @@ class ZCatalog(Folder, Persistent, Implicit):
ERP5Site_reindexAll.
"""
if
self
.
getHotReindexingState
()
==
HOT_REINDEXING_FINISHED_STATE
:
raise
Exception
(
'cancelHotReindexing called while no Hot Reindexing '
\
'was ru
ning. Nothing done.'
)
raise
Exception
(
'cancelHotReindexing called while no Hot Reindexing was run
ning. Nothing done.'
)
# Remove hot reindexing state
self
.
_setHotReindexingState
(
HOT_REINDEXING_FINISHED_STATE
)
portal_activities
=
getToolByName
(
self
,
'portal_activities'
)
...
...
@@ -324,9 +324,9 @@ class ZCatalog(Folder, Persistent, Implicit):
transaction.
"""
if
self
.
getHotReindexingState
()
!=
HOT_REINDEXING_DOUBLE_INDEXING_STATE
:
raise
Exception
(
'playBackRecordedObjectList was called while
'
\
'hot_reindexing_state was not "%s". Playback aborted.'
\
%
(
HOT_REINDEXING_DOUBLE_INDEXING_STATE
,
)
)
raise
Exception
(
'playBackRecordedObjectList was called while
'
' hot_reindexing_state was not %r. Playback aborted.'
%
HOT_REINDEXING_DOUBLE_INDEXING_STATE
)
catalog_object
=
self
.
getSQLCatalog
(
sql_catalog_id
)
result
=
catalog_object
.
readRecordedObjectList
(
catalog
=
catalog
)
if
len
(
result
):
...
...
@@ -338,7 +338,7 @@ class ZCatalog(Folder, Persistent, Implicit):
if
obj
is
not
None
:
obj
.
reindexObject
(
sql_catalog_id
=
sql_catalog_id
)
else
:
raise
ValueError
(
'%
s
is not a valid value for "catalog".'
%
(
catalog
,
))
raise
ValueError
(
'%
r
is not a valid value for "catalog".'
%
(
catalog
,
))
catalog_object
.
deleteRecordedObjectList
(
uid_list
=
[
o
.
uid
for
o
in
result
])
# Re-schedule the same action in case there are remaining rows in the
# table. This can happen if the database connector limits the number
...
...
@@ -432,10 +432,9 @@ class ZCatalog(Folder, Persistent, Implicit):
raise
CatalogError
(
'hot reindexing process is already running %s -%s'
%
(
self
,
self
.
hot_reindexing_state
))
if
source_sql_catalog_id
==
destination_sql_catalog_id
:
raise
CatalogError
(
'Hot reindexing cannot be done with the same '
\
'catalog as both source and destination. What'
\
' you want to do is a "clear catalog" and an '
\
'"ERP5Site_reindexAll".'
)
raise
CatalogError
(
"Hot reindexing cannot be done with the same catalog"
" as both source and destination. What you want to do"
" is a 'clear catalog' and an 'ERP5Site_reindexAll'."
)
if
source_sql_catalog_id
!=
self
.
getDefaultSqlCatalogId
():
LOG
(
'ZSQLCatalog'
,
0
,
'Warning : Hot reindexing is started with a '
\
...
...
@@ -1155,7 +1154,7 @@ class ZCatalog(Folder, Persistent, Implicit):
try
:
add_result
=
result
.
append
except
AttributeError
:
raise
AttributeError
(
`result`
)
raise
AttributeError
(
repr
(
result
)
)
for
id
,
ob
in
items
:
if
pre
:
p
=
"%s/%s"
%
(
pre
,
id
)
...
...
product/ZSQLCatalog/tests/testSQLCatalog.py
View file @
debb2043
...
...
@@ -103,7 +103,7 @@ class ReferenceQuery:
value
=
MatchList
([
value
])
self
.
value
=
value
elif
len
(
kw
)
>
1
:
raise
ValueError
(
'kw must not have more than one item: %r'
%
(
kw
,
)
)
raise
ValueError
(
'kw must not have more than one item: %r'
%
kw
)
def
__eq__
(
self
,
other
):
if
isinstance
(
other
,
SimpleQuery
):
...
...
product/Zelenium/zuite.py
View file @
debb2043
...
...
@@ -713,13 +713,14 @@ class _FilesystemProxy( Folder ):
return
self
.
__class__
(
key
,
self
.
_fsobjs
[
'subdirs'
][
key
]
).
__of__
(
self
.
aq_parent
)
if
key
in
_SUPPORT_FILES
.
keys
():
return
_SUPPORT_FILES
[
key
].
__of__
(
self
)
if
default
is
not
_MARKER
:
try
:
file
=
_SUPPORT_FILES
[
key
]
except
KeyError
:
if
default
is
_MARKER
:
raise
return
default
r
aise
KeyError
(
key
)
r
eturn
file
.
__of__
(
self
)
security
.
declareProtected
(
View
,
'listTestCases'
)
def
listTestCases
(
self
,
prefix
=
()
):
...
...
tests/__init__.py
View file @
debb2043
...
...
@@ -3,6 +3,7 @@ import os, subprocess, re
# test_suite is provided by 'run_test_suite'
from
test_suite
import
ERP5TypeTestSuite
import
sys
from
itertools
import
chain
HERE
=
os
.
path
.
dirname
(
__file__
)
...
...
@@ -34,10 +35,10 @@ class _ERP5(ERP5TypeTestSuite):
path
=
"%s/../"
%
HERE
component_re
=
re
.
compile
(
".*/([^/]+)/TestTemplateItem/portal_components"
"/test
\
.[^.]+
\
.([^.]+).py$"
)
for
test_path
in
(
glob
(
'%s/product/*/tests/test*.py'
%
path
)
+
glob
(
'%s/bt5/*/TestTemplateItem/test*.py'
%
path
)
+
glob
(
'%s/bt5/*/TestTemplateItem/portal_components/test.*.test*.py'
%
path
)):
for
test_path
in
chain
(
glob
(
path
+
'/product/*/tests/test*.py'
),
glob
(
path
+
'/bt5/*/TestTemplateItem/test*.py'
),
glob
(
path
+
'/bt5/*/TestTemplateItem/portal_components/test.*.test*.py'
)):
component_re_match
=
component_re
.
match
(
test_path
)
if
component_re_match
is
not
None
:
test_case
=
"%s:%s"
%
(
component_re_match
.
group
(
1
),
...
...
@@ -204,32 +205,30 @@ class ERP5BusinessTemplateCodingStyleTestSuite(_ERP5):
"""Run coding style test on all business templates.
"""
def
getTestList
(
self
):
test_list
=
[]
for
business_template_path
in
(
glob
(
'%s/../bt5/*'
%
HERE
)
+
glob
(
'%s/../product/ERP5/bootstrap/*'
%
HERE
)):
test_list
=
[
os
.
path
.
basename
(
business_template_path
)
for
path
in
chain
(
glob
(
HERE
+
'/../bt5/*'
),
glob
(
HERE
+
'/../product/ERP5/bootstrap/*'
))
# we skip coding style check for business templates having this marker
# property. Since the property is not exported (on purpose), modified business templates
# will be candidate for coding style test again.
if
os
.
path
.
isdir
(
business_template_path
)
and
\
not
os
.
path
.
exists
(
os
.
path
.
join
(
business_template_path
,
'bt/skip_coding_style_test'
)):
test_list
.
append
(
os
.
path
.
basename
(
business_template_path
))
for
product_path
in
(
glob
(
'%s/../product/*'
%
(
HERE
))
+
glob
(
'%s/../bt5'
%
HERE
)):
if
os
.
path
.
isdir
(
product_path
)
and
\
not
os
.
path
.
exists
(
os
.
path
.
join
(
product_path
,
'skip_coding_style_test'
)):
test_list
.
append
(
"Python3Style."
+
os
.
path
.
basename
(
product_path
))
if
not
os
.
path
.
exists
(
path
+
'/bt/skip_coding_style_test'
)
]
for
path
in
glob
(
HERE
+
'/../product/*'
):
if
not
os
.
path
.
exists
(
path
+
'/skip_coding_style_test'
):
test_list
.
append
(
"Python3Style."
+
os
.
path
.
basename
(
path
))
return
test_list
def
run
(
self
,
full_test
):
if
full_test
.
s
plit
(
'.'
)[
0
]
==
"Python3Style"
:
return
self
.
runUnitTest
(
'Python3StyleTest'
,
TESTED_PRODUCT
=
full_test
.
split
(
'.'
)[
1
])
if
full_test
.
s
tartswith
(
"Python3Style."
)
:
return
self
.
runUnitTest
(
'Python3StyleTest'
,
TESTED_PRODUCT
=
full_test
[
13
:
])
return
self
.
runUnitTest
(
'CodingStyleTest'
,
TESTED_BUSINESS_TEMPLATE
=
full_test
)
def
getLogDirectoryPath
(
self
,
*
args
,
**
kw
):
log_directory
=
os
.
path
.
join
(
self
.
log_directory
,
'{}-{}'
.
format
(
args
[
-
1
],
kw
.
get
(
'TESTED_BUSINESS_TEMPLATE'
,
kw
.
get
(
'TESTED_PRODUCT'
))
))
args
[
-
1
]
+
'-'
+
(
kw
.
get
(
'TESTED_BUSINESS_TEMPLATE'
)
or
kw
[
'TESTED_PRODUCT'
]
))
os
.
mkdir
(
log_directory
)
return
log_directory
...
...
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