Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 17 additions & 13 deletions droopy
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Copyright 2008-2013 (c) Pierre Duquesne <stackp@online.fr>
Licensed under the New BSD License.

Changelog
20250918 * Update DroopyFieldStorage __init__ args to be compatible with py 3.11+
20190628 * Added multi-user support
20190614 * Added various file sort options
20151025 * Global variables removed
Expand Down Expand Up @@ -173,26 +174,29 @@ class DroopyFieldStorage(cgi.FieldStorage):

# Would love to do a **kwargs job here but cgi has some recursive
# magic that passes all possible arguments positionally..
def __init__(self, fp=None, headers=None, outerboundary=b'',
environ=os.environ, keep_blank_values=0, strict_parsing=0,
limit=None, encoding='utf-8', errors='replace',
directory='.'):
# def __init__(self, fp=None, headers=None, outerboundary=b'',
# environ=os.environ, keep_blank_values=0, strict_parsing=0,
# limit=None, encoding='utf-8', errors='replace',
# directory='.'):

def __init__(self, *args, directory='.', **kwargs):
self.directory = directory
super().__init__(*args, **kwargs)
"""
Adds 'directory' argument to FieldStorage.__init__.
Retains compatibility with FieldStorage.__init__ (which involves magic)
"""
self.directory = directory
# Not only is cgi.FieldStorage full of magic, it's DIFFERENT
# magic in Py2/Py3. Here's a case of the core library making
# life difficult, in a class that's *supposed to be subclassed*!
if sys.version_info > (3,):
cgi.FieldStorage.__init__(self, fp, headers, outerboundary,
environ, keep_blank_values,
strict_parsing, limit, encoding, errors)
else:
cgi.FieldStorage.__init__(self, fp, headers, outerboundary,
environ, keep_blank_values,
strict_parsing)
#if sys.version_info > (3,):
# cgi.FieldStorage.__init__(self, fp, headers, outerboundary,
# environ, keep_blank_values,
# strict_parsing, limit, encoding, errors)
#else:
# cgi.FieldStorage.__init__(self, fp, headers, outerboundary,
# environ, keep_blank_values,
# strict_parsing)

# Binary is passed in Py2 but not Py3.
def make_file(self, binary=None):
Expand Down