Renamed Document._id to id (still _id in DB)

Although MongoDB uses _id, underscore prefixed attributes imply
private access in Python and are sometimes may not be accessed
(e.g. in the Django template language), but id should be public.
This commit is contained in:
Harry Marr 2009-12-18 16:31:32 +00:00
commit 0a64f42d5f
6 changed files with 23 additions and 23 deletions

View file

@ -46,10 +46,10 @@ class FieldTest(unittest.TestCase):
name = StringField()
person = Person(name='Test User')
self.assertRaises(AttributeError, getattr, person, '_id')
self.assertRaises(ValidationError, person.__setattr__, '_id', 47)
self.assertRaises(ValidationError, person.__setattr__, '_id', 'abc')
person._id = '497ce96f395f2f052a494fd4'
self.assertRaises(AttributeError, getattr, person, 'id')
self.assertRaises(ValidationError, person.__setattr__, 'id', 47)
self.assertRaises(ValidationError, person.__setattr__, 'id', 'abc')
person.id = '497ce96f395f2f052a494fd4'
def test_string_validation(self):
"""Ensure that invalid values cannot be assigned to string fields.