[ZCM] [ZC] 1621/ 3 Comment "The whrandom module is deprecated in Python 2.4"

Collector: Zope Bugs, Features, and Patches ... zope-coders-admin at zope.org
Tue Jul 12 09:13:43 EDT 2005


Issue #1621 Update (Comment) "The whrandom module is deprecated in Python 2.4"
 Status Deferred, Zope/bug+solution medium
To followup, visit:
  http://www.zope.org/Collectors/Zope/1621

==============================================================
= Comment - Entry #3 by sacco on Jul 12, 2005 9:13 am

The python documentation for the module,
<URL: http://python.org/doc/current/lib/module-whrandom.html > ,
actually says:

"Deprecated since release 2.1. Use random instead."

However, there problem with simply updating to use  random  is that in some places (e.g.  DTML.py ) whrandom  is imported just in
order to give the module security clearance should it be imported 
by a document template or Python script.  Thus replacing  whrandom    
with  random  in the Zope source tree could break third party code 
which uses the obsolete module, so there is no easy way to get rid
of that deprecation warning without potentially breaking 
somebody's site.

The best way to resolve this is:

1)  avoid loading  whrandom  automatically, but implement a hook
which adds the necessary security clearance automatically if it
is loaded.  However, this should be done by somebody who knows the
Zope internals well and should in any case be removed again before 
the next major release.

2)  Deprecate the  whrandom  module immediately for use with Zope,
warning that it (or rather its security clearance) will be removed
from the next Zope release.

Personally I'd do both, but in any case remove the module a.s.a.p.
as updating legacy code to use random instead is simple.

________________________________________
= Defer - Entry #2 by ajung on Dec 12, 2004 7:40 am

 Status: Pending => Deferred

Python 2.4 is unsupported at this time.
________________________________________
= Request - Entry #1 by juanval on Dec 12, 2004 7:34 am

In Python 2.4 the whrandom module is deprecated. Instead, the random module should be used.
whrandom is used in the following modules:

lib/python/AccessControl/DTML.py
lib/python/Products/ZCatalog/regressiontests/loadmail.py
lib/python/Products/ZCatalog/regressiontests/regressionCatalog.py
lib/python/Products/PythonScripts/help/PythonScript.py
lib/python/RestrictedPython/Utilities.py
lib/python/DocumentTemplate/DT_Util.py

==============================================================



More information about the Zope-Collector-Monitor mailing list