Changeset 6470 for main/waeup.sirp/trunk/src
- Timestamp:
- 23 Jun 2011, 12:31:09 (13 years ago)
- Location:
- main/waeup.sirp/trunk/src/waeup/sirp
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.sirp/trunk/src/waeup/sirp/accesscodes/accesscodes.py
r6458 r6470 52 52 53 53 @property 54 def stat us(self):54 def state(self): 55 55 return IWorkflowState(self).getState() 56 56 … … 166 166 ) 167 167 writer = csv.writer(open(csv_path, 'w'), quoting=csv.QUOTE_ALL) 168 writer.writerow(['prefix', 'serial', 'ac', 'stat us', 'history'])168 writer.writerow(['prefix', 'serial', 'ac', 'state', 'history']) 169 169 writer.writerow([self.prefix, '%0.2f' % self.cost, str(self.num), 170 170 str(self.entry_num)]) … … 175 175 writer.writerow([ 176 176 self.prefix, value.batch_serial, value.representation, 177 value.stat us, value.history177 value.state, value.history 178 178 ]) 179 179 return os.path.basename(csv_path) … … 251 251 252 252 # This is temporary reimport solution. Access codes will be imported 253 # with stat usinitialized no matter if they have been used before.253 # with state initialized no matter if they have been used before. 254 254 def reimport(self, filename, creator=u'UNKNOWN'): 255 255 """Reimport a batch given in CSV file. -
main/waeup.sirp/trunk/src/waeup/sirp/accesscodes/browser.txt
r6454 r6470 306 306 ... sorted(os.listdir(ac_storage))[-2]) 307 307 >>> print open(archive_file, 'rb').read() 308 "prefix","serial","ac","stat us","history"308 "prefix","serial","ac","state","history" 309 309 "BLA","19.12","1","3" 310 310 "BLA","0","BLA-1-<10-DIGITS>","initialized","..." -
main/waeup.sirp/trunk/src/waeup/sirp/accesscodes/browser_templates/searchpage.pt
r6460 r6470 25 25 <tr> 26 26 <th> </th> 27 <th width="50px">Serial</th><th>AC</th><th>Stat us</th><th>History</th>27 <th width="50px">Serial</th><th>AC</th><th>State</th><th>History</th> 28 28 </tr> 29 29 </thead> … … 34 34 <td tal:content="item/batch_serial">1</td> 35 35 <td tal:content="item/code">APP-1-1234567890</td> 36 <td tal:content="item/stat us">unused</td>36 <td tal:content="item/state">unused</td> 37 37 <td tal:content="structure python:item.history.replace('||','<br />')"> 38 38 history -
main/waeup.sirp/trunk/src/waeup/sirp/accesscodes/catalog.py
r6452 r6470 18 18 history = grok.index.Text(attribute='history') 19 19 batch_serial = grok.index.Field(attribute='batch_serial') 20 stat us = grok.index.Field(attribute='status')20 state = grok.index.Field(attribute='state') 21 21 22 22 class AccessCodeQueryResultItem(object): … … 28 28 self.code = context.representation 29 29 self.history = context.history 30 self.stat us = context.status30 self.state = context.state 31 31 self.batch_serial = context.batch_serial 32 32 -
main/waeup.sirp/trunk/src/waeup/sirp/accesscodes/interfaces.py
r6452 r6470 24 24 default = 0.0, min = 0.0, 25 25 ) 26 stat us= schema.TextLine(27 title = u'Workflow stat us',26 state = schema.TextLine( 27 title = u'Workflow state', 28 28 ) 29 29 representation = schema.TextLine( -
main/waeup.sirp/trunk/src/waeup/sirp/accesscodes/tests/test_accesscodes.py
r6459 r6470 106 106 107 107 def test_invalidate_accesscode(self): 108 assert self.ac1.stat us!= USED108 assert self.ac1.state != USED 109 109 result = invalidate_accesscode('APP-1-11111111') 110 assert self.ac1.stat us== USED110 assert self.ac1.state == USED 111 111 assert result is True 112 112 113 113 def test_disable_accesscode_unused(self): 114 114 # we can disable initialized acs 115 assert self.ac1.stat us!= USED115 assert self.ac1.state != USED 116 116 disable_accesscode('APP-1-11111111') 117 assert self.ac1.stat us== DISABLED117 assert self.ac1.state == DISABLED 118 118 119 119 def test_disable_accesscode_used(self): 120 120 # we can disable already used acs 121 assert self.ac1.stat us!= DISABLED121 assert self.ac1.state != DISABLED 122 122 invalidate_accesscode('APP-1-11111111') 123 123 disable_accesscode('APP-1-11111111') 124 assert self.ac1.stat us== DISABLED124 assert self.ac1.state == DISABLED 125 125 126 126 def test_reenable_accesscode(self): … … 129 129 result = reenable_accesscode('APP-1-11111111') 130 130 assert result is True 131 assert self.ac1.stat us!= USED131 assert self.ac1.state != USED 132 132 133 133 def test_fire_transition(self): -
main/waeup.sirp/trunk/src/waeup/sirp/accesscodes/tests/test_catalog.py
r6452 r6470 110 110 # Now we want to find the disabled access code 111 111 cat = queryUtility(ICatalog, name='accesscodes_catalog') 112 results1 = cat.searchResults(stat us=('disabled', 'disabled'))113 results2 = cat.searchResults(stat us=('initialized', 'initialized'))112 results1 = cat.searchResults(state=('disabled', 'disabled')) 113 results2 = cat.searchResults(state=('initialized', 'initialized')) 114 114 results1 = [x for x in results1] # Turn results generator into list 115 115 # We found 1 accescode disabled … … 125 125 # Now we want to find the invalidated access code 126 126 cat = queryUtility(ICatalog, name='accesscodes_catalog') 127 results1 = cat.searchResults(stat us=('used', 'used'))128 results2 = cat.searchResults(stat us=('initialized', 'initialized'))127 results1 = cat.searchResults(state=('used', 'used')) 128 results2 = cat.searchResults(state=('initialized', 'initialized')) 129 129 results1 = [x for x in results1] # Turn results generator into list 130 130 # We found 1 accescode used … … 145 145 # exactly one access code. 146 146 results = cat.searchResults(history='Tester', 147 stat us=('used', 'used'),147 state=('used', 'used'), 148 148 code=('APP-1-11111111', 'APP-1-22222222')) 149 149 assert len(results) == 1 … … 154 154 # immediately in catalog 155 155 cat = queryUtility(ICatalog, name='accesscodes_catalog') 156 result = cat.searchResults(stat us=('used', 'used'))156 result = cat.searchResults(state=('used', 'used')) 157 157 assert len(result) == 0 158 158 invalidate_accesscode('APP-1-11111111') 159 result = cat.searchResults(stat us=('used', 'used'))159 result = cat.searchResults(state=('used', 'used')) 160 160 assert len(result) == 1 -
main/waeup.sirp/trunk/src/waeup/sirp/applicants/authentication.py
r6465 r6470 228 228 if ac is None: 229 229 return None 230 if ac.stat us== 'disabled':231 return None 232 if ac.stat us== 'used' and appl_ac != ac.representation:230 if ac.state == 'disabled': 231 return None 232 if ac.state == 'used' and appl_ac != ac.representation: 233 233 return None 234 234 if appl_ac is not None and appl_ac != ac.representation: -
main/waeup.sirp/trunk/src/waeup/sirp/applicants/browser.py
r6469 r6470 426 426 427 427 # Mark pin as used (this also fires a pin related transition) 428 if get_access_code(pin).stat us== USED:428 if get_access_code(pin).state == USED: 429 429 pass 430 430 else: -
main/waeup.sirp/trunk/src/waeup/sirp/applicants/browser_templates/applicantscontainermanagepage.pt
r6461 r6470 65 65 <th>ID 66 66 </th> 67 <th>stat us67 <th>state 68 68 </th> 69 69 </tr> -
main/waeup.sirp/trunk/src/waeup/sirp/applicants/tests/test_authentication.py
r6452 r6470 50 50 51 51 class FakeAccessCode(object): 52 def __init__(self, repr, stat us= 'initialized'):52 def __init__(self, repr, state = 'initialized'): 53 53 self.representation = repr 54 self.stat us = status54 self.state = state 55 55 56 56 class FakeApplication(object):
Note: See TracChangeset for help on using the changeset viewer.