Changeset 4885

Show
Ignore:
Timestamp:
07/03/08 17:28:59 (6 months ago)
Author:
chrisz
Message:

Make view.base cope with the case where format is not a string (but e.g. a kid.HTMLSerializer object).

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/1.0/turbogears/view/base.py

    r4789 r4885  
    129129                if isinstance(content_format, (tuple, list)): 
    130130                    content_format = content_format[0] 
    131                 content_format = content_format.split()[0].split('-' , 1)[0] 
     131                if isinstance(content_format, str): 
     132                    content_format = content_format.split( 
     133                        )[0].split('-' , 1)[0].lower() 
     134                else: 
     135                    content_format = 'html' 
    132136            else: 
    133137                content_format = 'html' 
  • branches/1.1/turbogears/view/base.py

    r4789 r4885  
    134134                if isinstance(content_format, (tuple, list)): 
    135135                    content_format = content_format[0] 
    136                 content_format = content_format.split()[0].split('-' , 1)[0] 
     136                if isinstance(content_format, str): 
     137                    content_format = content_format.split( 
     138                        )[0].split('-' , 1)[0].lower() 
     139                else: 
     140                    content_format = 'html' 
    137141            else: 
    138142                content_format = 'html'