Author: mtredinnick
Date: 2007-08-11 00:23:19 -0500 (Sat, 11 Aug 2007)
New Revision: 5834

Modified:
   django/trunk/django/db/backends/postgresql/base.py
   django/trunk/tests/regressiontests/model_regress/models.py
Log:
Fixed #5134 -- Return empty strings as Unicode in psycopg1 backend.


Modified: django/trunk/django/db/backends/postgresql/base.py
===================================================================
--- django/trunk/django/db/backends/postgresql/base.py  2007-08-09 14:47:49 UTC 
(rev 5833)
+++ django/trunk/django/db/backends/postgresql/base.py  2007-08-11 05:23:19 UTC 
(rev 5834)
@@ -278,7 +278,7 @@
     """
     Cast all returned strings to unicode strings.
     """
-    if not s:
+    if not s and not isinstance(s, str):
         return s
     return smart_unicode(s)
 

Modified: django/trunk/tests/regressiontests/model_regress/models.py
===================================================================
--- django/trunk/tests/regressiontests/model_regress/models.py  2007-08-09 
14:47:49 UTC (rev 5833)
+++ django/trunk/tests/regressiontests/model_regress/models.py  2007-08-11 
05:23:19 UTC (rev 5834)
@@ -10,6 +10,7 @@
     headline = models.CharField(max_length=100, default='Default headline')
     pub_date = models.DateTimeField()
     status = models.IntegerField(blank=True, null=True, choices=CHOICES)
+    misc_data = models.CharField(max_length=100, blank=True)
 
     class Meta:
         ordering = ('pub_date','headline')
@@ -30,5 +31,10 @@
 >>> a.save()
 >>> a.get_status_display() is None
 True
+
+Empty strings should be returned as Unicode
+>>> a2 = Article.objects.get(pk=a.id)
+>>> a2.misc_data
+u''
 """
 }


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to