Permalink
Browse files

add ua page

  • Loading branch information...
1 parent dfccec3 commit 455a19fe91eed376cece03438efdf03488523ce1 @whtsky committed Aug 25, 2012
Showing with 30 additions and 1 deletion.
  1. +16 −0 handlers/others.py
  2. +12 −0 templates/others/ua.html
  3. +2 −1 urls.py
View
16 handlers/others.py
@@ -0,0 +1,16 @@
+#coding=utf-8
+
+from . import BaseHandler
+
+
+class UserAgentHandler(BaseHandler):
+ def get(self):
+ ua = self.request.headers.get("User-Agent", "Unknow")
+ source = self.get_source()
+ if not source:
+ source = 'Desktop'
+ self.render('others/ua.html', ua=ua, source=source)
+
+handlers = [
+ (r'/ua', UserAgentHandler),
+]
View
12 templates/others/ua.html
@@ -0,0 +1,12 @@
+{% extends '../base.html' %}
+
+{% block title %}User Agent | {% end %}
+
+{% block content %}
+<div class="box">
+ <header>User Agent</header>
+ <textarea id="content" rows="5">{% raw ua %}</textarea>
+ <hr>
+ Source: {{ source }}
+</div>
+{% end %}
View
3 urls.py
@@ -1,4 +1,4 @@
-from handlers import account, member, node, topic, dashboard
+from handlers import account, member, node, topic, dashboard, others
__all__ = ['handlers', 'ui_modules']
@@ -8,6 +8,7 @@
handlers.extend(node.handlers)
handlers.extend(topic.handlers)
handlers.extend(dashboard.handlers)
+handlers.extend(others.handlers)
ui_modules = {}
ui_modules.update(**node.ui_modules)

0 comments on commit 455a19f

Please sign in to comment.