Index: README.md
===================================================================
--- a/README.md
+++ b/README.md
@@ -8,24 +8,27 @@ make no stability guarantees whatsoever
## How to use ##
### Running the test server ###
The test server will convert your content directory on the fly, your changes
will become visible immediately. To run it you need:
* Python 2.7
-* [Flask](http://flask.pocoo.org/), [Jinja2](http://jinja.pocoo.org/) and
+* [Jinja2](http://jinja.pocoo.org/) and
[Markdown](https://pypi.python.org/pypi/Markdown) modules (can be installed by
- running `easy_install Flask Jinja2 Markdown` from the command line)
+ running `easy_install Jinja2 Markdown` from the command line)
* A current copy of the
[cms repository](https://github.com/adblockplus/cms/) (can be
[downloaded as ZIP file](https://github.com/adblockplus/cms/archive/master.zip)
or cloned via `git clone https://github.com/adblockplus/cms.git`)
+Optionally, the [Werkzeug](http://werkzeug.pocoo.org/) module can be installed
+as well, this will provide some developer features.
+
Run the `runserver.py` script from your content directory, e.g.:
python ../cms/runserver.py
Alternatively, the content directory could also be specified as command line
parameter of `runserver.py`. This will start a local web server on port 5000,
e.g. the page the page `pages/example.md` will be accessible under
`http://localhost:5000/en/example`.
Index: cms/bin/test_server.py
===================================================================
--- a/cms/bin/test_server.py
+++ b/cms/bin/test_server.py
@@ -10,70 +10,114 @@
# Adblock Plus is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Adblock Plus. If not, see
No page found for the address {{uri}}.
+ {% elif code == 500 %} +An error occurred while processing the request for {{uri}}:
+{{error}}+ {% endif %} + +""" + +# Create our own instance, the default one will introduce "random" host-specific +# behavior by parsing local config files. +mime_types = mimetypes.MimeTypes() def get_data(path): if source.has_static(path): return source.read_static(path) - path = path.rstrip("/") + path = path.strip("/") if path == "": path = source.read_config().get("general", "defaultlocale") if "/" in path: locale, page = path.split("/", 1) else: locale, page = path, "" default_page = source.read_config().get("general", "defaultpage") alternative_page = "/".join([page, default_page]).lstrip("/") for format in converters.iterkeys(): for p in (page, alternative_page): if source.has_page(p, format): - return process_page(source, locale, p, format, "http://127.0.0.1:5000").encode("utf-8") + return process_page(source, locale, p, format, "http://127.0.0.1:5000") if source.has_localizable_file(locale, page): return source.read_localizable_file(locale, page) return None -@app.route("/", methods = ["GET"]) -@app.route("/