From aa53041b30303dd5fb732c5d922d4ff9de957e4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Calonne?= <aurel@nexedi.com> Date: Wed, 18 Apr 2007 15:30:33 +0000 Subject: [PATCH] fix some script git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@14113 20353a03-c40f-0410-a6d1-a30d3c3de9de --- .../Baobab_getUserAssignedRootSiteList.xml | 16 +- .../Baobab_getUserSiteUid.xml | 2 +- .../Base_getPreviousState.xml | 169 ++++++++++++++++++ bt5/erp5_banking_core/bt/revision | 2 +- 4 files changed, 182 insertions(+), 7 deletions(-) create mode 100644 bt5/erp5_banking_core/SkinTemplateItem/portal_skins/erp5_banking_core/Base_getPreviousState.xml diff --git a/bt5/erp5_banking_core/SkinTemplateItem/portal_skins/erp5_banking_core/Baobab_getUserAssignedRootSiteList.xml b/bt5/erp5_banking_core/SkinTemplateItem/portal_skins/erp5_banking_core/Baobab_getUserAssignedRootSiteList.xml index 4241da4d41..3c0be19343 100644 --- a/bt5/erp5_banking_core/SkinTemplateItem/portal_skins/erp5_banking_core/Baobab_getUserAssignedRootSiteList.xml +++ b/bt5/erp5_banking_core/SkinTemplateItem/portal_skins/erp5_banking_core/Baobab_getUserAssignedRootSiteList.xml @@ -74,9 +74,13 @@ for a in valid_assignment_list:\n new_site = a.getSiteValue()\n while new_site.getVaultType()!=\'site\':\n new_site = new_site.getParentValue()\n - site_url = new_site.getRelativeUrl()\n - if site_url not in site_list:\n - site_list.append(site_url)\n + if object:\n + if new_site not in site_list:\n + site_list.append(new_site)\n + else:\n + site_url = new_site.getRelativeUrl()\n + if site_url not in site_list:\n + site_list.append(site_url)\n return site_list\n </string> </value> </item> @@ -100,7 +104,7 @@ return site_list\n </item> <item> <key> <string>_params</string> </key> - <value> <string>user_id=None, **kw</string> </value> + <value> <string>user_id=None, object=0, **kw</string> </value> </item> <item> <key> <string>_proxy_roles</string> </key> @@ -128,13 +132,14 @@ return site_list\n <dictionary> <item> <key> <string>co_argcount</string> </key> - <value> <int>1</int> </value> + <value> <int>2</int> </value> </item> <item> <key> <string>co_varnames</string> </key> <value> <tuple> <string>user_id</string> + <string>object</string> <string>kw</string> <string>_getattr_</string> <string>context</string> @@ -157,6 +162,7 @@ return site_list\n <value> <tuple> <none/> + <int>0</int> </tuple> </value> </item> diff --git a/bt5/erp5_banking_core/SkinTemplateItem/portal_skins/erp5_banking_core/Baobab_getUserSiteUid.xml b/bt5/erp5_banking_core/SkinTemplateItem/portal_skins/erp5_banking_core/Baobab_getUserSiteUid.xml index a6f10b458e..13c570fe8b 100644 --- a/bt5/erp5_banking_core/SkinTemplateItem/portal_skins/erp5_banking_core/Baobab_getUserSiteUid.xml +++ b/bt5/erp5_banking_core/SkinTemplateItem/portal_skins/erp5_banking_core/Baobab_getUserSiteUid.xml @@ -70,7 +70,7 @@ user_id = context.portal_membership.getAuthenticatedMember().getUserName()\n \n def getUserSiteUid(user_id):\n - return context.Baobab_getUserAssignmentList(user_id)[0].getSiteUid()\n + return context.Baobab_getUserAssignedRootSiteList(user_id=user_id, object=1)[0].getSiteUid()\n \n \n getUserSiteUid = CachingMethod(getUserSiteUid, id=\'Baobab_getUserUserSiteUid\', cache_factory=\'erp5_ui_medium\')\n diff --git a/bt5/erp5_banking_core/SkinTemplateItem/portal_skins/erp5_banking_core/Base_getPreviousState.xml b/bt5/erp5_banking_core/SkinTemplateItem/portal_skins/erp5_banking_core/Base_getPreviousState.xml new file mode 100644 index 0000000000..9d093d5378 --- /dev/null +++ b/bt5/erp5_banking_core/SkinTemplateItem/portal_skins/erp5_banking_core/Base_getPreviousState.xml @@ -0,0 +1,169 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <tuple> + <global name="PythonScript" module="Products.PythonScripts.PythonScript"/> + <tuple/> + </tuple> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>Python_magic</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>Script_magic</string> </key> + <value> <int>3</int> </value> + </item> + <item> + <key> <string>__ac_local_roles__</string> </key> + <value> + <none/> + </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># Get the id of the user which last passed given transition on given workflow.\n +workflow_item_list = context.Base_getWorkflowHistoryItemList(workflow_id, display=0)\n +workflow_item_list.reverse()\n +previous_state = None\n +found_given_state = 0\n +for workflow_item in workflow_item_list:\n + current_state = workflow_item.getProperty(\'state\')\n + context.log(\'current_state\',current_state)\n + if current_state == state:\n + found_given_state = 1\n + continue\n + if found_given_state and (current_state != state):\n + previous_state = current_state\n + break\n +return previous_state\n +</string> </value> + </item> + <item> + <key> <string>_code</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>_filepath</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>_owner</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>_params</string> </key> + <value> <string>workflow_id, state</string> </value> + </item> + <item> + <key> <string>errors</string> </key> + <value> + <tuple/> + </value> + </item> + <item> + <key> <string>func_code</string> </key> + <value> + <object> + <klass> + <global name="FuncCode" module="Shared.DC.Scripts.Signature"/> + </klass> + <tuple/> + <state> + <dictionary> + <item> + <key> <string>co_argcount</string> </key> + <value> <int>2</int> </value> + </item> + <item> + <key> <string>co_varnames</string> </key> + <value> + <tuple> + <string>workflow_id</string> + <string>state</string> + <string>_getattr_</string> +<string>context</string> + <string>workflow_item_list</string> + <string>None</string> + <string>previous_state</string> + <string>found_given_state</string> + <string>_getiter_</string> + <string>workflow_item</string> + <string>current_state</string> + </tuple> + </value> + </item> + </dictionary> + </state> + </object> + </value> + </item> + <item> + <key> <string>func_defaults</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>Base_getPreviousState</string> </value> + </item> + <item> + <key> <string>warnings</string> </key> + <value> + <tuple/> + </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/bt5/erp5_banking_core/bt/revision b/bt5/erp5_banking_core/bt/revision index 73181427a2..05cf25896d 100644 --- a/bt5/erp5_banking_core/bt/revision +++ b/bt5/erp5_banking_core/bt/revision @@ -1 +1 @@ -199 \ No newline at end of file +201 \ No newline at end of file -- 2.30.9