Django

Code

Changeset 5834

Show
Ignore:
Timestamp:
08/11/07 00:23:19 (1 year ago)
Author:
mtredinnick
Message:

Fixed #5134 -- Return empty strings as Unicode in psycopg1 backend.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/trunk/django/db/backends/postgresql/base.py

    r5609 r5834  
    279279    Cast all returned strings to unicode strings. 
    280280    """ 
    281     if not s
     281    if not s and not isinstance(s, str)
    282282        return s 
    283283    return smart_unicode(s) 
  • django/trunk/tests/regressiontests/model_regress/models.py

    r5803 r5834  
    1111    pub_date = models.DateTimeField() 
    1212    status = models.IntegerField(blank=True, null=True, choices=CHOICES) 
     13    misc_data = models.CharField(max_length=100, blank=True) 
    1314 
    1415    class Meta: 
     
    3132>>> a.get_status_display() is None 
    3233True 
     34 
     35Empty strings should be returned as Unicode 
     36>>> a2 = Article.objects.get(pk=a.id) 
     37>>> a2.misc_data 
     38u'' 
    3339""" 
    3440}