openbsd-ports/textproc/py-jaxml/patches/patch-jaxml_py
2011-06-07 18:47:59 +00:00

57 lines
2.4 KiB
Plaintext

$OpenBSD: patch-jaxml_py,v 1.1 2011/06/07 18:47:59 jasper Exp $
Assignment to __debug__, even as an attribute, is not allowed in
Python 2.7. See upstream tracker issue
<http://bugs.python.org/issue9438>. (LP: #719188)
--- jaxml.py.orig Thu Jun 26 08:59:38 2003
+++ jaxml.py Tue Jun 7 09:14:33 2011
@@ -955,13 +955,21 @@ class CGI_document(HTML_document) :
it inherits from the HTML_document class, but more methods are present
"""
- __possibleargs = {"version": "1.0", "encoding": "iso-8859-1", "content_type": "text/html", "content_disposition": "", "expires": "", "pragma": "", "redirect": "", "status": "", "statmes": "", "debug": None}
+ __possibleargs = {"version": "1.0", "encoding": "iso-8859-1", "content_type": "text/html", "content_disposition": "", "expires": "", "pragma": "", "redirect": "", "status": "", "statmes": "", "debug_file": None}
def __init__(self, **args) :
"""
Initialise local datas.
"""
HTML_document.__init__(self)
+ #translate keyword argument 'debug' to 'debug_file' to not break API
+ if args.has_key("debug") :
+ if args.has_key("debug_file"):
+ #in case both arguments 'debug' and 'debug_file' are given, the latter wins
+ args.pop("debug")
+ else :
+ args["debug_file"] = args.pop("debug")
+
for key in self.__possibleargs.keys() :
if args.has_key(key) :
value = args[key]
@@ -987,7 +995,7 @@ class CGI_document(HTML_document) :
def _set_debug(self, file) :
"""Sets the flag to send the output to a file too."""
- self.__debug__ = file
+ self.__debug_file__ = file
def _set_pragma(self, pragma) :
"""Defines the pragma value.
@@ -1145,12 +1153,12 @@ class CGI_document(HTML_document) :
def _output(self, file = "-") :
"""Prints the CGI script output to stdout or file.
- If self.__debug__ is defined it is used as a file
+ If self.__debug_file__ is defined it is used as a file
to which send the output to too.
"""
HTML_document._output(self, file)
- if self.__debug__ :
- HTML_document._output(self, self.__debug__)
+ if self.__debug_file__ :
+ HTML_document._output(self, self.__debug_file__)
class Html_document :
"""This class warns the programmer when used, and exits the program.