Ignore:
Timestamp:
02/15/13 15:34:25 (7 years ago)
Author:
jukka
Message:

Small fixes to unicode and parsing errors.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/PILOTMaterial.py

    r3148 r3247  
    114114    def getOnlyText(self): 
    115115        """ bodyTexts index_method: goes through all text fields in body text and concatenates them to a mass of text suitable for indexing """ 
    116         return u'\n'.join([item['text'] for item in self.getBodyText()]) 
     116        def flat_list(itemlist): 
     117            listed=[] 
     118            for item in itemlist: 
     119                if isinstance(item, list) or isinstance(item, tuple): 
     120                    listed+=flat_list(item) 
     121                elif isinstance(item, dict): 
     122                    listed+=flat_list(item.values()) 
     123                else: 
     124                    listed.append(item) 
     125            return listed 
     126         
     127        return u'\n'.join(flat_list(self.getBodyText())) 
    117128 
    118129    def getQuestions(self): 
Note: See TracChangeset for help on using the changeset viewer.