Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Eteri
erp5
Commits
3826a2f9
Commit
3826a2f9
authored
Jan 23, 2012
by
Łukasz Nowak
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/master' into lazy_simulation_causality
parents
8383758b
220efc32
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
115 additions
and
14 deletions
+115
-14
bt5/erp5_base/SkinTemplateItem/portal_skins/erp5_base/Organisation_view/my_default_email_url_string.xml
...p5_base/Organisation_view/my_default_email_url_string.xml
+1
-1
bt5/erp5_base/bt/revision
bt5/erp5_base/bt/revision
+1
-1
bt5/erp5_base/bt/template_portal_type_allowed_content_type_list
...p5_base/bt/template_portal_type_allowed_content_type_list
+1
-1
bt5/erp5_base/bt/template_portal_type_id_list
bt5/erp5_base/bt/template_portal_type_id_list
+1
-1
bt5/erp5_dms/WorkflowTemplateItem/portal_workflow/document_publication_workflow/scripts/archiveVersion.xml
.../document_publication_workflow/scripts/archiveVersion.xml
+7
-2
bt5/erp5_dms/bt/revision
bt5/erp5_dms/bt/revision
+1
-1
erp5/util/benchmark/result.py
erp5/util/benchmark/result.py
+2
-2
product/ERP5/tests/testCRM.py
product/ERP5/tests/testCRM.py
+37
-0
product/ERP5OOo/tests/testDms.py
product/ERP5OOo/tests/testDms.py
+47
-2
product/ERP5Type/ConflictFree.py
product/ERP5Type/ConflictFree.py
+17
-3
No files found.
bt5/erp5_base/SkinTemplateItem/portal_skins/erp5_base/Organisation_view/my_default_email_url_string.xml
View file @
3826a2f9
...
...
@@ -107,7 +107,7 @@
<dictionary>
<item>
<key>
<string>
_text
</string>
</key>
<value>
<string>
python: here.getDefaultEmail().isDetailed()
</string>
</value>
<value>
<string>
python:
here.hasDefaultEmail() and
here.getDefaultEmail().isDetailed()
</string>
</value>
</item>
</dictionary>
</pickle>
...
...
bt5/erp5_base/bt/revision
View file @
3826a2f9
1008
\ No newline at end of file
1009
\ No newline at end of file
bt5/erp5_base/bt/template_portal_type_allowed_content_type_list
View file @
3826a2f9
...
...
@@ -83,4 +83,4 @@ Person | Link
Person | Telephone
Query Module | Query
Rounding Tool | Rounding Model
Solver Tool | Solver Type
Solver Tool | Solver Type
\ No newline at end of file
bt5/erp5_base/bt/template_portal_type_id_list
View file @
3826a2f9
...
...
@@ -60,4 +60,4 @@ Tax Line Delivery Movement Group
Telephone
Title Movement Group
Variant Movement Group
Variation Property Movement Group
Variation Property Movement Group
\ No newline at end of file
bt5/erp5_dms/WorkflowTemplateItem/portal_workflow/document_publication_workflow/scripts/archiveVersion.xml
View file @
3826a2f9
...
...
@@ -66,19 +66,24 @@ if not reference:\n
portal = document.getPortalObject()\n
portal_catalog = portal.portal_catalog\n
language = document.getLanguage()\n
search_kw = dict(reference=reference,\n
validation_state=validation_state,\n
# exclude current workflow changed document\n
uid=\'NOT %s\' %document.getUid())\n
if not language:\n
# If language is None, we have to check is this document\n
# is language independent. In this case, archival is possible\n
# But if a document exists with same reference and defined\n
# language, we can not do anything\n
for old_document in portal_catalog(
reference=reference, validation_state=validation_state
):\n
for old_document in portal_catalog(
**search_kw
):\n
old_document = old_document.getObject()\n
if not old_document.getLanguage():\n
old_document.archive()\n
return\n
\n
# We can now archive all documents with same reference and language in published state\n
for old_document in portal_catalog(reference=reference, language=language, validation_state=validation_state):\n
search_kw[\'language\'] = language\n
for old_document in portal_catalog(**search_kw):\n
old_document = old_document.getObject()\n
old_document.archive()\n
</string>
</value>
...
...
bt5/erp5_dms/bt/revision
View file @
3826a2f9
1262
\ No newline at end of file
1263
\ No newline at end of file
erp5/util/benchmark/result.py
View file @
3826a2f9
...
...
@@ -197,7 +197,7 @@ class BenchmarkResult(object):
result_list
.
extend
(
missing_result_n
*
[
-
1
])
def
exitSuite
(
self
,
with_error
=
False
):
elapsed_time
=
int
(
time
.
time
()
-
self
.
_current_use_case_elapsed_time
)
elapsed_time
=
time
.
time
()
-
self
.
_current_use_case_elapsed_time
if
with_error
:
if
self
.
_current_suite_dict
[
'expected'
]
!=
-
1
:
...
...
@@ -217,7 +217,7 @@ class BenchmarkResult(object):
self
.
_current_suite_dict
[
'expected'
])
self
.
_current_suite_dict
[
'all_use_case_result_list'
].
append
(
(
self
.
_current_use_case_counter
,
elapsed_time
))
(
self
.
_current_use_case_counter
,
int
(
elapsed_time
)
))
if
self
.
_current_use_case_counter
!=
0
:
self
.
_current_suite_dict
[
'use_case_stat'
].
add
(
...
...
product/ERP5/tests/testCRM.py
View file @
3826a2f9
...
...
@@ -1494,6 +1494,43 @@ class TestCRMMailSend(BaseTestCRM):
self
.
assertEquals
(
new_event
.
getTitle
(),
real_title
)
self
.
assertEquals
(
new_event
.
getTextContent
(),
real_content
)
def
test_cloneTicketAndEventList
(
self
):
"""
All events uses after script and interaciton
workflow add a test for clone
"""
portal
=
self
.
portal
event_list
=
[]
destination_list
=
[]
for
i
in
range
(
0
,
100
):
person
=
portal
.
person_module
.
newContent
(
portal_type
=
'Person'
,
title
=
'Person %s'
%
i
)
destination_list
.
append
(
person
)
campaing
=
portal
.
campaign_module
.
newContent
(
portal_type
=
'Campaign'
,
reference
=
'Test'
)
for
i
in
range
(
0
,
3
):
event
=
portal
.
event_module
.
newContent
(
portal_type
=
'Mail Message'
,
title
=
'Mail %s'
%
i
,
follow_up
=
campaing
.
getRelativeUrl
())
event
.
setDestinationList
([
x
.
getRelativeUrl
()
for
x
in
destination_list
])
event_list
.
append
(
event
)
self
.
stepTic
()
# use Ticket_cloneTicketAndEventList
campaing
.
Ticket_cloneTicketAndEventList
()
self
.
stepTic
()
cloned_campaign
=
[
x
for
x
in
portal
.
campaign_module
.
objectValues
()
if
x
!=
campaing
][
0
]
cloned_event_list
=
[
x
for
x
in
portal
.
event_module
.
objectValues
()
if
x
.
getFollowUpValue
()
==
cloned_campaign
]
self
.
assertEqual
(
campaing
.
getTitle
(),
cloned_campaign
.
getTitle
())
self
.
assertEqual
(
campaing
.
getReference
(),
cloned_campaign
.
getReference
())
for
i
in
range
(
0
,
3
):
self
.
assertSameSet
(
event_list
[
i
].
getDestinationValueList
(),
cloned_event_list
[
i
].
getDestinationValueList
())
def
test_Base_addEvent
(
self
):
"""Check Base_addEvent script with a logged in user.
"""
...
...
product/ERP5OOo/tests/testDms.py
View file @
3826a2f9
...
...
@@ -2571,6 +2571,51 @@ return 1
self
.
_test_document_publication_workflow
(
'Text'
,
'share_alive_action'
)
def
test_document_publication_workflow_archiveVersion
(
self
):
""" Test old versions of a doc are auto archived. """
portal
=
self
.
portal
upload_file
=
makeFileUpload
(
'TEST-en-002.doc'
)
kw
=
dict
(
file
=
upload_file
,
synchronous_metadata_discovery
=
True
)
document_002
=
self
.
portal
.
Base_contribute
(
**
kw
)
document_002
.
publish
()
self
.
stepTic
()
document_003
=
document_002
.
Base_createCloneDocument
(
batch_mode
=
1
)
document_003
.
setVersion
(
'003'
)
document_003
.
publish
()
self
.
stepTic
()
self
.
assertEqual
(
'published'
,
document_003
.
getValidationState
())
self
.
assertEqual
(
'archived'
,
document_002
.
getValidationState
())
# check if in any case document doesn't archive itself
# (i.e. shared_alive -> published or any other similar chain)
document_004
=
document_003
.
Base_createCloneDocument
(
batch_mode
=
1
)
document_004
.
setVersion
(
'004'
)
document_004
.
shareAlive
()
self
.
stepTic
()
document_004
.
publish
()
self
.
stepTic
()
self
.
assertEqual
(
'published'
,
document_004
.
getValidationState
())
# check case when no language is used
document_nolang_005
=
document_004
.
Base_createCloneDocument
(
batch_mode
=
1
)
document_nolang_005
.
setVersion
(
'TEST-no-lang'
)
document_nolang_005
.
setVersion
(
'005'
)
document_nolang_005
.
setLanguage
(
None
)
document_nolang_005
.
publish
()
self
.
stepTic
()
self
.
assertEqual
(
'published'
,
document_nolang_005
.
getValidationState
())
document_nolang_006
=
document_nolang_005
.
Base_createCloneDocument
(
batch_mode
=
1
)
document_nolang_006
.
setVersion
(
'006'
)
document_nolang_006
.
shareAlive
()
self
.
stepTic
()
self
.
assertEqual
(
'archived'
,
document_nolang_005
.
getValidationState
())
self
.
assertEqual
(
'shared_alive'
,
document_nolang_006
.
getValidationState
())
class
TestDocumentWithSecurity
(
TestDocumentMixin
):
username
=
'yusei'
...
...
@@ -2710,8 +2755,8 @@ class TestDocumentPerformance(TestDocumentMixin):
def
test_suite
():
suite
=
unittest
.
TestSuite
()
suite
.
addTest
(
unittest
.
makeSuite
(
TestDocument
))
#
suite.addTest(unittest.makeSuite(TestDocumentWithSecurity))
#
suite.addTest(unittest.makeSuite(TestDocumentPerformance))
suite
.
addTest
(
unittest
.
makeSuite
(
TestDocumentWithSecurity
))
suite
.
addTest
(
unittest
.
makeSuite
(
TestDocumentPerformance
))
return
suite
...
...
product/ERP5Type/ConflictFree.py
View file @
3826a2f9
...
...
@@ -2,6 +2,9 @@ from persistent import Persistent
class
ConflictFreeLog
(
Persistent
):
"""Scalable conflict-free append-only double-linked list
Wasted ZODB space due to conflicts is roughly proportional to the number of
clients that continuously add items at the same time.
"""
_prev
=
_next
=
None
_tail_count
=
0
...
...
@@ -70,9 +73,20 @@ class ConflictFreeLog(Persistent):
break
def
_p_resolveConflict
(
self
,
old_state
,
saved_state
,
new_state
):
if
old_state
.
get
(
'_tail_count'
,
0
)
==
new_state
.
get
(
'_tail_count'
,
0
):
i
=
len
(
old_state
[
'_log'
])
else
:
# May be called for the head and its predecessor.
old_tail_count
=
old_state
.
get
(
'_tail_count'
,
0
)
d
=
new_state
.
get
(
'_tail_count'
,
0
)
-
old_tail_count
if
d
:
if
old_tail_count
==
saved_state
.
get
(
'_tail_count'
,
0
):
# We are the first one to rotate. Really rotate.
# Only the head conflicts in this case.
return
dict
(
new_state
,
_log
=
saved_state
[
'_log'
][
d
:]
+
new_state
[
'_log'
])
# Another node rotated before us. Revert our rotation.
# Both the head and its predecessor conflict.
i
=
0
else
:
# We didn't rotate. Just add our items to saved head.
# Only the head conflicts.
i
=
len
(
old_state
[
'_log'
])
saved_state
[
'_log'
].
extend
(
new_state
[
'_log'
][
i
:])
return
saved_state
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