Skip to content

Commit

Permalink
add ua page
Browse files Browse the repository at this point in the history
  • Loading branch information
whtsky committed Aug 25, 2012
1 parent dfccec3 commit 455a19f
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 1 deletion.
16 changes: 16 additions & 0 deletions 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),
]
12 changes: 12 additions & 0 deletions 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 %}
3 changes: 2 additions & 1 deletion 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']

Expand All @@ -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)
Expand Down

0 comments on commit 455a19f

Please sign in to comment.