Commit d88e5bc0 authored by Łukasz Nowak's avatar Łukasz Nowak

Protect against during indexation concurrency.

As users can double click (or register in same time with same reference)
during time of indexation, it is required to lock on activity system.

Note that as reference is global in the system, same tag, as in
Document.Person._setReference is used.
parent fe919b4e
......@@ -57,6 +57,13 @@ Parameters:\n
value -- field value (string)\n
REQUEST -- standard REQUEST variable"""\n
\n
if value:\n
# Same tag is used as in Document.Person._setReference, in order to protect against\n
# concurrency between Credential Request and Person object too\n
tag = \'Person_setReference_%s\' % value.encode(\'hex\')\n
if context.getPortalObject().portal_activities.countMessageWithTag(tag):\n
return False\n
\n
def getRealContext():\n
if not REQUEST:\n
return context\n
......
......@@ -90,6 +90,9 @@ credential_request = module.newContent(\n
date_of_birth=date_of_birth)\n
\n
credential_request.setCategoryList(category_list)\n
# Same tag is used as in Document.Person._setReference, in order to protect against\n
# concurrency between Credential Request and Person object too\n
credential_request.reindexObject(activate_kw=dict(tag=\'Person_setReference_%s\' % reference.encode(\'hex\')))\n
\n
#We attach the current user to the credential request if not anonymous\n
if not context.portal_membership.isAnonymousUser():\n
......
364
\ No newline at end of file
365
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment