Re: PostgreSQL warnings filling up the logs with PickleCol

Oleg Broytman <[email protected]>
Newsgroups gmane.comp.python.sqlobject
Message-ID <[email protected]>
Ok, found the problem - str() removes one level of backslashes so I have
to double backslashes once again. See the attached patch - it passes all
tests.

Oleg.
-- 
     Oleg Broytman            http://phdru.name/            [email protected]
           Programmers don't die, they just GOSUB without RETURN.

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/

_______________________________________________
sqlobject-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss
pgconnection.py.patch (text/x-diff, 668 B)
Index: pgconnection.py
===================================================================
--- pgconnection.py	(revision 4535)
+++ pgconnection.py	(working copy)
@@ -359,4 +359,12 @@
 # Converter for psycopg Binary type.
 def PsycoBinaryConverter(value, db):
     assert db == 'postgres'
-    return str(value)
+    value = str(value)
+    if ('\\' in value):
+        if value.startswith("'") and value[-8:].lower().endswith("'::bytea"):
+            value = value[1:-8]
+        elif value.startswith("'") and value.endswith("'"):
+            value = value[1:-1]
+        value = value.replace('\\', '\\\\')
+        return "E'%s'::bytea" % value
+    return value
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.