Hi Ben -
Here's my suggestion for a patch on this, such that the variance in
the function's availability is centralized and documented (thus
preventing someone else from removing it like I did !)
diff -r eb6cff7e8a17 beaker/session.py
--- a/beaker/session.py Tue Aug 19 16:42:19 2008 -0700
+++ b/beaker/session.py Sun Aug 24 14:57:22 2008 -0400
@@ -18,7 +18,7 @@
from beaker.cache import clsmap
from beaker.exceptions import BeakerException
-from beaker.util import b64decode, b64encode, Set
+from beaker.util import b64decode, b64encode, Set, getpid
__all__ = ['SignedCookie', 'Session']
@@ -100,7 +100,7 @@
def _create_id(self):
self.id = md5.new(
- md5.new("%f%s%f%s" % (time.time(), id({}),
random.random(), os.getpid()) ).hexdigest(),
+ md5.new("%f%s%f%s" % (time.time(), id({}),
random.random(), getpid()) ).hexdigest(),
).hexdigest()
self.is_new = True
if self.use_cookies:
@@ -353,7 +353,7 @@
def _make_id(self):
return md5.new(md5.new(
- "%f%s%f%d" % (time.time(), id({}), random.random(),
os.getpid())
+ "%f%s%f%d" % (time.time(), id({}), random.random(),
getpid())
).hexdigest()
).hexdigest()
diff -r eb6cff7e8a17 beaker/util.py
--- a/beaker/util.py Tue Aug 19 16:42:19 2008 -0700
+++ b/beaker/util.py Sun Aug 24 14:57:22 2008 -0400
@@ -13,6 +13,13 @@
import string
import types
import weakref
+
+if hasattr(os, 'getpid'):
+ getpid = os.getpid
+else:
+ # os.getpid not supported on GAE
+ def getpid():
+ return ''
try:
Set = set
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"pylons-discuss" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/pylons-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---