Changeset 623 for WAeUP_SRP/trunk
- Timestamp:
- 8 Oct 2006, 17:06:18 (18 years ago)
- Location:
- WAeUP_SRP/trunk
- Files:
-
- 1 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
WAeUP_SRP/trunk/Accommodation.py
r622 r623 11 11 from Products.CPSCore.CPSBase import CPSBaseBTreeFolder as BaseBTreeFolder 12 12 from Products.WAeUP_SRP.WAeUPTables import AccommodationTable 13 import Globals 14 import DateTime 15 p_home = Globals.package_home(globals()) 16 i_home = Globals.INSTANCE_HOME 13 17 14 18 class AccoFolder(CPSDocument): ###( … … 30 34 generate the free Bedslist. 31 35 """ 32 freelist = AccommodationTable()33 l = self.portal_catalog({'meta_type': "Acco mmodation"})36 freelist = self.portal_accommodation 37 l = self.portal_catalog({'meta_type': "AccoHall"}) 34 38 halls = [] 39 generated = [] 40 generated.append('"Bed","BedType","Student"' % vars()) 35 41 for h in l: 36 42 halls.append(h.getObject()) 37 43 for hall in halls: 44 #import pdb;pdb.set_trace() 38 45 h = hall.getContent() 39 46 reserved = [int(r) for r in h.reserved_rooms.split()] … … 47 54 for bed in 'ABCDEFGH'[:int(h.beds_per_room)]: 48 55 room_nr = floor*100 + room 56 bt = 'xx' 49 57 if room_nr in reserved: 50 print room_nr 51 continue 52 bt = 'xx' 53 if bed in h.beds_for_fresh: 58 bt = "reserved" 59 elif bed in h.beds_for_fresh: 54 60 bt = 'fr' 55 61 elif bed in h.beds_for_returning: … … 58 64 bt = 'fi' 59 65 bt = "%(sex)s_%(bt)s" % vars() 60 uid = '%s_%d_% s' % (hall.getId(),room_nr,bed)66 uid = '%s_%d_%d_%s' % (hall.getId(),block,room_nr,bed) 61 67 print bt,uid 62 freelist.addRecord(bed = uid) 63 try: 64 freelist.modifyRecord(uid, bed = bed, bed_type = bt) 65 except ValueError,e: 66 freelist.deleteRecord(uid) 67 68 freelist.addRecord(bed = uid, bed_type = bt, student= '') 69 generated.append('"%(uid)s","%(bt)s"' % vars()) 70 current = DateTime.DateTime().strftime("%d-%m-%y_%H_%M_%S") 71 open("%s/import/bedlist_%s.csv" % (i_home,current),"w+").write('\n'.join(generated)) 68 72 return self.accommodation.academics_contents() 69 73 -
WAeUP_SRP/trunk/profiles/default/types/AccoFolder.xml
r622 r623 35 35 <permission value="View"/> 36 36 </action> 37 37 <action title="Add Accommodation Hall" action_id="new_entry" 38 38 category="object" condition_expr="" 39 39 url_expr="string:${object_url}/content_create?type_name=AccoHall" 40 visible="True"> 41 <permission value="Modify portal content"/> 42 </action> 43 <action title="Generate Bedslist" action_id="new_list" 44 category="object" condition_expr="" 45 url_expr="string:${object_url}/generateFreeBedsList" 40 46 visible="True"> 41 47 <permission value="Modify portal content"/>
Note: See TracChangeset for help on using the changeset viewer.