Example #1
0
 def insert_meta(self, group, name, field, value):
     filters.check_group(group)
     filters.check_identifier(name, 64)
     field = filters.check_name(field, maxlen=64)
     filters.check_text(value, maxlenbits=16)
     #id = self.get_object_id(group, name, create=1)
     self.db.insert(self.sitename, (group, name), ('meta', field), value)
Example #2
0
 def runTest(self):
     # try some values and conversions
     self.check_filtered_value(filters.check_text, -2.5, '-2.5')
     self.check_filtered_value(filters.check_text, '  34.2', '  34.2')
     self.check_filtered_value(filters.check_text, '\n\n5 \t', '\n\n5 \t')
     self.check_filtered_value(filters.check_text, 9, '9')
     
     # test for bad types
     self.assertRaises(filters.TypeError, filters.check_text, ['list'])
     self.assertRaises(filters.TypeError, filters.check_text, {'dict':4})
     self.assertRaises(filters.TypeError, filters.check_text, self)
     # test for proper detection of long strings
     filters.check_text('bob', maxlenbits=2)
     filters.check_text('1234567', maxlenbits=3)
     filters.check_text('b', maxlenbits=1)
     filters.check_text('', maxlenbits=0)
     self.assertRaises(filters.RangeError, filters.check_text, 'b', maxlenbits=0)
     self.assertRaises(filters.RangeError, filters.check_text, 'bob+', maxlenbits=2)
     self.assertRaises(filters.RangeError, filters.check_text, '12345678', maxlenbits=3)
     self.assertRaises(filters.RangeError, filters.check_text, '12', maxlenbits=1)