[Zope3-checkins] SVN: Zope3/trunk/src/ Stop using whrandom.
Tim Peters
tim.one at comcast.net
Mon Nov 1 14:15:31 EST 2004
Log message for revision 28312:
Stop using whrandom.
whrandom has been deprecated for years. Python 2.4 finally
starts complaining about it. It won't exist in Python 2.5.
Changed:
U Zope3/trunk/src/RestrictedPython/Utilities.py
U Zope3/trunk/src/zope/app/security/globalmodules.zcml
U Zope3/trunk/src/zope/security/examples/sandbox.py
U Zope3/trunk/src/zope/security/examples/sandbox_security.py
-=-
Modified: Zope3/trunk/src/RestrictedPython/Utilities.py
===================================================================
--- Zope3/trunk/src/RestrictedPython/Utilities.py 2004-11-01 19:03:56 UTC (rev 28311)
+++ Zope3/trunk/src/RestrictedPython/Utilities.py 2004-11-01 19:15:30 UTC (rev 28312)
@@ -13,7 +13,7 @@
__version__='$Revision: 1.7 $'[11:-2]
-import string, math, random, whrandom
+import string, math, random
import DocumentTemplate.sequence
utility_builtins = {}
@@ -21,7 +21,7 @@
utility_builtins['string'] = string
utility_builtins['math'] = math
utility_builtins['random'] = random
-utility_builtins['whrandom'] = whrandom
+utility_builtins['whrandom'] = random
utility_builtins['sequence'] = DocumentTemplate.sequence
try:
Modified: Zope3/trunk/src/zope/app/security/globalmodules.zcml
===================================================================
--- Zope3/trunk/src/zope/app/security/globalmodules.zcml 2004-11-01 19:03:56 UTC (rev 28311)
+++ Zope3/trunk/src/zope/app/security/globalmodules.zcml 2004-11-01 19:15:30 UTC (rev 28312)
@@ -90,10 +90,6 @@
weibullvariate WichmannHill whseed" />
</module>
- <module module="whrandom">
- <allow attributes="seed choice randint random seed uniform" />
- </module>
-
<module module="bisect">
<allow attributes="bisect_left bisect_right bisect insort_left
insort_right insort" />
Modified: Zope3/trunk/src/zope/security/examples/sandbox.py
===================================================================
--- Zope3/trunk/src/zope/security/examples/sandbox.py 2004-11-01 19:03:56 UTC (rev 28311)
+++ Zope3/trunk/src/zope/security/examples/sandbox.py 2004-11-01 19:15:30 UTC (rev 28312)
@@ -15,7 +15,7 @@
$Id$
"""
-import time, whrandom
+import time, random
from zope.interface import Interface, implements
@@ -263,7 +263,7 @@
def WanderLust(agent):
""" is agent ready to move """
- if int(whrandom.random()*100) <= 30:
+ if int(random.random()*100) <= 30:
return 1
def GreenerPastures(agent):
@@ -271,7 +271,7 @@
global _homes
possible_homes = _homes.keys()
possible_homes.remove(agent.getHome().getId())
- return _homes.get(whrandom.choice(possible_homes))
+ return _homes.get(random.choice(possible_homes))
# boot strap initial setup.
Modified: Zope3/trunk/src/zope/security/examples/sandbox_security.py
===================================================================
--- Zope3/trunk/src/zope/security/examples/sandbox_security.py 2004-11-01 19:03:56 UTC (rev 28311)
+++ Zope3/trunk/src/zope/security/examples/sandbox_security.py 2004-11-01 19:15:30 UTC (rev 28312)
@@ -189,11 +189,11 @@
def GreenerPastures(agent):
""" where do they want to go today """
- import whrandom
+ import random
_homes = sandbox._homes
possible_homes = _homes.keys()
possible_homes.remove(agent.getHome().getId())
- new_home = _homes.get(whrandom.choice(possible_homes))
+ new_home = _homes.get(random.choice(possible_homes))
return checker.selectChecker(new_home).proxy(new_home)
sandbox.GreenerPastures = GreenerPastures
More information about the Zope3-Checkins
mailing list