[Twisted-Python] Re: [Twisted-commits] r15274 - Significantly improve twisted.python.filepath, adding several new features and tests.
On 02/12/05, Glyph Lefkowitz <glyph@wolfwood.twistedmatrix.com> wrote:
Author: glyph Date: Thu Dec 1 14:47:17 2005 New Revision: 15274
Modified: trunk/twisted/python/filepath.py trunk/twisted/test/test_paths.py Log: Significantly improve twisted.python.filepath, adding several new features and tests. <snip> Modified: trunk/twisted/python/filepath.py ============================================================================== --- trunk/twisted/python/filepath.py (original) +++ trunk/twisted/python/filepath.py Thu Dec 1 14:47:17 2005 @@ -5,6 +5,10 @@ from __future__ import generators
import os +import errno +import base64 +import sha + from os.path import isabs, exists, normpath, abspath, splitext from os.path import basename, dirname from os.path import join as joinpath @@ -25,8 +29,13 @@ class InsecurePath(Exception): pass
+def _secureEnoughString(): + """ + Create a pseudorandom, 16-character string for use in secure filenames. + """ + return base64.urlsafe_b64encode(sha.new(os.urandom(64)).digest())[:16] + <snip>
This breaks Twisted. base64.urlsafe_b64encode is not available in Python before version 2.4. cheers, jml
participants (1)
-
Jonathan Lange