[MERGE] forward port branch saas-16 up to 1b50c829ef

This commit is contained in:
Christophe Simonis
2017-06-15 18:46:47 +02:00
68 changed files with 1492 additions and 139 deletions
+13
View File
@@ -50,6 +50,19 @@ psycopg2.extensions.register_type(psycopg2.extensions.new_type((700, 701, 1700,)
from . import tools
from .tools.func import frame_codeinfo
from tools import parse_version as pv
if pv(psycopg2.__version__) < pv('2.7'):
from psycopg2._psycopg import QuotedString
def adapt_string(adapted):
"""Python implementation of psycopg/psycopg2#459 from v2.7"""
if '\x00' in adapted:
raise ValueError("A string literal cannot contain NUL (0x00) characters.")
return QuotedString(adapted)
psycopg2.extensions.register_adapter(str, adapt_string)
psycopg2.extensions.register_adapter(unicode, adapt_string)
from datetime import timedelta
import threading
from inspect import currentframe