Changeset 2952
- Timestamp:
- 02/22/07 17:40:21 (2 years ago)
- Files:
-
- sandbox/mscott/SchevoPylonsNav/trunk/schevopylonsnav/controllers/transactions.py (modified) (1 diff)
- sandbox/mscott/SchevoPylonsNav/trunk/schevopylonsnav/templates/transactions/edit.html (modified) (1 diff)
- sandbox/mscott/SchevoPylonsNav/trunk/schevopylonsnav/tests/functional/test_transactions.py (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
sandbox/mscott/SchevoPylonsNav/trunk/schevopylonsnav/controllers/transactions.py
r2951 r2952 30 30 # h.form(h.url_for('transaction', id=ID), method='put') 31 31 # url_for('transaction', id=ID) 32 pass 32 postvars = request.POST 33 tx = g.tx_cache[id] 34 for field_name, field in tx.sys.field_map().iteritems(): 35 if field_name in postvars: 36 value = postvars[field_name] 37 setattr(tx, field_name, value) 38 return redirect_to(h.url_for('transaction', id=id)) 33 39 34 40 def delete(self, id): sandbox/mscott/SchevoPylonsNav/trunk/schevopylonsnav/templates/transactions/edit.html
r2951 r2952 16 16 17 17 <%def name="fields()"> 18 <ul> 19 % for name, field in c.tx.sys.field_map().iteritems(): 20 <li> 21 <label for="${name}"> 22 ${h.label(field)} 23 </label> 24 <span id="${name}" class="value"> 25 ${field.value} 26 </span> 27 </li> 28 % endfor 29 </ul> 18 <form method="post" action="${h.url_for('transaction', id=c.tx_id)}"> 19 <input type="hidden" name="_method" value="PUT" /> 20 21 <ul> 22 % for name, field in c.tx.sys.field_map().iteritems(): 23 <li> 24 <label for="f_${name}"> 25 ${h.label(field)} 26 </label> 27 <span class="value"> 28 <input type="text" id="f_${name}" name="${name}" 29 value="${field.value}" /> 30 </span> 31 </li> 32 % endfor 33 </ul> 34 35 <div> 36 <input type="submit" value="Save" /> 37 </div> 38 </form> 39 30 40 </%def> 31 41 sandbox/mscott/SchevoPylonsNav/trunk/schevopylonsnav/tests/functional/test_transactions.py
r2951 r2952 21 21 # Call it to get the transaction. 22 22 response = response.follow() 23 # Find the edit button .23 # Find the edit button and click it. 24 24 assert 'Edit' in response 25 # Click it.26 25 form = response.forms[0] 27 26 response = form.submit() 27 28 def test_update(self): 29 # Get the transaction. 30 response = self.app.post( 31 url_for('extent_call_transaction', db_id='db', extent_id='Foo', 32 id='create')) 33 # Call it to get the transaction. 34 response = response.follow() 35 # Find the edit button and click it. 36 assert 'Edit' in response 37 form = response.forms[0] 38 response = form.submit() 39 # Find the bar field and edit it. 40 form = response.forms[0] 41 bar = form.fields['bar'][0] 42 assert bar.value == u'' 43 bar.value = 'newvalue123' 44 # Save the form and follow its redirection. 45 response = form.submit() 46 response = response.follow() 47 # The new value should now be on the page. 48 assert 'newvalue123' in response
