From 2c62cccb4ffe6a7ea4c818394c04bf0291dcd174 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Calonne?= <aurel@nexedi.com> Date: Thu, 22 Mar 2007 16:36:07 +0000 Subject: [PATCH] improve a bit code of init script git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@13578 20353a03-c40f-0410-a6d1-a30d3c3de9de --- .../erp5_banking_cash/CashSortingIncident_init.xml | 9 +++++++-- .../erp5_banking_cash/ClassificationSurvey_init.xml | 3 ++- .../erp5_banking_cash/InternalMoneyDeposit_init.xml | 11 ++--------- .../MoneyDeposit_getBaobabSourcePayment.xml | 4 +--- .../erp5_banking_cash/MutilatedBanknote_init.xml | 7 ++++++- bt5/erp5_banking_cash/bt/revision | 2 +- 6 files changed, 19 insertions(+), 17 deletions(-) diff --git a/bt5/erp5_banking_cash/SkinTemplateItem/portal_skins/erp5_banking_cash/CashSortingIncident_init.xml b/bt5/erp5_banking_cash/SkinTemplateItem/portal_skins/erp5_banking_cash/CashSortingIncident_init.xml index 189ca1f7ec..4c8e37ae91 100644 --- a/bt5/erp5_banking_cash/SkinTemplateItem/portal_skins/erp5_banking_cash/CashSortingIncident_init.xml +++ b/bt5/erp5_banking_cash/SkinTemplateItem/portal_skins/erp5_banking_cash/CashSortingIncident_init.xml @@ -69,7 +69,10 @@ <item> <key> <string>_body</string> </key> <value> <string>user_site = context.Baobab_getUserAssignedRootSiteList()[0]\n -context.edit(source=user_site)\n +if user_site in (None, \'\'):\n + raise ValueError, "Unable to determine user site"\n +else:\n + context.edit(source=user_site)\n </string> </value> </item> <item> @@ -122,8 +125,10 @@ context.edit(source=user_site)\n <string>kw</string> <string>_getitem_</string> <string>_getattr_</string> -<string>context</string> + <string>context</string> <string>user_site</string> + <string>None</string> + <string>ValueError</string> </tuple> </value> </item> diff --git a/bt5/erp5_banking_cash/SkinTemplateItem/portal_skins/erp5_banking_cash/ClassificationSurvey_init.xml b/bt5/erp5_banking_cash/SkinTemplateItem/portal_skins/erp5_banking_cash/ClassificationSurvey_init.xml index 05d6a38ffa..267d1d5691 100644 --- a/bt5/erp5_banking_cash/SkinTemplateItem/portal_skins/erp5_banking_cash/ClassificationSurvey_init.xml +++ b/bt5/erp5_banking_cash/SkinTemplateItem/portal_skins/erp5_banking_cash/ClassificationSurvey_init.xml @@ -70,7 +70,7 @@ <key> <string>_body</string> </key> <value> <string>site_list = context.Baobab_getUserAssignedSiteList()\n if len(site_list) == 0:\n - context.log("ClassificationSurvey_init", "unabled to determine site")\n + raise ValueError, "Unable to determine site"\n \n site = site_list[0]\n site = context.Baobab_getVaultSite(site)\n @@ -123,6 +123,7 @@ context.setSource("%s/caveau/auxiliaire/encaisse_des_billets_ventiles_et_detruit <string>context</string> <string>site_list</string> <string>len</string> + <string>ValueError</string> <string>_getitem_</string> <string>site</string> </tuple> diff --git a/bt5/erp5_banking_cash/SkinTemplateItem/portal_skins/erp5_banking_cash/InternalMoneyDeposit_init.xml b/bt5/erp5_banking_cash/SkinTemplateItem/portal_skins/erp5_banking_cash/InternalMoneyDeposit_init.xml index d43bc76671..74425585ea 100644 --- a/bt5/erp5_banking_cash/SkinTemplateItem/portal_skins/erp5_banking_cash/InternalMoneyDeposit_init.xml +++ b/bt5/erp5_banking_cash/SkinTemplateItem/portal_skins/erp5_banking_cash/InternalMoneyDeposit_init.xml @@ -68,13 +68,7 @@ </item> <item> <key> <string>_body</string> </key> - <value> <string># create a default banking operation line that will be updated later\n -#context.edit(external_software=\'star\')\n -\n -transaction = context\n -\n -# XXX it might be better to set resource according to source_payment.\n -transaction.setResource(\'currency_module/\' + context.Baobab_getPortalReferenceCurrencyID())\n + <value> <string>context.setResource(\'currency_module/\' + context.Baobab_getPortalReferenceCurrencyID())\n \n context.setDestination(context.getBaobabDestination())\n \n @@ -132,9 +126,8 @@ movement = context.newContent(portal_type=\'Banking Operation Line\',\n <value> <tuple> <string>kw</string> - <string>context</string> - <string>transaction</string> <string>_getattr_</string> + <string>context</string> <string>movement</string> </tuple> </value> diff --git a/bt5/erp5_banking_cash/SkinTemplateItem/portal_skins/erp5_banking_cash/MoneyDeposit_getBaobabSourcePayment.xml b/bt5/erp5_banking_cash/SkinTemplateItem/portal_skins/erp5_banking_cash/MoneyDeposit_getBaobabSourcePayment.xml index 5307ca77f9..f0e5ab7eeb 100644 --- a/bt5/erp5_banking_cash/SkinTemplateItem/portal_skins/erp5_banking_cash/MoneyDeposit_getBaobabSourcePayment.xml +++ b/bt5/erp5_banking_cash/SkinTemplateItem/portal_skins/erp5_banking_cash/MoneyDeposit_getBaobabSourcePayment.xml @@ -68,9 +68,7 @@ </item> <item> <key> <string>_body</string> </key> - <value> <string>context.log("MoneyDeposit_getBaobabDestinationPayment", "in get Destination Payment")\n -\n -return context.Baobab_getPortalDefaultPaymentNode()\n + <value> <string>return context.Baobab_getPortalDefaultPaymentNode()\n </string> </value> </item> <item> diff --git a/bt5/erp5_banking_cash/SkinTemplateItem/portal_skins/erp5_banking_cash/MutilatedBanknote_init.xml b/bt5/erp5_banking_cash/SkinTemplateItem/portal_skins/erp5_banking_cash/MutilatedBanknote_init.xml index bd23fcc786..812de0b6fc 100644 --- a/bt5/erp5_banking_cash/SkinTemplateItem/portal_skins/erp5_banking_cash/MutilatedBanknote_init.xml +++ b/bt5/erp5_banking_cash/SkinTemplateItem/portal_skins/erp5_banking_cash/MutilatedBanknote_init.xml @@ -69,7 +69,10 @@ <item> <key> <string>_body</string> </key> <value> <string>user_site = context.Baobab_getUserAssignedRootSiteList()[0]\n -context.edit(source=user_site, source_trade=user_site)\n +if user_site in (\'\', None):\n + raise ValueError, "Unable to determine site"\n +else:\n + context.edit(source=user_site, source_trade=user_site)\n </string> </value> </item> <item> @@ -123,6 +126,8 @@ context.edit(source=user_site, source_trade=user_site)\n <string>_getattr_</string> <string>context</string> <string>user_site</string> + <string>None</string> + <string>ValueError</string> </tuple> </value> </item> diff --git a/bt5/erp5_banking_cash/bt/revision b/bt5/erp5_banking_cash/bt/revision index fca7fbef0e..bcad85486c 100644 --- a/bt5/erp5_banking_cash/bt/revision +++ b/bt5/erp5_banking_cash/bt/revision @@ -1 +1 @@ -223 \ No newline at end of file +225 \ No newline at end of file -- 2.30.9