Ejemplo n.º 1
0
 def database_column_name(self):
     """
     Column name going into the database - needs to be truncated according to db limitations
     """
     # we have to explicitly truncate the column IDs otherwise postgres will do it
     # and will choke on them if there are duplicates: http://manage.dimagi.com/default.asp?175495
     return truncate_value(self.id)
Ejemplo n.º 2
0
 def database_column_name(self):
     """
     Column name going into the database - needs to be truncated according to db limitations
     Returns bytes
     """
     # we have to explicitly truncate the column IDs otherwise postgres will do it
     # and will choke on them if there are duplicates: http://manage.dimagi.com/default.asp?175495
     return truncate_value(self.id).encode('utf-8')
Ejemplo n.º 3
0
 def database_column_name(self):
     """
     Column name going into the database - needs to be truncated according to db limitations
     """
     return truncate_value(self.id)
Ejemplo n.º 4
0
 def test_truncate_value_left(self):
     value = 'string to truncate'
     truncated = truncate_value(value, max_length=len(value) - 1)
     self.assertEqual(truncated, 'truncate_849f01fd')
Ejemplo n.º 5
0
 def test_truncate_value_unicode_right(self):
     value = '\u00e8 string to truncate\u00e8'
     truncated = truncate_value(value, max_length=len(value) - 1, from_left=False)
     self.assertEqual(truncated, '\\xe8 string_6be7bea3')
Ejemplo n.º 6
0
 def test_truncate_value_unicode_left(self):
     value = '\u00e8 string to truncate\u00e8'
     truncated = truncate_value(value, max_length=len(value) - 1)
     self.assertEqual(truncated, 'runcate\\xe8_6be7bea3')
Ejemplo n.º 7
0
 def test_truncate_value_right(self):
     value = 'string to truncate'
     truncated = truncate_value(value, max_length=len(value) - 1, from_left=False)
     self.assertEqual(truncated, 'string t_849f01fd')
Ejemplo n.º 8
0
 def test_truncate_value_left(self):
     value = 'string to truncate'
     truncated = truncate_value(value, max_length=len(value) - 1)
     self.assertEqual(truncated, 'truncate_849f01fd')
Ejemplo n.º 9
0
 def test_truncate_value_unicode_right(self):
     value = '\u00e8 string to truncate\u00e8'
     truncated = truncate_value(value,
                                max_length=len(value) - 1,
                                from_left=False)
     self.assertEqual(truncated, '\\xe8 string_6be7bea3')
Ejemplo n.º 10
0
 def test_truncate_value_unicode_left(self):
     value = '\u00e8 string to truncate\u00e8'
     truncated = truncate_value(value, max_length=len(value) - 1)
     self.assertEqual(truncated, 'runcate\\xe8_6be7bea3')
Ejemplo n.º 11
0
 def test_truncate_value_right(self):
     value = 'string to truncate'
     truncated = truncate_value(value,
                                max_length=len(value) - 1,
                                from_left=False)
     self.assertEqual(truncated, 'string t_849f01fd')
Ejemplo n.º 12
0
 def database_column_name(self):
     """
     Column name going into the database - needs to be truncated according to db limitations
     """
     return truncate_value(self.id)