[Zope3-dev] Re: [Zope3-checkins] SVN: Zope3/trunk/src/zope/ Massive style cleanup: Move to new raise exception style; for motivation, see:

Benji York benji at zope.com
Tue Aug 30 18:10:46 EDT 2005


Martijn Pieters wrote:
> Log message for revision 38178:
>   Massive style cleanup: Move to new raise exception style; for motivation, see:

> Modified: Zope3/trunk/src/zope/app/workflow/stateful/definition.py
> ===================================================================
> --- Zope3/trunk/src/zope/app/workflow/stateful/definition.py	2005-08-30 21:36:02 UTC (rev 38177)
> +++ Zope3/trunk/src/zope/app/workflow/stateful/definition.py	2005-08-30 21:50:19 UTC (rev 38178)
> @@ -46,6 +46,10 @@
>      implements(IStatefulStatesContainer)
>  
>  
> +class NoLocalProcessDefinition(Exception):
> +    """No local process definition found"""
> +    
> +
>  class StateNamesVocabulary(SimpleVocabulary):
>      """Vocabulary providing the names of states in a local process definition.
>      """
> @@ -61,7 +65,7 @@
>              for obj in zapi.getParents(context):
>                  if IStatefulProcessDefinition.providedBy(obj):
>                      return obj.getStateNames()
> -        raise 'NoLocalProcessDefinition', 'No local process definition found.'
> +        raise NoLocalProcessDefinition('No local process definition found.')
>  

I'm not sure it's worth worrying about (and I definitely prefer the new 
version better), but these type conversions are not backward compatible. 
    Of course it's only a problem if anyone is trying to catch the 
string version of the exception.
-- 
Benji York
Senior Software Engineer
Zope Corporation


More information about the Zope3-dev mailing list