aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libpathod/app.py10
-rw-r--r--libpathod/rparse.py2
-rw-r--r--libpathod/templates/request_preview.html (renamed from libpathod/templates/preview_request.html)0
-rw-r--r--libpathod/templates/response_preview.html (renamed from libpathod/templates/preview_response.html)0
-rw-r--r--libpathod/templates/response_previewform.html8
5 files changed, 13 insertions, 7 deletions
diff --git a/libpathod/app.py b/libpathod/app.py
index 6478964c..79c0fc71 100644
--- a/libpathod/app.py
+++ b/libpathod/app.py
@@ -28,6 +28,8 @@ def api():
def render(s, **kwargs):
kwargs["noapi"] = app.config["pathod"].noapi
+ kwargs["nocraft"] = app.config["pathod"].nocraft
+ kwargs["craftanchor"] = app.config["pathod"].craftanchor
return render_template(s, **kwargs)
@@ -87,13 +89,13 @@ def response_preview():
except rparse.ParseException, v:
args["syntaxerror"] = str(v)
args["marked"] = v.marked()
- return render("preview_response.html", **args)
+ return render("response_preview.html", **args)
s = cStringIO.StringIO()
r.preview_safe()
r.serve(s, check=app.config["pathod"].check_size)
args["output"] = utils.escape_unprintables(s.getvalue())
- return render("preview_response.html", **args)
+ return render("response_preview.html", **args)
@app.route('/request_preview')
@@ -110,10 +112,10 @@ def request_preview():
except rparse.ParseException, v:
args["syntaxerror"] = str(v)
args["marked"] = v.marked()
- return render("preview_request.html", **args)
+ return render("request_preview.html", **args)
s = cStringIO.StringIO()
r.preview_safe()
r.serve(s, check=app.config["pathod"].check_size, host="example.com")
args["output"] = utils.escape_unprintables(s.getvalue())
- return render("preview_request.html", **args)
+ return render("request_preview.html", **args)
diff --git a/libpathod/rparse.py b/libpathod/rparse.py
index d60a78d3..96817304 100644
--- a/libpathod/rparse.py
+++ b/libpathod/rparse.py
@@ -434,7 +434,7 @@ class DisconnectAt:
@classmethod
def expr(klass):
e = pp.Literal("d").suppress()
- e = e + pp.MatchFirst(
+ e += e + pp.MatchFirst(
[
v_integer,
pp.Literal("r")
diff --git a/libpathod/templates/preview_request.html b/libpathod/templates/request_preview.html
index fe8a03e9..fe8a03e9 100644
--- a/libpathod/templates/preview_request.html
+++ b/libpathod/templates/request_preview.html
diff --git a/libpathod/templates/preview_response.html b/libpathod/templates/response_preview.html
index 1b44e480..1b44e480 100644
--- a/libpathod/templates/preview_response.html
+++ b/libpathod/templates/response_preview.html
diff --git a/libpathod/templates/response_previewform.html b/libpathod/templates/response_previewform.html
index 74b25ce1..d98a72f7 100644
--- a/libpathod/templates/response_previewform.html
+++ b/libpathod/templates/response_previewform.html
@@ -1,12 +1,16 @@
<form class="form-inline" method="GET" action="/response_preview">
<input id="spec" name="spec" class="input-medium search-query" value="{{spec}}">
<input type="submit" class="btn" value="preview">
- <a href="#" id="submitspec" class="btn">go</a>
+ {% if not nocraft %}
+ <a href="#" id="submitspec" class="btn">go to</a>
+ {% endif %}
</form>
<script>
$(function(){
+ {% if not nocraft %}
$("#submitspec").click(function(){
- document.location = "/p/" + $("#spec").val()
+ document.location = "{{craftanchor}}" + $("#spec").val()
});
+ {% endif %}
});
</script>