Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: sitescripts/testpages/README.md

Issue 29328589: Issue 3122 - Add testpages.web.sitekey_frame URL handler (Closed)
Patch Set: Further improvements Created Oct. 8, 2015, noon
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: sitescripts/testpages/README.md
diff --git a/sitescripts/testpages/README.md b/sitescripts/testpages/README.md
new file mode 100644
index 0000000000000000000000000000000000000000..243fc770ed615a2712e42d8ebb666fca9602df0c
--- /dev/null
+++ b/sitescripts/testpages/README.md
@@ -0,0 +1,35 @@
+# sitescripts.testpages
+
+## Introduction
+
+This package contains all the dynamic URL handlers required for the otherwise
+static testpages.adblockplus.org project. This allows us to create test cases
+for things like sitekeys which require web responses to be generated
+dynamically.
+
+
+## sitescripts.testpages.web.sitekey_frame
+
+For test cases that test the $sitekey filter option you can use the make use of
+the `/sitekey-frame` URL handler. The handler renders a template of your
+choosing, passing in the public key and signature variables. For this you will
+need to have a suitable RSA key file, a Jinja2 template that makes use of the
+`public_key` + `signature` variables and a suitable `sitescripts.ini`
+configuration.
+
+Here's an example configuration:
+
+```
+[multiplexer]
+sitescripts.testpages.web.sitekey_frame =
+
+[testpages]
+sitekeyFrameTemplate=%(root)s/testpages.adblockplus.org/templates/sitekey_frame.tmpl
+sitekeyPath=%(root)s/testpages.adblockplus.org/static/site.key
+```
+
+The handler automatically sets the correct `X-Adblock-Key` response header but
+it's important that the template also populates the `data-adblockkey` attribute
+of the html element with the public key and signature. For example:
+
+ <html data-adblockkey="{{ public_key + "_" + signature }}">
« no previous file with comments | « .sitescripts.example ('k') | sitescripts/testpages/__init__.py » ('j') | sitescripts/web.py » ('J')

Powered by Google App Engine
This is Rietveld