예제 #1
0
 def _create_objects_from_row(self, row):
     raise_if_exists(Room, id=row['roomid'])
     location = get_object_or_fail(Location, id=row['locationid'])
     attributes = dict([attr.split('=', 1) for attr in row.get('attr', [])])
     room = Room(id=row['roomid'], location=location,
                 description=row['descr'], data=attributes)
     try:
         room.position = row['position']
     except (ValidationError, ValueError):
         raise InvalidValue(row['position'])
     return [room]
예제 #2
0
 def _create_objects_from_row(self, row):
     raise_if_exists(Room, id=row['roomid'])
     if row['locationid']:
         location = get_object_or_fail(Location, id=row['locationid'])
     else:
         location = None
     attributes = dict([attr.split('=', 1) for attr in row.get('attr', [])])
     room = Room(id=row['roomid'], location=location,
                 description=row['descr'], data=attributes)
     try:
         room.position = row['position']
     except (ValidationError, ValueError):
         raise InvalidValue(row['position'])
     return [room]
예제 #3
0
    def setUp(self):
        self.room = room = Room()
        room.id = 'Pegasus'
        room.description = 'room description'
        room.location = Location()
        room.location.id = 'galaxy'
        room.location.description = 'In a galaxy far far away'

        self.category_gw = Category(id='GW')