- Timestamp:
- 10 Nov 2006, 21:15:13 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
WAeUP_SRP/trunk/WAeUPTables.py
r780 r834 41 41 setattr(ob, key, value) 42 42 return ob 43 43 44 44 45 45 class WAeUPTable(ZCatalog): 46 46 47 47 implements(IWAeUPTable) 48 48 security = ClassSecurityInfo() 49 49 50 50 def addRecord(self, **data): 51 51 # The uid is the same as "bed". … … 56 56 self.catalog_object(dict2ob(data), uid=uid) 57 57 return uid 58 58 59 59 def deleteRecord(self, uid): 60 60 #import pdb;pdb.set_trace() 61 61 self.uncatalog_object(uid) 62 62 63 63 def searchAndSetRecord(self, **data): 64 64 raise NotImplemented … … 100 100 current = DateTime.DateTime().strftime("%d-%m-%y_%H_%M_%S") 101 101 open("%s/import/%s-%s.csv" % (i_home,self.getId(),current),"w+").write('\n'.join(csv)) 102 103 102 103 104 104 class AccommodationTable(WAeUPTable): 105 105 106 106 meta_type = 'WAeUP Accommodation Tool' 107 107 name = "accommodation" … … 114 114 if len(records) > 0: 115 115 return -1,"Student with Id %s already booked bed %s" % (student_id,records[0].bed) 116 116 117 117 records = [r for r in self.searchResults({'bed_type' : bed_type}) if not r.student] 118 118 #import pdb;pdb.set_trace() 119 119 if len(records) == 0: 120 return -1," no bed of this type available"120 return -1,"No bed of this type available" 121 121 rec = records[0] 122 122 self.modifyRecord(bed=rec.bed,student=student_id) 123 123 return 1,rec.bed 124 124 125 125 126 126 InitializeClass(AccommodationTable) 127 127 128 128 class PinTable(WAeUPTable): 129 129 130 130 meta_type = 'WAeUP Pin Tool' 131 131 name = "pins" … … 140 140 if len(records) > 0: 141 141 for r in records: 142 if r.pin != uid and r.prefix_batch.startswith(prefix): 142 if r.pin != uid and r.prefix_batch.startswith(prefix): 143 143 return -2 144 144 records = self.searchResults({"%s" % self.key : uid})
Note: See TracChangeset for help on using the changeset viewer.