[Erp5-dev] Verbosity in error log example/proposition

Mikolaj Antoszkiewicz mikolaj at erp5.pl
Tue Jun 3 13:59:30 CEST 2008


Hello,

I've been trying to commit changes made to Business Template, when such 
an error appeared:


     *  Module ZPublisher.Publish, line 114, in publish
     * Module ZPublisher.mapply, line 88, in mapply
     * Module ZPublisher.Publish, line 40, in call_object
     * Module Shared.DC.Scripts.Bindings, line 311, in __call__
     * Module Shared.DC.Scripts.Bindings, line 348, in _bindAndExec
     * Module Products.PythonScripts.PythonScript, line 324, in _exec
     * Module None, line 4, in tree.xml
       <PythonScript at /erp5/tree.xml used for /erp5/portal_templates/61>
       Line 4
     * Module Products.ERP5Subversion.Tool.SubversionTool, line 1130, in 
extractBT
     * Module Products.ERP5Type.Base, line 211, in __call__
     * Module Products.ERP5Type.Document.BusinessTemplate, line 4572, in 
build
     * Module Products.ERP5Type.Document.BusinessTemplate, line 1701, in 
build

ValueError: need more than 1 value to unpack


Well, I didn't have to think much and search long to get to the BT 
section where there was a bad entry and correct it.
But wouldn't it be nicer and more efficient for a developer to get for 
example such a traceback:


     *  Module ZPublisher.Publish, line 114, in publish
     * Module ZPublisher.mapply, line 88, in mapply
     * Module ZPublisher.Publish, line 40, in call_object
     * Module Shared.DC.Scripts.Bindings, line 311, in __call__
     * Module Shared.DC.Scripts.Bindings, line 348, in _bindAndExec
     * Module Products.PythonScripts.PythonScript, line 324, in _exec
     * Module None, line 4, in tree.xml
       <PythonScript at /erp5/tree.xml used for /erp5/portal_templates/61>
       Line 4
     * Module Products.ERP5Subversion.Tool.SubversionTool, line 1130, in 
extractBT
     * Module Products.ERP5Type.Base, line 211, in __call__
     * Module Products.ERP5Type.Document.BusinessTemplate, line 4575, in 
build
     * Module Products.ERP5Type.Document.BusinessTemplate, line 1704, in 
build

ValueError: Bad entry ('CustomOrganisationDetails') in Base Category section


This pinpoints the problem and there's no need to search for it. I know 
- in BT definition there's not many sections, but there might be many 
entries in it. Since they're sorted, it's a fast work to find one - if 
you know what you're looking for (and you would from the above traceback).

I'm attaching a patch for this case and would like to contribute more as 
they come :P. I guess many developers would really appreciate that...
Comments please.

Mikolaj
-------------- next part --------------
A non-text attachment was scrubbed...
Name: BusinessTemplate.py.patch
Type: text/x-patch
Size: 742 bytes
Desc: not available
URL: <http://mail.tiolive.com/pipermail/erp5-dev/attachments/20080603/21c92087/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3229 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://mail.tiolive.com/pipermail/erp5-dev/attachments/20080603/21c92087/attachment-0001.bin>


More information about the Erp5-dev mailing list