Changeset 2954
- Timestamp:
- 02/22/07 18:46:30 (2 years ago)
- Files:
-
- sandbox/mscott/SchevoPylonsNav/trunk/schevopylonsnav/config/routing.py (modified) (3 diffs)
- sandbox/mscott/SchevoPylonsNav/trunk/schevopylonsnav/controllers/extent_q_methods.py (moved) (moved from sandbox/mscott/SchevoPylonsNav/trunk/schevopylonsnav/controllers/extent_queries.py) (5 diffs)
- sandbox/mscott/SchevoPylonsNav/trunk/schevopylonsnav/controllers/extent_t_methods.py (moved) (moved from sandbox/mscott/SchevoPylonsNav/trunk/schevopylonsnav/controllers/extent_transactions.py) (6 diffs)
- sandbox/mscott/SchevoPylonsNav/trunk/schevopylonsnav/templates/extent_queries/index.html (modified) (2 diffs)
- sandbox/mscott/SchevoPylonsNav/trunk/schevopylonsnav/templates/extent_queries/show.html (modified) (2 diffs)
- sandbox/mscott/SchevoPylonsNav/trunk/schevopylonsnav/templates/extent_transactions/index.html (modified) (2 diffs)
- sandbox/mscott/SchevoPylonsNav/trunk/schevopylonsnav/templates/extent_transactions/show.html (modified) (2 diffs)
- sandbox/mscott/SchevoPylonsNav/trunk/schevopylonsnav/templates/extents/show.html (modified) (1 diff)
- sandbox/mscott/SchevoPylonsNav/trunk/schevopylonsnav/tests/functional/test_extent_q_methods.py (moved) (moved from sandbox/mscott/SchevoPylonsNav/trunk/schevopylonsnav/tests/functional/test_extent_queries.py) (3 diffs)
- sandbox/mscott/SchevoPylonsNav/trunk/schevopylonsnav/tests/functional/test_extent_t_methods.py (moved) (moved from sandbox/mscott/SchevoPylonsNav/trunk/schevopylonsnav/tests/functional/test_extent_transactions.py) (2 diffs)
- sandbox/mscott/SchevoPylonsNav/trunk/schevopylonsnav/tests/functional/test_extents.py (modified) (1 diff)
- sandbox/mscott/SchevoPylonsNav/trunk/schevopylonsnav/tests/functional/test_transactions.py (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
sandbox/mscott/SchevoPylonsNav/trunk/schevopylonsnav/config/routing.py
r2953 r2954 31 31 ) 32 32 33 map.resource('query', 'queries', 34 controller='extent_queries', 33 map.resource('entity', 'entities', 34 path_prefix='/databases/:db_id/extents/:extent_id', 35 ) 36 37 map.resource('q_method', 'q_methods', 38 controller='extent_q_methods', 35 39 path_prefix='/databases/:db_id/extents/:extent_id', 36 40 name_prefix='extent_', … … 38 42 ) 39 43 40 map.resource('t ransaction', 'transactions',41 controller='extent_t ransactions',44 map.resource('t_method', 't_methods', 45 controller='extent_t_methods', 42 46 path_prefix='/databases/:db_id/extents/:extent_id', 43 47 name_prefix='extent_', … … 45 49 ) 46 50 47 map.resource('entity', 'entities',48 path_prefix='/databases/:db_id/extents/:extent_id',49 )50 51 51 map.connect(':controller/:action/:id') 52 52 map.connect('*url', controller='template', action='view') sandbox/mscott/SchevoPylonsNav/trunk/schevopylonsnav/controllers/extent_q_methods.py
r2938 r2954 2 2 3 3 4 class ExtentQ ueriesController(BaseController):4 class ExtentQMethodsController(BaseController): 5 5 """REST Controller styled on the Atom Publishing Protocol""" 6 6 # To properly map this controller, ensure your config/routing.py file has 7 7 # a resource setup: 8 # map.resource('extent_q uery', 'extent_queries')8 # map.resource('extent_q_method', 'extent_q_methods') 9 9 10 10 def index(self, db_id, extent_id, format='html'): 11 11 """GET /: All items in the collection.""" 12 # url_for('extent_q ueries')12 # url_for('extent_q_methods') 13 13 c.dbs = dbs = self.dbs 14 14 c.db_id = db_id 15 15 c.db = db = dbs[db_id] 16 16 c.extent = db.extent(extent_id) 17 return render_response('/extent_q ueries/index.html')17 return render_response('/extent_q_methods/index.html') 18 18 19 19 def call(self, db_id, extent_id, id): 20 20 """POST /id;call: Call the query method.""" 21 # url_for('extent_call_q uery', id=ID)21 # url_for('extent_call_q_method', id=ID) 22 22 db = self.dbs[db_id] 23 23 extent = db.extent(extent_id) … … 31 31 def create(self): 32 32 """POST /: Create a new item.""" 33 # url_for('extent_q ueries')33 # url_for('extent_q_methods') 34 34 pass 35 35 36 36 def new(self, format='html'): 37 37 """GET /new: Form to create a new item.""" 38 # url_for('new_extent_q uery')38 # url_for('new_extent_q_method') 39 39 pass 40 40 … … 44 44 # <input type="hidden" name="_method" value="PUT" /> 45 45 # Or using helpers: 46 # h.form(h.url_for('extent_q uery', id=ID), method='put')47 # url_for('extent_q uery', id=ID)46 # h.form(h.url_for('extent_q_method', id=ID), method='put') 47 # url_for('extent_q_method', id=ID) 48 48 pass 49 49 … … 53 53 # <input type="hidden" name="_method" value="DELETE" /> 54 54 # Or using helpers: 55 # h.form(h.url_for('extent_q uery', id=ID), method='delete')56 # url_for('extent_q uery', id=ID)55 # h.form(h.url_for('extent_q_method', id=ID), method='delete') 56 # url_for('extent_q_method', id=ID) 57 57 pass 58 58 59 59 def show(self, db_id, extent_id, id, format='html'): 60 60 """GET /id: Show a specific item.""" 61 # url_for('extent_q uery', id=ID)61 # url_for('extent_q_method', id=ID) 62 62 c.dbs = dbs = self.dbs 63 63 c.db_id = db_id … … 66 66 c.method = c.extent.q[id] 67 67 c.method_id = id 68 return render_response('/extent_q ueries/show.html')68 return render_response('/extent_q_methods/show.html') 69 69 70 70 def edit(self, id, format='html'): 71 71 """GET /id;edit: Form to edit an existing item.""" 72 # url_for('edit_extent_q uery', id=ID)72 # url_for('edit_extent_q_method', id=ID) 73 73 pass 74 74 sandbox/mscott/SchevoPylonsNav/trunk/schevopylonsnav/controllers/extent_t_methods.py
r2938 r2954 2 2 3 3 4 class ExtentT ransactionsController(BaseController):4 class ExtentTMethodsController(BaseController): 5 5 """REST Controller styled on the Atom Publishing Protocol""" 6 6 # To properly map this controller, ensure your config/routing.py file has 7 7 # a resource setup: 8 # map.resource('extent_t ransaction', 'extent_transactions')8 # map.resource('extent_t_method', 'extent_t_methods') 9 9 10 10 def index(self, db_id, extent_id, format='html'): … … 14 14 c.db = db = dbs[db_id] 15 15 c.extent = db.extent(extent_id) 16 return render_response('/extent_t ransactions/index.html')16 return render_response('/extent_t_methods/index.html') 17 17 18 18 def call(self, db_id, extent_id, id): 19 19 """POST /id;call: Call the transaction method.""" 20 # url_for('extent_call_t ransaction', id=ID)20 # url_for('extent_call_t_method', id=ID) 21 21 db = self.dbs[db_id] 22 22 extent = db.extent(extent_id) … … 30 30 def create(self): 31 31 """POST /: Create a new item.""" 32 # url_for('extent_t ransactions')32 # url_for('extent_t_methods') 33 33 pass 34 34 35 35 def new(self, format='html'): 36 36 """GET /new: Form to create a new item.""" 37 # url_for('new_extent_t ransaction')37 # url_for('new_extent_t_method') 38 38 pass 39 39 … … 43 43 # <input type="hidden" name="_method" value="PUT" /> 44 44 # Or using helpers: 45 # h.form(h.url_for('extent_t ransaction', id=ID), method='put')46 # url_for('extent_t ransaction', id=ID)45 # h.form(h.url_for('extent_t_method', id=ID), method='put') 46 # url_for('extent_t_method', id=ID) 47 47 pass 48 48 … … 52 52 # <input type="hidden" name="_method" value="DELETE" /> 53 53 # Or using helpers: 54 # h.form(h.url_for('extent_t ransaction', id=ID), method='delete')55 # url_for('extent_t ransaction', id=ID)54 # h.form(h.url_for('extent_t_method', id=ID), method='delete') 55 # url_for('extent_t_method', id=ID) 56 56 pass 57 57 58 58 def show(self, db_id, extent_id, id, format='html'): 59 59 """GET /id: Show a specific item.""" 60 # url_for('extent_t ransaction', id=ID)60 # url_for('extent_t_method', id=ID) 61 61 c.dbs = dbs = self.dbs 62 62 c.db_id = db_id … … 65 65 c.method = c.extent.t[id] 66 66 c.method_id = id 67 return render_response('/extent_t ransactions/show.html')67 return render_response('/extent_t_methods/show.html') 68 68 69 69 def edit(self, id, format='html'): 70 70 """GET /id;edit: Form to edit an existing item.""" 71 # url_for('edit_extent_t ransaction', id=ID)71 # url_for('edit_extent_t_method', id=ID) 72 72 pass 73 73 sandbox/mscott/SchevoPylonsNav/trunk/schevopylonsnav/templates/extent_queries/index.html
r2944 r2954 20 20 <li><a href="${h.url_for('extent', db_id=c.db_id, id=c.extent.name)}" 21 21 >${h.plural(c.extent)}</a></li> 22 <li class="here"><a href="${h.url_for('extent_q ueries', db_id=c.db_id, extent_id=c.extent.name)}"22 <li class="here"><a href="${h.url_for('extent_q_methods', db_id=c.db_id, extent_id=c.extent.name)}" 23 23 >Queries</a></li> 24 24 </ul> … … 29 29 % for name in c.extent.q: 30 30 <li> 31 <a href="${h.url_for('extent_q uery', db_id=c.db_id, extent_id=c.extent.name, id=name)}"31 <a href="${h.url_for('extent_q_method', db_id=c.db_id, extent_id=c.extent.name, id=name)}" 32 32 >${h.label(c.extent.q[name])}</a> 33 33 </li> sandbox/mscott/SchevoPylonsNav/trunk/schevopylonsnav/templates/extent_queries/show.html
r2950 r2954 22 22 <li><a href="${h.url_for('extent', db_id=c.db_id, id=c.extent.name)}" 23 23 >${h.plural(c.extent)}</a></li> 24 <li><a href="${h.url_for('extent_q ueries', db_id=c.db_id, extent_id=c.extent.name)}"24 <li><a href="${h.url_for('extent_q_methods', db_id=c.db_id, extent_id=c.extent.name)}" 25 25 >Queries</a></li> 26 <li class="here"><a href="${h.url_for('extent_q uery', db_id=c.db_id, extent_id=c.extent.name, id=c.method_id)}"26 <li class="here"><a href="${h.url_for('extent_q_method', db_id=c.db_id, extent_id=c.extent.name, id=c.method_id)}" 27 27 >${h.label(c.method)}</a></li> 28 28 </ul> … … 30 30 31 31 <%def name="actions()"> 32 <form method="POST" action="${h.url_for('extent_call_q uery', db_id=c.db_id, extent_id=c.extent.name, id=c.method_id)}">32 <form method="POST" action="${h.url_for('extent_call_q_method', db_id=c.db_id, extent_id=c.extent.name, id=c.method_id)}"> 33 33 <input type="submit" value="Call" /> 34 34 </form> sandbox/mscott/SchevoPylonsNav/trunk/schevopylonsnav/templates/extent_transactions/index.html
r2944 r2954 20 20 <li><a href="${h.url_for('extent', db_id=c.db_id, id=c.extent.name)}" 21 21 >${h.plural(c.extent)}</a></li> 22 <li class="here"><a href="${h.url_for('extent_t ransactions', db_id=c.db_id, extent_id=c.extent.name)}"22 <li class="here"><a href="${h.url_for('extent_t_methods', db_id=c.db_id, extent_id=c.extent.name)}" 23 23 >Transactions</a></li> 24 24 </ul> … … 29 29 % for name in c.extent.t: 30 30 <li> 31 <a href="${h.url_for('extent_t ransaction', db_id=c.db_id, extent_id=c.extent.name, id=name)}"31 <a href="${h.url_for('extent_t_method', db_id=c.db_id, extent_id=c.extent.name, id=name)}" 32 32 >${h.label(c.extent.t[name])}</a> 33 33 </li> sandbox/mscott/SchevoPylonsNav/trunk/schevopylonsnav/templates/extent_transactions/show.html
r2950 r2954 22 22 <li><a href="${h.url_for('extent', db_id=c.db_id, id=c.extent.name)}" 23 23 >${h.plural(c.extent)}</a></li> 24 <li><a href="${h.url_for('extent_t ransactions', db_id=c.db_id, extent_id=c.extent.name)}"24 <li><a href="${h.url_for('extent_t_methods', db_id=c.db_id, extent_id=c.extent.name)}" 25 25 >Transactions</a></li> 26 <li class="here"><a href="${h.url_for('extent_t ransaction', db_id=c.db_id, extent_id=c.extent.name, id=c.method_id)}"26 <li class="here"><a href="${h.url_for('extent_t_method', db_id=c.db_id, extent_id=c.extent.name, id=c.method_id)}" 27 27 >${h.label(c.method)}</a></li> 28 28 </ul> … … 30 30 31 31 <%def name="actions()"> 32 <form method="POST" action="${h.url_for('extent_call_t ransaction', db_id=c.db_id, extent_id=c.extent.name, id=c.method_id)}">32 <form method="POST" action="${h.url_for('extent_call_t_method', db_id=c.db_id, extent_id=c.extent.name, id=c.method_id)}"> 33 33 <input type="submit" value="Call" /> 34 34 </form> sandbox/mscott/SchevoPylonsNav/trunk/schevopylonsnav/templates/extents/show.html
r2944 r2954 48 48 <ul> 49 49 <li> 50 <a href="${h.url_for('extent_q ueries', db_id=c.db_id, extent_id=c.extent.name)}"50 <a href="${h.url_for('extent_q_methods', db_id=c.db_id, extent_id=c.extent.name)}" 51 51 >Queries</a> 52 52 </li> 53 53 54 54 <li> 55 <a href="${h.url_for('extent_t ransactions', db_id=c.db_id, extent_id=c.extent.name)}"55 <a href="${h.url_for('extent_t_methods', db_id=c.db_id, extent_id=c.extent.name)}" 56 56 >Transactions</a> 57 57 </li> sandbox/mscott/SchevoPylonsNav/trunk/schevopylonsnav/tests/functional/test_extent_q_methods.py
r2938 r2954 2 2 3 3 4 class TestExtentQ ueriesController(TestController):4 class TestExtentQMethodsController(TestController): 5 5 6 6 def test_index(self): 7 7 response = self.app.get( 8 url_for('extent_q ueries', db_id='db', extent_id='Foo'))8 url_for('extent_q_methods', db_id='db', extent_id='Foo')) 9 9 assert 'By Example' in response 10 10 assert 'Exact Matches' in response … … 12 12 def test_get_exact(self): 13 13 response = self.app.get( 14 url_for('extent_q uery', db_id='db', extent_id='Foo',14 url_for('extent_q_method', db_id='db', extent_id='Foo', 15 15 id='exact')) 16 16 assert 'Exact Matches' in response … … 18 18 def test_call_exact(self): 19 19 response = self.app.post( 20 url_for('extent_call_q uery', db_id='db', extent_id='Foo',20 url_for('extent_call_q_method', db_id='db', extent_id='Foo', 21 21 id='exact')) 22 22 assert response.status == 302 sandbox/mscott/SchevoPylonsNav/trunk/schevopylonsnav/tests/functional/test_extent_t_methods.py
r2937 r2954 2 2 3 3 4 class TestExtentT ransactionsController(TestController):4 class TestExtentTMethodsController(TestController): 5 5 6 6 def test_index(self): 7 7 response = self.app.get( 8 url_for('extent_t ransactions', db_id='db', extent_id='Foo'))8 url_for('extent_t_methods', db_id='db', extent_id='Foo')) 9 9 assert 'Create' in response 10 10 11 11 def test_get_create(self): 12 12 response = self.app.get( 13 url_for('extent_t ransaction', db_id='db', extent_id='Foo',13 url_for('extent_t_method', db_id='db', extent_id='Foo', 14 14 id='create')) 15 15 assert 'Call' in response … … 17 17 def test_call_create(self): 18 18 response = self.app.post( 19 url_for('extent_call_t ransaction', db_id='db', extent_id='Foo',19 url_for('extent_call_t_method', db_id='db', extent_id='Foo', 20 20 id='create')) 21 21 assert response.status == 302 sandbox/mscott/SchevoPylonsNav/trunk/schevopylonsnav/tests/functional/test_extents.py
r2925 r2954 16 16 assert 'Queries' in response 17 17 assert url_for( 18 'extent_q ueries', db_id='db', extent_id='Foo') in response18 'extent_q_methods', db_id='db', extent_id='Foo') in response 19 19 assert 'Transactions' in response 20 20 assert url_for( 21 'extent_t ransactions', db_id='db', extent_id='Foo') in response21 'extent_t_methods', db_id='db', extent_id='Foo') in response 22 22 sandbox/mscott/SchevoPylonsNav/trunk/schevopylonsnav/tests/functional/test_transactions.py
r2953 r2954 7 7 # First get the 'create' method. 8 8 response = self.app.post( 9 url_for('extent_call_t ransaction', db_id='db', extent_id='Foo',9 url_for('extent_call_t_method', db_id='db', extent_id='Foo', 10 10 id='create')) 11 11 # Call it to get the transaction. … … 20 20 # Get the transaction. 21 21 response = self.app.post( 22 url_for('extent_call_t ransaction', db_id='db', extent_id='Foo',22 url_for('extent_call_t_method', db_id='db', extent_id='Foo', 23 23 id='create')) 24 24 # Call it to get the transaction. … … 31 31 # Get the transaction. 32 32 response = self.app.post( 33 url_for('extent_call_t ransaction', db_id='db', extent_id='Foo',33 url_for('extent_call_t_method', db_id='db', extent_id='Foo', 34 34 id='create')) 35 35 # Call it to get the transaction. … … 53 53 # Get the transaction. 54 54 response = self.app.post( 55 url_for('extent_call_t ransaction', db_id='db', extent_id='Foo',55 url_for('extent_call_t_method', db_id='db', extent_id='Foo', 56 56 id='create')) 57 57 # Call it to get the transaction.
