Project

General

Profile

« Previous | Next » 

Revision 4491

Replaced str() with strings.ustr() (or equivalent) everywhere needed, to avoid future UnicodeEncodeErrors

View differences:

util.py
4 4

  
5 5
import dicts
6 6
import objects
7
import strings
7 8

  
8 9
#### Function wrappers for statements
9 10

  
......
25 26

  
26 27
class ConstraintError(ValueError):
27 28
    def __init__(self, check_func, value):
28
        ValueError.__init__(self, str(value)+' must satisfy constraint '
29
            +check_func.__name__)
29
        ValueError.__init__(self, strings.ustr(value)
30
            +' must satisfy constraint '+check_func.__name__)
30 31

  
31 32
def cast(type_, val):
32 33
    '''Passes None through. Does not cast a subclass to a superclass (which
......
223 224
    
224 225
    def __getitem__(self, key): return self.list[self.key_idxs[key]]
225 226
    
226
    def __str__(self): return '{\n'+(''.join(str(k)+': '+str(v)+'\n'
227
        for k, v in zip(self.keys, self.list)))+'}\n'
227
    def __str__(self): return '{\n'+(''.join(strings.ustr(k)+': '
228
        +strings.ustr(v)+'\n' for k, v in zip(self.keys, self.list)))+'}\n'
228 229

  
229 230
#### Named tuples
230 231

  

Also available in: Unified diff