Commit f29c2937 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

2011-03-28 Kazuhiko

* we should have at most only one published/released/shared document for each reference/language, i.e. we should not have both published and released document with the same reference/language at the same time.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@44661 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent b762f4be
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_body</string> </key>
<value> <string>context.archiveVersion(state_change, validation_state=[\'published\', \'published_alive\'])\n
</string> </value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>state_change</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>archivePublicVersion</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_body</string> </key>
<value> <string>context.archiveVersion(state_change, validation_state=[\'released\', \'released_alive\'])\n
</string> </value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>state_change</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>archiveReleasedVersion</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_body</string> </key>
<value> <string>context.archiveVersion(state_change, validation_state=[\'shared\', \'shared_alive\'])\n
</string> </value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>state_change</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>archiveSharedVersion</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -57,32 +57,35 @@ The previous version is archived automatically.\n
This will only apply to documents with enough coordinates\n
(ex. reference, language, version).\n
"""\n
o = state_change[\'object\']\n
reference = o.getReference()\n
document = state_change[\'object\']\n
reference = document.getReference()\n
if not reference:\n
# If this object has no reference, we can not do anything\n
return\n
\n
language = o.getLanguage()\n
portal = document.getPortalObject()\n
portal_catalog = portal.portal_catalog\n
language = document.getLanguage()\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 o in context.portal_catalog(reference=reference, validation_state=validation_state):\n
document = o.getObject()\n
if not document.getLanguage():\n
document.archive()\n
for old_document in portal_catalog(reference=reference, validation_state=validation_state):\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 o in context.portal_catalog(reference=reference, language=language, validation_state=validation_state):\n
o.getObject().archive()\n
for old_document in portal_catalog(reference=reference, language=language, validation_state=validation_state):\n
old_document = old_document.getObject()\n
old_document.archive()\n
</string> </value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>state_change, validation_state=[\'published\', \'published_alive\']</string> </value>
<value> <string>state_change, validation_state=[\'published\', \'published_alive\', \'released\', \'released_alive\', \'shared\', \'shared_alive\']</string> </value>
</item>
<item>
<key> <string>id</string> </key>
......
......@@ -10,6 +10,10 @@
<key> <string>actbox_category</string> </key>
<value> <string>workflow</string> </value>
</item>
<item>
<key> <string>actbox_icon</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>actbox_name</string> </key>
<value> <string></string> </value>
......@@ -20,7 +24,7 @@
</item>
<item>
<key> <string>after_script_name</string> </key>
<value> <string>archivePublicVersion</string> </value>
<value> <string>archiveVersion</string> </value>
</item>
<item>
<key> <string>description</string> </key>
......
......@@ -10,6 +10,10 @@
<key> <string>actbox_category</string> </key>
<value> <string>workflow</string> </value>
</item>
<item>
<key> <string>actbox_icon</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>actbox_name</string> </key>
<value> <string></string> </value>
......@@ -20,7 +24,7 @@
</item>
<item>
<key> <string>after_script_name</string> </key>
<value> <string>archivePublicVersion</string> </value>
<value> <string>archiveVersion</string> </value>
</item>
<item>
<key> <string>description</string> </key>
......
......@@ -10,6 +10,10 @@
<key> <string>actbox_category</string> </key>
<value> <string>workflow</string> </value>
</item>
<item>
<key> <string>actbox_icon</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>actbox_name</string> </key>
<value> <string></string> </value>
......@@ -20,7 +24,7 @@
</item>
<item>
<key> <string>after_script_name</string> </key>
<value> <string>archiveReleasedVersion</string> </value>
<value> <string>archiveVersion</string> </value>
</item>
<item>
<key> <string>description</string> </key>
......
......@@ -10,6 +10,10 @@
<key> <string>actbox_category</string> </key>
<value> <string>workflow</string> </value>
</item>
<item>
<key> <string>actbox_icon</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>actbox_name</string> </key>
<value> <string></string> </value>
......@@ -20,7 +24,7 @@
</item>
<item>
<key> <string>after_script_name</string> </key>
<value> <string>archiveReleasedVersion</string> </value>
<value> <string>archiveVersion</string> </value>
</item>
<item>
<key> <string>description</string> </key>
......
......@@ -10,6 +10,10 @@
<key> <string>actbox_category</string> </key>
<value> <string>workflow</string> </value>
</item>
<item>
<key> <string>actbox_icon</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>actbox_name</string> </key>
<value> <string></string> </value>
......@@ -20,7 +24,7 @@
</item>
<item>
<key> <string>after_script_name</string> </key>
<value> <string>archiveSharedVersion</string> </value>
<value> <string>archiveVersion</string> </value>
</item>
<item>
<key> <string>description</string> </key>
......
......@@ -10,6 +10,10 @@
<key> <string>actbox_category</string> </key>
<value> <string>workflow</string> </value>
</item>
<item>
<key> <string>actbox_icon</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>actbox_name</string> </key>
<value> <string></string> </value>
......@@ -20,7 +24,7 @@
</item>
<item>
<key> <string>after_script_name</string> </key>
<value> <string>archiveSharedVersion</string> </value>
<value> <string>archiveVersion</string> </value>
</item>
<item>
<key> <string>description</string> </key>
......
2011-03-28 Kazuhiko
* we should have at most only one published/released/shared document for each reference/language, i.e. we should not have both published and released document with the same reference/language at the same time.
2010-07-08 mohamadou
* revert the last commit, setting permission on this state breaks some sites security.
......
1246
\ No newline at end of file
1247
\ 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