From a03e7973ed57836067f259e6dea88f859222a505 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20G=C3=B3rny?= <bartek@gorny.edu.pl> Date: Tue, 14 Nov 2006 16:44:53 +0000 Subject: [PATCH] handle exception when a contributing user has no subordination git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@11297 20353a03-c40f-0410-a6d1-a30d3c3de9de --- .../portal_skins/erp5_dms/DMS_handleMail.xml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/bt5/erp5_dms/SkinTemplateItem/portal_skins/erp5_dms/DMS_handleMail.xml b/bt5/erp5_dms/SkinTemplateItem/portal_skins/erp5_dms/DMS_handleMail.xml index 478f096d91..c6c671067b 100644 --- a/bt5/erp5_dms/SkinTemplateItem/portal_skins/erp5_dms/DMS_handleMail.xml +++ b/bt5/erp5_dms/SkinTemplateItem/portal_skins/erp5_dms/DMS_handleMail.xml @@ -75,6 +75,7 @@ noSenderInHeaderMsg="no sender in headers"\n noSenderMsg="you are not in user database"\n manySendersMsg="very serious error: your address has multiple entries"\n +noSubordinationMsg="you do not have properly set subordination (I could not find a group you are working in)"\n \n # get sender from headers\n fromraw=theMail[\'headers\'][\'from\']\n @@ -92,6 +93,7 @@ if len(r)==0:\n return printed\n if len(r)>1:\n print manySendersMsg\n + return printed\n senderm=r[0]\n person=senderm.getParent()\n context.log(script.getId(),\'ok, this address belongs to \'+person.getRelativeUrl())\n @@ -108,7 +110,11 @@ try:\n if k==\'programme\':atr=\'source_project\'\n if k!=\'document_type\':\n obj.setProperty(atr,mailprops[k])\n - obj.setGroup(person.getSubordinationValue().getGroup())\n + try:\n + obj.setGroup(person.getSubordinationValue().getGroup())\n + except AttributeError:\n + print noSubordinationMsg\n + return printed\n obj.manage_setLocalRoles(person.getReference(),[\'Owner\',])\n context.DMS_notifyByEmail(address=senderemail,event=\'ingest\',object=obj)\n except Exception,e:\n @@ -170,6 +176,7 @@ return\n <string>noSenderInHeaderMsg</string> <string>noSenderMsg</string> <string>manySendersMsg</string> + <string>noSubordinationMsg</string> <string>_getitem_</string> <string>fromraw</string> <string>_getattr_</string> @@ -188,6 +195,7 @@ return\n <string>obj</string> <string>k</string> <string>atr</string> + <string>AttributeError</string> <string>Exception</string> <string>e</string> <string>str</string> -- 2.30.9