diff options
| author | Eli Collins <elic@assurancetechnologies.com> | 2011-07-11 10:19:42 -0400 |
|---|---|---|
| committer | Eli Collins <elic@assurancetechnologies.com> | 2011-07-11 10:19:42 -0400 |
| commit | 0e56599c0ece0c134c1a94fed181eb8748ddc546 (patch) | |
| tree | ae021a97607b2f505a1bc98fede15c94a293c347 /passlib/context.py | |
| parent | 3ef80daaa8926b9df2caa98d33963629333653a0 (diff) | |
| download | passlib-0e56599c0ece0c134c1a94fed181eb8748ddc546.tar.gz | |
ConfigParser deprecation tweaks
* Py3.2 renamed SafeConfigParser -> ConfigParser, we now import that to silence deprecation warnings
* Py3.2 deprecated parser.readfp() in favor of read_file()
* added py3k_lang, py32_lang constants to simplify future checks
Diffstat (limited to 'passlib/context.py')
| -rw-r--r-- | passlib/context.py | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/passlib/context.py b/passlib/context.py index d638ce0..986f015 100644 --- a/passlib/context.py +++ b/passlib/context.py @@ -3,13 +3,19 @@ #imports #========================================================= from __future__ import with_statement +from passlib.utils import py32_lang #core from cStringIO import StringIO # Py2k # - #note: importing this to handle passlib 1.4 / earlier files -from ConfigParser import ConfigParser, InterpolationSyntaxError -# end Py2k # -from ConfigParser import SafeConfigParser + #note: importing ConfigParser to handle passlib 1.4 / earlier files +from ConfigParser import SafeConfigParser,ConfigParser,InterpolationSyntaxError +# Py3k # +#if py32_lang: +# #Py3.2 removed old ConfigParser, put SafeConfigParser in it's place +# from ConfigParser import ConfigParser as SafeConfigParser +#else: +# from ConfigParser import SafeConfigParser +# end Py3k # import inspect import re import hashlib @@ -251,7 +257,11 @@ class CryptPolicy(object): # end Py2k # p = SafeConfigParser() - p.readfp(stream, filename or "<???>") + if py32_lang: + # Py3.2 deprecated readfp + p.read_file(stream, filename or "<???>") + else: + p.readfp(stream, filename or "<???>") # Py2k # try: |
