Deprecation Warning

View: New views
3 Messages — Rating Filter:   Alert me  

Deprecation Warning

by vyshakh krishnan :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi everybody,


While porting Zope2 on Python2.5, I am now trying to remove the
deprecation warnings.Most of them are due to the raising of string
exceptions. One of such warnings in the module Products is

/home/zope/ztrunk25/lib/python/OFS/SimpleItem.py:248:
          DeprecationWarning: raising a string exception is deprecated
                      raise error_type, v, tb

These warnings can be removed by changing these string exceptions to
class based exceptions.
Can anyone suggest how these changes can be made?


With regards
Vyshakh
_______________________________________________
Zope-Dev maillist  -  Zope-Dev@...
http://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists -
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope )

Re: Deprecation Warning

by Lennart Regebro-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Wed, Jul 23, 2008 at 14:03, vyshakh krishnan
<vyshakh.krishnan@...> wrote:

> Hi everybody,
>
>
> While porting Zope2 on Python2.5, I am now trying to remove the
> deprecation warnings.Most of them are due to the raising of string
> exceptions. One of such warnings in the module Products is
>
> /home/zope/ztrunk25/lib/python/OFS/SimpleItem.py:248:
>          DeprecationWarning: raising a string exception is deprecated
>                      raise error_type, v, tb
>
> These warnings can be removed by changing these string exceptions to
> class based exceptions.
> Can anyone suggest how these changes can be made?

Well, typically you create classes based on Exception or
BaseException, and use them instead.
Maybe you could expand a bit on what your worries are?

--
Lennart Regebro: Zope and Plone consulting.
http://www.colliberty.com/
+33 661 58 14 64
_______________________________________________
Zope-Dev maillist  -  Zope-Dev@...
http://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists -
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope )

Re: Deprecation Warning

by Tres Seaver :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

vyshakh krishnan wrote:

> Hi everybody,
>
>
> While porting Zope2 on Python2.5, I am now trying to remove the
> deprecation warnings.Most of them are due to the raising of string
> exceptions. One of such warnings in the module Products is
>
> /home/zope/ztrunk25/lib/python/OFS/SimpleItem.py:248:
>           DeprecationWarning: raising a string exception is deprecated
>                       raise error_type, v, tb
>
> These warnings can be removed by changing these string exceptions to
> class based exceptions.
> Can anyone suggest how these changes can be made?

That code is not in the Products module:  it is inside OFS.SimpleItem's
'raise_standardErrorMessage' method.  Note that the method explicitly
converts the error_type to a string above:  that is the source of the
DeprecationWarning, almost certainly, as there should be no remaining
traces of explicitly-created string exceptions anywhere in the Zope
codebase.


Tres.
- --
===================================================================
Tres Seaver          +1 540-429-0999          tseaver@...
Palladion Software   "Excellence by Design"    http://palladion.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFIh1FR+gerLs4ltQ4RAt7AAJ96zocnGl6fMw6qKfLn59/bV6/ZyQCcCdL+
Vqw6L0yBM1eQ4z0D3yxS0kM=
=2F4j
-----END PGP SIGNATURE-----

_______________________________________________
Zope-Dev maillist  -  Zope-Dev@...
http://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists -
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope )
LightInTheBox - Buy quality products at wholesale price!