Changeset 2953
- Timestamp:
- 02/22/07 17:56:04 (2 years ago)
- Files:
-
- sandbox/mscott/SchevoPylonsNav/trunk/schevopylonsnav/config/routing.py (modified) (3 diffs)
- sandbox/mscott/SchevoPylonsNav/trunk/schevopylonsnav/controllers/entities.py (added)
- sandbox/mscott/SchevoPylonsNav/trunk/schevopylonsnav/controllers/transactions.py (modified) (2 diffs)
- sandbox/mscott/SchevoPylonsNav/trunk/schevopylonsnav/templates/transactions/show.html (modified) (1 diff)
- sandbox/mscott/SchevoPylonsNav/trunk/schevopylonsnav/tests/functional/test_entities.py (added)
- sandbox/mscott/SchevoPylonsNav/trunk/schevopylonsnav/tests/functional/test_transactions.py (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
sandbox/mscott/SchevoPylonsNav/trunk/schevopylonsnav/config/routing.py
r2938 r2953 21 21 map.resource('database', 'databases') 22 22 23 map.resource('query', 'queries') 24 25 map.resource('transaction', 'transactions', 26 member=dict(execute='POST'), 27 ) 28 23 29 map.resource('extent', 'extents', 24 30 path_prefix='/databases/:db_id', 25 31 ) 26 27 map.resource('query', 'queries')28 32 29 33 map.resource('query', 'queries', … … 34 38 ) 35 39 36 map.resource('transaction', 'transactions')37 38 40 map.resource('transaction', 'transactions', 39 41 controller='extent_transactions', … … 43 45 ) 44 46 47 map.resource('entity', 'entities', 48 path_prefix='/databases/:db_id/extents/:extent_id', 49 ) 50 45 51 map.connect(':controller/:action/:id') 46 52 map.connect('*url', controller='template', action='view') sandbox/mscott/SchevoPylonsNav/trunk/schevopylonsnav/controllers/transactions.py
r2952 r2953 17 17 # url_for('transactions') 18 18 pass 19 19 20 20 def new(self, format='html'): 21 21 """GET /new: Form to create a new item.""" … … 60 60 c.tx_id = id 61 61 return render_response('/transactions/edit.html') 62 63 def execute(self, id): 64 """POST /id;execute: Execute a transaction.""" 65 # url_for('execute_transaction', id=ID) 66 tx = g.tx_cache[id] 67 sandbox/mscott/SchevoPylonsNav/trunk/schevopylonsnav/templates/transactions/show.html
r2950 r2953 33 33 <input type="submit" value="Edit" /> 34 34 </form> 35 36 <form method="post" action="${h.url_for('execute_transaction', id=c.tx_id)}"> 37 <input type="submit" value="Execute" /> 38 </form> 35 39 </%def> sandbox/mscott/SchevoPylonsNav/trunk/schevopylonsnav/tests/functional/test_transactions.py
r2952 r2953 13 13 # Bar field is shown. 14 14 assert 'Bar' in response 15 # Edit and Execute buttons are shown. 16 assert 'Edit' in response 17 assert 'Execute' in response 15 18 16 19 def test_edit(self): … … 22 25 response = response.follow() 23 26 # Find the edit button and click it. 24 assert 'Edit' in response25 27 form = response.forms[0] 26 28 response = form.submit() … … 47 49 # The new value should now be on the page. 48 50 assert 'newvalue123' in response 51 52 def test_execute(self): 53 # Get the transaction. 54 response = self.app.post( 55 url_for('extent_call_transaction', db_id='db', extent_id='Foo', 56 id='create')) 57 # Call it to get the transaction. 58 response = response.follow() 59 # Find the edit button and click it. 60 assert 'Edit' in response 61 form = response.forms[0] 62 response = form.submit() 63 # Find the bar field and edit it. 64 form = response.forms[0] 65 bar = form.fields['bar'][0] 66 assert bar.value == u'' 67 bar.value = 'newvalue123' 68 # Save the form and follow its redirection. 69 response = form.submit() 70 response = response.follow() 71 # The new value should now be on the page. 72 assert 'newvalue123' in response 73 # Execute the transaction and follow its redirection. 74 form = response.forms[1] 75 # response = form.submit() 76 # print dir(response) 77 # response = response.follow() 78
