Changeset 411 for WAeUP_SRP/trunk


Ignore:
Timestamp:
23 Aug 2006, 20:19:01 (18 years ago)
Author:
joachim
Message:

added AccomodationTable? again

Location:
WAeUP_SRP/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • WAeUP_SRP/trunk/Accommodation.py

    r407 r411  
    3333            h = hall.getContent()
    3434            reserved = [int(r) for r in h.reserved_rooms.split()]
     35            print h.which_sex
     36            sex = 'male'
     37            if h.which_sex:
     38                sex = 'female'
    3539            for block in range(1,int(h.nr_of_blocks)):
    3640                for floor in range(1,int(h.nr_of_floors)):
     
    4852                            elif bed in h.beds_for_final:
    4953                                bt = 'fi'
    50                             print bt
    51                             freelist.addRecord(bed = '%s_%d_%s' % (h.getId(),room_nr,bed),
    52                                                bed_type = bt)
     54                            bt = "%(sex)s_%(bt)s" % vars() 
     55                            uid = '%s_%d_%s' % (hall.getId(),room_nr,bed)
     56                            print bt,uid
     57                            freelist.addRecord(bed = uid)
     58                            try:
     59                                freelist.modifyRecord(uid, bed = bed, bed_type = bt)
     60                            except ValueError,e:
     61                                freelist.deleteRecord(uid)
     62                   
    5363        return self.accommodation.academics_contents()
    5464
  • WAeUP_SRP/trunk/WAeUPTables.py

    r404 r411  
    7676
    7777InitializeClass(AccommodationTable)
     78
     79class AccomodationTable(WAeUPTable):
     80   
     81    meta_type = 'WAeUP Accomodation Tool'
     82   
     83    def __init__(self):
     84        WAeUPTable.__init__(self, 'portal_accommodation')
     85
     86    def addRecord(self, **data):
     87        # The uid is the same as "bed".
     88        uid = data['bed']
     89        self.catalog_object(dict2ob(data), uid=uid)
     90        return uid
     91
     92
     93InitializeClass(AccomodationTable)
Note: See TracChangeset for help on using the changeset viewer.