From cb0acc5ac0c3682f64e1aacb803aa188efadb904 Mon Sep 17 00:00:00 2001 From: Srijan Choudhary Date: Thu, 24 Apr 2014 01:22:30 +0530 Subject: [PATCH 1/2] Add a basic demo page --- isso/__init__.py | 4 +++- isso/demo/index.html | 14 ++++++++++++++ isso/views/comments.py | 8 +++++++- 3 files changed, 24 insertions(+), 2 deletions(-) create mode 100644 isso/demo/index.html diff --git a/isso/__init__.py b/isso/__init__.py index 61a65f6..d4f7980 100644 --- a/isso/__init__.py +++ b/isso/__init__.py @@ -180,7 +180,9 @@ def make_app(conf=None, threading=True, multiprocessing=False, uwsgi=False): wrapper.append(partial(SharedDataMiddleware, exports={ '/js': join(dirname(__file__), 'js/'), - '/css': join(dirname(__file__), 'css/')})) + '/css': join(dirname(__file__), 'css/'), + '/demo': join(dirname(__file__), 'demo/') + })) wrapper.append(partial(wsgi.CORSMiddleware, origin=origin(isso.conf.getiter("general", "host")), diff --git a/isso/demo/index.html b/isso/demo/index.html new file mode 100644 index 0000000..a8704be --- /dev/null +++ b/isso/demo/index.html @@ -0,0 +1,14 @@ + + Isso Demo + + +
+
+

Isso Demo

+ + +
+
+
+ + diff --git a/isso/views/comments.py b/isso/views/comments.py index d6a2691..eac16ff 100644 --- a/isso/views/comments.py +++ b/isso/views/comments.py @@ -12,6 +12,8 @@ from werkzeug.http import dump_cookie from werkzeug.routing import Rule from werkzeug.wrappers import Response from werkzeug.exceptions import BadRequest, Forbidden, NotFound +from werkzeug.wsgi import get_current_url +from werkzeug.utils import redirect from isso.compat import text_type as str @@ -69,7 +71,8 @@ class API(object): ('moderate',('POST', '/id///')), ('like', ('POST', '/id//like')), ('dislike', ('POST', '/id//dislike')), - ('checkip', ('GET', '/check-ip')) + ('checkip', ('GET', '/check-ip')), + ('demo', ('GET', '/demo')) ] def __init__(self, isso): @@ -375,3 +378,6 @@ class API(object): def checkip(self, env, req): return Response(utils.anonymize(str(req.remote_addr)), 200) + + def demo(self, env, req): + return redirect(get_current_url(env) + '/index.html') From a753efe42de096faab9d62d49cc2f73cf06b7928 Mon Sep 17 00:00:00 2001 From: Martin Zimmermann Date: Thu, 24 Apr 2014 17:38:53 +0200 Subject: [PATCH 2/2] add doctype and charset --- isso/demo/index.html | 2 ++ 1 file changed, 2 insertions(+) diff --git a/isso/demo/index.html b/isso/demo/index.html index a8704be..171aa26 100644 --- a/isso/demo/index.html +++ b/isso/demo/index.html @@ -1,5 +1,7 @@ + Isso Demo +