]> de.git.xonotic.org Git - xonotic/xonstat.git/commitdiff
Add map_info view and template.
authorAnt Zucaro <azucaro@gmail.com>
Thu, 5 May 2011 16:43:41 +0000 (12:43 -0400)
committerAnt Zucaro <azucaro@gmail.com>
Thu, 5 May 2011 16:43:41 +0000 (12:43 -0400)
xonstat/__init__.py
xonstat/templates/map_info.mako [new file with mode: 0755]
xonstat/views.py

index 43a1c51bd161a24a52fe8b9ba3c7f560edae8077..7c3bf235eec14df07f62f607ea3c06c064c47f03 100755 (executable)
@@ -34,6 +34,9 @@ def main(global_config, **settings):
     config.add_route(name="server_info", pattern="/server/{id}", view=server_info, 
             renderer='server_info.mako') 
 
+    config.add_route(name="map_info", pattern="/map/{id}", view=map_info, 
+            renderer='map_info.mako') 
+
     config.add_route(name="stats_submit", pattern="stats/submit", 
             view=stats_submit, renderer='index.jinja2') 
 
diff --git a/xonstat/templates/map_info.mako b/xonstat/templates/map_info.mako
new file mode 100755 (executable)
index 0000000..7cdd52c
--- /dev/null
@@ -0,0 +1,23 @@
+<%inherit file="base.mako"/>
+
+<%block name="title">
+% if gmap:
+Map Information for ${gmap.name} - 
+% endif
+
+${parent.title()}
+</%block>
+
+
+% if gmap is None:
+<h2>Sorry, that map wasn't found!</h2>
+
+% else:
+<h2>Map Detail</h2>
+<ul>
+   <li>ID: ${gmap.map_id}</li>
+   <li>Name: ${gmap.name}</li>
+   <li>PK3 Name: ${gmap.pk3_name}</li>
+   <li>Curl URL: ${gmap.curl_url}</li>
+</ul>
+% endif
index 21f4e7911db968325db973bc9d59f627bc0f7343..f9574abc8f1c6c92cea8deb4700a91ca645e1fbe 100755 (executable)
@@ -64,6 +64,19 @@ def server_info(request):
     return {'server':server}
 
 
+##########################################################################
+# This is the map views area - only views pertaining to Xonotic
+# maps and their related information goes here
+##########################################################################
+def map_info(request):
+    map_id = request.matchdict['id']
+    try:
+        gmap = DBSession.query(Map).filter_by(map_id=map_id).one()
+    except:
+        gmap = None
+    return {'gmap':gmap}
+
+
 ##########################################################################
 # This is the stats views area - only views pertaining to Xonotic
 # statistics and its related information goes here
@@ -312,7 +325,7 @@ def stats_submit(request):
             'S' not in game_meta:
             log.debug("Required game meta fields (T, G, M, or S) missing. "\
                     "Can't continue.")
-            return {'msg':'Error processing the request.'}
+            raise Exception
     
         server = get_or_create_server(session=session, name=game_meta['S'])
         gmap = get_or_create_map(session=session, name=game_meta['M'])