Changeset 2938
- Timestamp:
- 02/21/07 16:29:26 (2 years ago)
- Files:
-
- sandbox/mscott/SchevoPylonsNav/trunk/schevopylonsnav/config/routing.py (modified) (1 diff)
- sandbox/mscott/SchevoPylonsNav/trunk/schevopylonsnav/controllers/extent_queries.py (modified) (2 diffs)
- sandbox/mscott/SchevoPylonsNav/trunk/schevopylonsnav/controllers/extent_transactions.py (modified) (1 diff)
- sandbox/mscott/SchevoPylonsNav/trunk/schevopylonsnav/controllers/queries.py (added)
- sandbox/mscott/SchevoPylonsNav/trunk/schevopylonsnav/controllers/transactions.py (modified) (1 diff)
- sandbox/mscott/SchevoPylonsNav/trunk/schevopylonsnav/lib/app_globals.py (modified) (1 diff)
- sandbox/mscott/SchevoPylonsNav/trunk/schevopylonsnav/templates/extent_queries/index.html (modified) (1 diff)
- sandbox/mscott/SchevoPylonsNav/trunk/schevopylonsnav/templates/extent_queries/show.html (added)
- sandbox/mscott/SchevoPylonsNav/trunk/schevopylonsnav/templates/extent_transactions/index.html (modified) (1 diff)
- sandbox/mscott/SchevoPylonsNav/trunk/schevopylonsnav/templates/queries (added)
- sandbox/mscott/SchevoPylonsNav/trunk/schevopylonsnav/templates/queries/__init__.py (added)
- sandbox/mscott/SchevoPylonsNav/trunk/schevopylonsnav/templates/queries/show.html (added)
- sandbox/mscott/SchevoPylonsNav/trunk/schevopylonsnav/tests/functional/test_extent_queries.py (modified) (1 diff)
- sandbox/mscott/SchevoPylonsNav/trunk/schevopylonsnav/tests/functional/test_queries.py (added)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
sandbox/mscott/SchevoPylonsNav/trunk/schevopylonsnav/config/routing.py
r2936 r2938 25 25 ) 26 26 27 map.resource('query', 'queries') 28 27 29 map.resource('query', 'queries', 28 30 controller='extent_queries', 29 31 path_prefix='/databases/:db_id/extents/:extent_id', 30 32 name_prefix='extent_', 33 member=dict(call='POST'), 31 34 ) 32 35 sandbox/mscott/SchevoPylonsNav/trunk/schevopylonsnav/controllers/extent_queries.py
r2930 r2938 17 17 return render_response('/extent_queries/index.html') 18 18 19 def call(self, db_id, extent_id, id): 20 """POST /id;call: Call the query method.""" 21 # url_for('extent_call_query', id=ID) 22 db = self.dbs[db_id] 23 extent = db.extent(extent_id) 24 method = extent.q[id] 25 query = method() 26 query_cache = g.query_cache 27 token = g.new_cache_token(query_cache) 28 query_cache[token] = query 29 return redirect_to(h.url_for('query', id=token)) 30 19 31 def create(self): 20 32 """POST /: Create a new item.""" … … 45 57 pass 46 58 47 def show(self, id, format='html'):59 def show(self, db_id, extent_id, id, format='html'): 48 60 """GET /id: Show a specific item.""" 49 61 # url_for('extent_query', id=ID) 50 pass 62 c.dbs = dbs = self.dbs 63 c.db_id = db_id 64 c.db = db = dbs[db_id] 65 c.extent = db.extent(extent_id) 66 c.method = c.extent.q[id] 67 c.method_id = id 68 return render_response('/extent_queries/show.html') 51 69 52 70 def edit(self, id, format='html'): sandbox/mscott/SchevoPylonsNav/trunk/schevopylonsnav/controllers/extent_transactions.py
r2936 r2938 18 18 def call(self, db_id, extent_id, id): 19 19 """POST /id;call: Call the transaction method.""" 20 # url_for(' call_extent_transaction', id=ID)20 # url_for('extent_call_transaction', id=ID) 21 21 db = self.dbs[db_id] 22 22 extent = db.extent(extent_id) sandbox/mscott/SchevoPylonsNav/trunk/schevopylonsnav/controllers/transactions.py
r2937 r2938 52 52 # url_for('edit_transaction', id=ID) 53 53 pass 54 sandbox/mscott/SchevoPylonsNav/trunk/schevopylonsnav/lib/app_globals.py
r2937 r2938 39 39 40 40 """ 41 self.query_cache = LRUCache(size=2048) 41 42 self.tx_cache = LRUCache(size=2048) 42 43 self.cache_tokens = set() sandbox/mscott/SchevoPylonsNav/trunk/schevopylonsnav/templates/extent_queries/index.html
r2931 r2938 32 32 % for name in c.extent.q: 33 33 <li> 34 <a href="#">${h.label(c.extent.q[name])}</a> 34 <a href="${h.url_for('extent_query', db_id=c.db_id, extent_id=c.extent.name, id=name)}" 35 >${h.label(c.extent.q[name])}</a> 35 36 </li> 36 37 % endfor sandbox/mscott/SchevoPylonsNav/trunk/schevopylonsnav/templates/extent_transactions/index.html
r2935 r2938 32 32 % for name in c.extent.t: 33 33 <li> 34 <a href="${h.url_for('extent_transaction', db_id=c.db_id, extent_id=c.extent.name, id=name)}">${h.label(c.extent.t[name])}</a> 34 <a href="${h.url_for('extent_transaction', db_id=c.db_id, extent_id=c.extent.name, id=name)}" 35 >${h.label(c.extent.t[name])}</a> 35 36 </li> 36 37 % endfor sandbox/mscott/SchevoPylonsNav/trunk/schevopylonsnav/tests/functional/test_extent_queries.py
r2930 r2938 9 9 assert 'By Example' in response 10 10 assert 'Exact Matches' in response 11 12 def test_get_exact(self): 13 response = self.app.get( 14 url_for('extent_query', db_id='db', extent_id='Foo', 15 id='exact')) 16 assert 'Exact Matches' in response 17 18 def test_call_exact(self): 19 response = self.app.post( 20 url_for('extent_call_query', db_id='db', extent_id='Foo', 21 id='exact')) 22 assert response.status == 302 23 response = response.follow()
