From cdc3328bbf12f17633ecc3869511bdea40b3f2a4 Mon Sep 17 00:00:00 2001 From: dev Date: Wed, 5 Oct 2011 21:35:41 +0000 Subject: [PATCH 1/5] started working on the new version of the website --- app.py | 76 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 app.py diff --git a/app.py b/app.py new file mode 100644 index 00000000..e14803b3 --- /dev/null +++ b/app.py @@ -0,0 +1,76 @@ +from jinja2 import Environment, FileSystemLoader +from flask import Flask, request, session, g, redirect, url_for, abort, render_template, flash + +app=application=Flask(__name__, template_folder=TEMPLATE_DIR) +app.debug=bool(os.environ.get('APP_DEBUG', 'False')) + +@app.url_value_preprocessor +def pull_lang(endpoint, values): + if not values: + return + g.lang=values.pop('lang', None) + +@app.view('/') +def main_index(): + redirect(url_for('site_show', lang='en')) + +@app.view('//site/') +@app.view('//site/') +def site_show(page=''): + # TODO: set content_type + +@app.view('//meetings/') +def meetings_index(): + return render_template('meetings/index.html') + +@app.view('//meetings/') +def meetings_show(id): + # TODO: implement + +@app.view('//meetings//raw') +def meetings_show_raw(id): + # TODO: implement + +@app.view('//download') +def downloads_list(): + # TODO: implement + +@app.view('//download/') +def downloads_select(file): + # TODO: implement + +@app.view('/download//any/') +@app.view('/download///') +def downloads_redirect(protocol, file, mirror=None): + # TODO: implement + +@app.view('//blog/') +@app.view('//blog/page/') +def blog_index(page=0): + # TODO: implement + +@app.view('//blog/entry/') +def blog_entry(slug): + # TODO: implement + +@app.view('/feed/blog/rss') +def blog_rss(): + # TODO: implement + +@app.view('/feed/blog/atom') +def blog_atom(): + # TODO: implement + +@app.view('/'): +def legacy_show(f): + # TODO: redirect to correct new url + +@app.view('/meeting') +@app.view('/meeting.html') +def legacy_meeting(id): + redirect(url_for('meetings_show', id=id, lang='en')) + +@app.view('/status---') +@app.view('/status---.html') +def legacy_status(year, month, day): + redirect(url_for('blog_entry', lang='en', slug=('%s/%s/%s/status' % (year, month, day)))) From 894b9bb72b1b8c48e32b9491aa2983ae6b86c795 Mon Sep 17 00:00:00 2001 From: dev Date: Fri, 1 Jun 2012 21:15:42 +0000 Subject: [PATCH 2/5] finally! some progress --- app.py | 116 ++++++++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 87 insertions(+), 29 deletions(-) diff --git a/app.py b/app.py index e14803b3..7c79e524 100644 --- a/app.py +++ b/app.py @@ -1,8 +1,16 @@ from jinja2 import Environment, FileSystemLoader -from flask import Flask, request, session, g, redirect, url_for, abort, render_template, flash +from flask import Flask, request, session, g, redirect, url_for, abort, render_template, flash, send_from_directory, safe_join +import os.path +import fileinput + + +TEMPLATE_DIR = os.path.join(os.path.dirname(__file__), 'pages') +MEETINGS_DIR = os.path.join(os.path.dirname(__file__), 'meetings') + +app = application = Flask(__name__, template_folder=TEMPLATE_DIR) +app.debug = bool(os.environ.get('APP_DEBUG', 'False')) + -app=application=Flask(__name__, template_folder=TEMPLATE_DIR) -app.debug=bool(os.environ.get('APP_DEBUG', 'False')) @app.url_value_preprocessor def pull_lang(endpoint, values): @@ -10,67 +18,117 @@ def pull_lang(endpoint, values): return g.lang=values.pop('lang', None) -@app.view('/') +@app.route('/') def main_index(): - redirect(url_for('site_show', lang='en')) + return redirect(url_for('site_show', lang='en')) -@app.view('//site/') -@app.view('//site/') +@app.route('//site/') +@app.route('//site/') def site_show(page=''): # TODO: set content_type + pass -@app.view('//meetings/') +@app.route('//meetings/') def meetings_index(): return render_template('meetings/index.html') -@app.view('//meetings/') -def meetings_show(id): - # TODO: implement +@app.route('//meetings/') +def meetings_show(id, raw=False): + """ + Render the meeting X. + Either display the raw IRC .log or render as html and include .rst as header if it exists + """ + # generate file name for the raw meeting file(and header) + lname = str(id) + '.log' + hname = str(id) + '.rst' + lfile = safe_join(MEETINGS_DIR, lname) + hfile = safe_join(MEETINGS_DIR, hname) + + # check if meeting file exists and throw error if it does not.. + if not os.path.exists(lfile): + abort(404) + + log='' + header=None -@app.view('//meetings//raw') + # load log + with open(lfile, 'rb') as fd: + log = fd.read() + + # now try to load header if that makes sense + if os.path.exists(hfile): + with open(hfile, 'rb') as fd: + header = fd.read() + + + + # now only rendering left to do + if raw: + # hmm... maybe replace with something non-render_template like? + # return render_template('meetings/show_raw.html', log=log) + return send_from_directory(MEETINGS_DIR, lname, mimetype='text/plain') + else: + return render_template('meetings/show.html', log=log, header=header) + + +@app.route('//meetings//raw') def meetings_show_raw(id): - # TODO: implement + return meetings_show(id, raw=True) -@app.view('//download') +@app.route('//download') def downloads_list(): # TODO: implement + pass -@app.view('//download/') +@app.route('//download/') def downloads_select(file): # TODO: implement + pass -@app.view('/download//any/') -@app.view('/download///') +@app.route('/download//any/') +@app.route('/download///') def downloads_redirect(protocol, file, mirror=None): # TODO: implement + pass -@app.view('//blog/') -@app.view('//blog/page/') +@app.route('//blog/') +@app.route('//blog/page/') def blog_index(page=0): # TODO: implement + pass -@app.view('//blog/entry/') +@app.route('//blog/entry/') def blog_entry(slug): # TODO: implement + pass -@app.view('/feed/blog/rss') +@app.route('/feed/blog/rss') def blog_rss(): # TODO: implement + pass -@app.view('/feed/blog/atom') +@app.route('/feed/blog/atom') def blog_atom(): # TODO: implement + pass -@app.view('/'): -def legacy_show(f): - # TODO: redirect to correct new url -@app.view('/meeting') -@app.view('/meeting.html') + + +## legacy stuff: + +@app.route('/meeting') +@app.route('/meeting.html') def legacy_meeting(id): redirect(url_for('meetings_show', id=id, lang='en')) -@app.view('/status---') -@app.view('/status---.html') +@app.route('/status---') +@app.route('/status---.html') def legacy_status(year, month, day): redirect(url_for('blog_entry', lang='en', slug=('%s/%s/%s/status' % (year, month, day)))) + + +@app.route('/') +def legacy_show(f): + # TODO: redirect to correct new url + pass From a4571ab6dae8954c0112020dd86e80dc0deacc71 Mon Sep 17 00:00:00 2001 From: dev Date: Fri, 1 Jun 2012 23:15:41 +0000 Subject: [PATCH 3/5] more progress! --- app.py | 79 +++++++++++++++++++++++++++++++++++++++------------------- 1 file changed, 53 insertions(+), 26 deletions(-) diff --git a/app.py b/app.py index 7c79e524..263c26fb 100644 --- a/app.py +++ b/app.py @@ -1,16 +1,30 @@ -from jinja2 import Environment, FileSystemLoader +from jinja2 import Environment, FileSystemLoader, environmentfilter from flask import Flask, request, session, g, redirect, url_for, abort, render_template, flash, send_from_directory, safe_join import os.path +import os import fileinput +import codecs TEMPLATE_DIR = os.path.join(os.path.dirname(__file__), 'pages') +STATIC_DIR = os.path.join(os.path.dirname(__file__), 'static') + MEETINGS_DIR = os.path.join(os.path.dirname(__file__), 'meetings') -app = application = Flask(__name__, template_folder=TEMPLATE_DIR) +app = application = Flask(__name__, template_folder=TEMPLATE_DIR, static_url_path='/_static', static_folder=STATIC_DIR) app.debug = bool(os.environ.get('APP_DEBUG', 'False')) +@app.template_filter('restructuredtext') +def restructuredtext(env, value): + try: + from docutils.core import publish_parts + except ImportError: + print u"Install docutils!!11" + raise + parts = publish_parts(source=value, writer_name="html") + return parts['html_body'] + @app.url_value_preprocessor def pull_lang(endpoint, values): @@ -18,6 +32,10 @@ def pull_lang(endpoint, values): return g.lang=values.pop('lang', None) +#@app.url_value_preprocessor +#def fix_theme(endpoint, values): +# pass + @app.route('/') def main_index(): return redirect(url_for('site_show', lang='en')) @@ -33,7 +51,7 @@ def meetings_index(): return render_template('meetings/index.html') @app.route('//meetings/') -def meetings_show(id, raw=False): +def meetings_show(id, log=False, rst=False): """ Render the meeting X. Either display the raw IRC .log or render as html and include .rst as header if it exists @@ -48,32 +66,41 @@ def meetings_show(id, raw=False): if not os.path.exists(lfile): abort(404) - log='' - header=None - - # load log - with open(lfile, 'rb') as fd: - log = fd.read() - - # now try to load header if that makes sense - if os.path.exists(hfile): - with open(hfile, 'rb') as fd: - header = fd.read() - - - - # now only rendering left to do - if raw: + # if the user just wanted the .log + if log: # hmm... maybe replace with something non-render_template like? # return render_template('meetings/show_raw.html', log=log) return send_from_directory(MEETINGS_DIR, lname, mimetype='text/plain') - else: - return render_template('meetings/show.html', log=log, header=header) + + log='' + header=None + + # try to load header if that makes sense + if os.path.exists(hfile): + # if the user just wanted the .rst... + if rst: + return send_from_directory(MEETINGS_DIR, hname, mimetype='text/plain') + + # open the file as utf-8 file + with codecs.open(hfile, encoding='utf-8') as fd: + header = fd.read() + elif rst: + abort(404) + + # load log + with codecs.open(lfile, encoding='utf-8') as fd: + log = fd.read() + + return render_template('meetings/show.html', log=log, header=header, id=id) -@app.route('//meetings//raw') -def meetings_show_raw(id): - return meetings_show(id, raw=True) +@app.route('//meetings/.log') +def meetings_show_log(id): + return meetings_show(id, log=True) + +@app.route('//meetings/.rst') +def meetings_show_rst(id): + return meetings_show(id, rst=True) @app.route('//download') def downloads_list(): @@ -120,12 +147,12 @@ def blog_atom(): @app.route('/meeting') @app.route('/meeting.html') def legacy_meeting(id): - redirect(url_for('meetings_show', id=id, lang='en')) + return redirect(url_for('meetings_show', id=id, lang='en')) @app.route('/status---') @app.route('/status---.html') def legacy_status(year, month, day): - redirect(url_for('blog_entry', lang='en', slug=('%s/%s/%s/status' % (year, month, day)))) + return redirect(url_for('blog_entry', lang='en', slug=('%s/%s/%s/status' % (year, month, day)))) @app.route('/') From 7baf77ad1c381ca07c33218ccba123d5d8617b9d Mon Sep 17 00:00:00 2001 From: dev Date: Fri, 1 Jun 2012 23:36:38 +0000 Subject: [PATCH 4/5] first kinda working setup well.. kinda... /en/meetings/208 works and that's about it --- app.py | 35 ++++++++- .../pages/meeting208.html => meetings/208.log | 71 ------------------ .../_layout.html => pages/global/layout.html | 14 ++-- .../_menu.html => pages/global/menu.html | 22 +++--- www.i2p2/pages/_urlify => pages/global/urlify | 2 +- .../meetings/index.html | 2 +- {www.i2p2/static => static}/favicon.ico | Bin .../images/I2PTunnel-streamr.png | Bin .../images/add-key-terminal.png | Bin .../images/bandwidth2009.png | Bin {www.i2p2/static => static}/images/cz.png | Bin {www.i2p2/static => static}/images/dark.png | Bin .../static => static}/images/darkbluebg.png | Bin .../static => static}/images/darkbluetile.png | Bin .../images/darkerbluetile.png | Bin {www.i2p2/static => static}/images/de.png | Bin .../static => static}/images/download.png | Bin .../images/download_dark.png | Bin .../images/endToEndEncryption.png | Bin .../images/endToEndEncryption_fr.png | Bin .../images/endToEndEncryption_zh.png | Bin {www.i2p2/static => static}/images/es.png | Bin {www.i2p2/static => static}/images/eu.png | Bin .../images/firefox.options.jpg | Bin .../images/firefox.options_fr.png | Bin .../images/firefox.proxyports.jpg | Bin .../images/firefox.proxyports_fr.png | Bin {www.i2p2/static => static}/images/fr.png | Bin .../static => static}/images/garliccloves.png | Bin {www.i2p2/static => static}/images/help.png | Bin .../static => static}/images/help_dark.png | Bin .../static => static}/images/i2plogo.png | Bin .../images/i2ptunnel_peertopeer.png | Bin .../images/i2ptunnel_serverclient.png | Bin .../static => static}/images/i2pvstor_zh.png | Bin .../static => static}/images/ie.options.jpg | Bin .../images/ie.options_fr.png | Bin .../images/ie.proxyports.jpg | Bin .../images/ie.proxyports_fr.png | Bin {www.i2p2/static => static}/images/info.png | Bin .../static => static}/images/info_dark.png | Bin {www.i2p2/static => static}/images/it.png | Bin .../static => static}/images/itoopie.png | Bin .../images/konqueror.options.jpg | Bin .../images/konqueror.options_fr.jpg | Bin .../images/konqueror.proxyports.jpg | Bin .../images/konqueror.proxyports_fr.jpg | Bin .../static => static}/images/lang_ar.png | Bin {www.i2p2/static => static}/images/light.png | Bin .../images/lightbluetile.png | Bin {www.i2p2/static => static}/images/link.png | Bin .../static => static}/images/link_dark.png | Bin .../static => static}/images/logo07c.jpg | Bin {www.i2p2/static => static}/images/net.png | Bin {www.i2p2/static => static}/images/net_fr.png | Bin .../images/netdb_get_leaseset.png | Bin .../images/netdb_get_leaseset_fr.png | Bin .../images/netdb_get_routerinfo_1.png | Bin .../images/netdb_get_routerinfo_1_fr.png | Bin .../images/netdb_get_routerinfo_2.png | Bin .../images/netdb_get_routerinfo_2_fr.png | Bin {www.i2p2/static => static}/images/nl.png | Bin {www.i2p2/static => static}/images/plan.png | Bin .../images/protocol_stack.png | Bin .../images/protocol_stack_fr.png | Bin {www.i2p2/static => static}/images/ru.png | Bin .../static => static}/images/sqbullet.png | Bin .../images/stackoverflow_ad.png | Bin .../static => static}/images/tabletile.png | Bin .../images/tabletile_alt.png | Bin .../images/tabletitledark.png | Bin .../images/tabletitlelight-tall.png | Bin .../images/tabletitlelight.png | Bin {www.i2p2/static => static}/images/target.png | Bin .../images/tunnelSending.png | Bin .../static => static}/images/tunnels.png | Bin .../static => static}/images/tunnels_fr.png | Bin {www.i2p2/static => static}/images/udp.png | Bin {www.i2p2/static => static}/images/us.png | Bin {www.i2p2/static => static}/images/zh.png | Bin {www.i2p2/static => static}/news/news.xml | 0 {www.i2p2/static => static}/pdf/I2CP_spec.pdf | Bin {www.i2p2/static => static}/pdf/I2NP_spec.pdf | Bin .../pdf/I2P-PET-CON-2009.1.pdf | Bin .../static => static}/pdf/datastructures.pdf | Bin .../static => static}/pdf/i2p_philosophy.pdf | Bin .../pdf/polling_http_transport.pdf | Bin {www.i2p2/static => static}/styles/dark.css | 0 {www.i2p2/static => static}/styles/light.css | 0 .../static => static}/styles/light_ar.css | 0 .../static => static}/styles/light_zh.css | 0 91 files changed, 51 insertions(+), 95 deletions(-) rename www.i2p2/pages/meeting208.html => meetings/208.log (83%) rename www.i2p2/pages/_layout.html => pages/global/layout.html (59%) rename www.i2p2/pages/_menu.html => pages/global/menu.html (95%) rename www.i2p2/pages/_urlify => pages/global/urlify (79%) rename www.i2p2/pages/meetings.html => pages/meetings/index.html (99%) rename {www.i2p2/static => static}/favicon.ico (100%) rename {www.i2p2/static => static}/images/I2PTunnel-streamr.png (100%) rename {www.i2p2/static => static}/images/add-key-terminal.png (100%) rename {www.i2p2/static => static}/images/bandwidth2009.png (100%) rename {www.i2p2/static => static}/images/cz.png (100%) rename {www.i2p2/static => static}/images/dark.png (100%) rename {www.i2p2/static => static}/images/darkbluebg.png (100%) rename {www.i2p2/static => static}/images/darkbluetile.png (100%) rename {www.i2p2/static => static}/images/darkerbluetile.png (100%) rename {www.i2p2/static => static}/images/de.png (100%) rename {www.i2p2/static => static}/images/download.png (100%) rename {www.i2p2/static => static}/images/download_dark.png (100%) rename {www.i2p2/static => static}/images/endToEndEncryption.png (100%) rename {www.i2p2/static => static}/images/endToEndEncryption_fr.png (100%) rename {www.i2p2/static => static}/images/endToEndEncryption_zh.png (100%) rename {www.i2p2/static => static}/images/es.png (100%) rename {www.i2p2/static => static}/images/eu.png (100%) rename {www.i2p2/static => static}/images/firefox.options.jpg (100%) rename {www.i2p2/static => static}/images/firefox.options_fr.png (100%) rename {www.i2p2/static => static}/images/firefox.proxyports.jpg (100%) rename {www.i2p2/static => static}/images/firefox.proxyports_fr.png (100%) rename {www.i2p2/static => static}/images/fr.png (100%) rename {www.i2p2/static => static}/images/garliccloves.png (100%) rename {www.i2p2/static => static}/images/help.png (100%) rename {www.i2p2/static => static}/images/help_dark.png (100%) rename {www.i2p2/static => static}/images/i2plogo.png (100%) rename {www.i2p2/static => static}/images/i2ptunnel_peertopeer.png (100%) rename {www.i2p2/static => static}/images/i2ptunnel_serverclient.png (100%) rename {www.i2p2/static => static}/images/i2pvstor_zh.png (100%) rename {www.i2p2/static => static}/images/ie.options.jpg (100%) rename {www.i2p2/static => static}/images/ie.options_fr.png (100%) rename {www.i2p2/static => static}/images/ie.proxyports.jpg (100%) rename {www.i2p2/static => static}/images/ie.proxyports_fr.png (100%) rename {www.i2p2/static => static}/images/info.png (100%) rename {www.i2p2/static => static}/images/info_dark.png (100%) rename {www.i2p2/static => static}/images/it.png (100%) rename {www.i2p2/static => static}/images/itoopie.png (100%) rename {www.i2p2/static => static}/images/konqueror.options.jpg (100%) rename {www.i2p2/static => static}/images/konqueror.options_fr.jpg (100%) rename {www.i2p2/static => static}/images/konqueror.proxyports.jpg (100%) rename {www.i2p2/static => static}/images/konqueror.proxyports_fr.jpg (100%) rename {www.i2p2/static => static}/images/lang_ar.png (100%) rename {www.i2p2/static => static}/images/light.png (100%) rename {www.i2p2/static => static}/images/lightbluetile.png (100%) rename {www.i2p2/static => static}/images/link.png (100%) rename {www.i2p2/static => static}/images/link_dark.png (100%) rename {www.i2p2/static => static}/images/logo07c.jpg (100%) rename {www.i2p2/static => static}/images/net.png (100%) rename {www.i2p2/static => static}/images/net_fr.png (100%) rename {www.i2p2/static => static}/images/netdb_get_leaseset.png (100%) rename {www.i2p2/static => static}/images/netdb_get_leaseset_fr.png (100%) rename {www.i2p2/static => static}/images/netdb_get_routerinfo_1.png (100%) rename {www.i2p2/static => static}/images/netdb_get_routerinfo_1_fr.png (100%) rename {www.i2p2/static => static}/images/netdb_get_routerinfo_2.png (100%) rename {www.i2p2/static => static}/images/netdb_get_routerinfo_2_fr.png (100%) rename {www.i2p2/static => static}/images/nl.png (100%) rename {www.i2p2/static => static}/images/plan.png (100%) rename {www.i2p2/static => static}/images/protocol_stack.png (100%) rename {www.i2p2/static => static}/images/protocol_stack_fr.png (100%) rename {www.i2p2/static => static}/images/ru.png (100%) rename {www.i2p2/static => static}/images/sqbullet.png (100%) rename {www.i2p2/static => static}/images/stackoverflow_ad.png (100%) rename {www.i2p2/static => static}/images/tabletile.png (100%) rename {www.i2p2/static => static}/images/tabletile_alt.png (100%) rename {www.i2p2/static => static}/images/tabletitledark.png (100%) rename {www.i2p2/static => static}/images/tabletitlelight-tall.png (100%) rename {www.i2p2/static => static}/images/tabletitlelight.png (100%) rename {www.i2p2/static => static}/images/target.png (100%) rename {www.i2p2/static => static}/images/tunnelSending.png (100%) rename {www.i2p2/static => static}/images/tunnels.png (100%) rename {www.i2p2/static => static}/images/tunnels_fr.png (100%) rename {www.i2p2/static => static}/images/udp.png (100%) rename {www.i2p2/static => static}/images/us.png (100%) rename {www.i2p2/static => static}/images/zh.png (100%) rename {www.i2p2/static => static}/news/news.xml (100%) rename {www.i2p2/static => static}/pdf/I2CP_spec.pdf (100%) rename {www.i2p2/static => static}/pdf/I2NP_spec.pdf (100%) rename {www.i2p2/static => static}/pdf/I2P-PET-CON-2009.1.pdf (100%) rename {www.i2p2/static => static}/pdf/datastructures.pdf (100%) rename {www.i2p2/static => static}/pdf/i2p_philosophy.pdf (100%) rename {www.i2p2/static => static}/pdf/polling_http_transport.pdf (100%) rename {www.i2p2/static => static}/styles/dark.css (100%) rename {www.i2p2/static => static}/styles/light.css (100%) rename {www.i2p2/static => static}/styles/light_ar.css (100%) rename {www.i2p2/static => static}/styles/light_zh.css (100%) diff --git a/app.py b/app.py index 263c26fb..5108529b 100644 --- a/app.py +++ b/app.py @@ -14,9 +14,21 @@ MEETINGS_DIR = os.path.join(os.path.dirname(__file__), 'meetings') app = application = Flask(__name__, template_folder=TEMPLATE_DIR, static_url_path='/_static', static_folder=STATIC_DIR) app.debug = bool(os.environ.get('APP_DEBUG', 'False')) +@app.after_request +def call_after_request_callbacks(response): + for callback in getattr(g, 'after_request_callbacks', ()): + response = callback(response) + return response + +def after_this_request(f): + if not hasattr(g, 'after_request_callbacks'): + g.after_request_callbacks = [] + g.after_request_callbacks.append(f) + return f + @app.template_filter('restructuredtext') -def restructuredtext(env, value): +def restructuredtext(value): try: from docutils.core import publish_parts except ImportError: @@ -32,9 +44,24 @@ def pull_lang(endpoint, values): return g.lang=values.pop('lang', None) -#@app.url_value_preprocessor -#def fix_theme(endpoint, values): -# pass +@app.before_request +def detect_theme(): + theme = 'light' + if 'style' in request.cookies: + theme = request.cookies['style'] + if 'theme' in request.args.keys(): + theme = request.args['theme'] + if not os.path.isfile(safe_join('static/styles', '%s.css' % theme)): + theme = 'light' + g.theme = theme + @after_this_request + def remember_theme(resp): + if g.theme == 'light' and 'style' in request.cookies: + resp.delete_cookie('style') + elif g.theme != 'light': + resp.set_cookie('style', g.theme) + return resp + @app.route('/') def main_index(): diff --git a/www.i2p2/pages/meeting208.html b/meetings/208.log similarity index 83% rename from www.i2p2/pages/meeting208.html rename to meetings/208.log index 18448cd8..0d0f5157 100644 --- a/www.i2p2/pages/meeting208.html +++ b/meetings/208.log @@ -1,69 +1,3 @@ -{% extends "_layout.html" %} -{% block title %}I2P Development Meeting 208{% endblock %} -{% block content %}

I2P dev meeting, September 8, 2010

-
-

Quick recap

-
    -
  • Present: duck, eche|on, Mathiasdm, Moru (later on), superuser, whitenoise, zzz
  • -
  • - Website content progress: -

    - The website overhaul has taken 7 weeks so far. Progress is not fast enough. We need more people to join in! -

    -
  • -
  • - Website backend progress: -

    - No report yet, welterde could not attend the meeting. -

    -
  • -
  • - Location for development discussion: -

    - Most people agree that IRC is not an ideal location to post long-winded development discussions, it's too volatile, not backed up and not everyone can read it. All developers are advised to post their discussions (or a writeup) to another medium, like zzz.i2p, mailing lists or forum.i2p. - Opinions on the alternatives are a bit more divided. zzz.i2p is currently the location for most discussions, but a number of people also like the idea of a mailing list. No decision has been made on which alternative would be best suited. -

    -
  • -
  • - Task appointing and disagreements: -

    - Currently, people appoint themselves to a task by editing the team.html page (this requires monotone access, so there is at least a level of trust implied before being allowed to appoint yourself). - However, what happens if people disagree? -

    -

    - The discussion pointed out that when disagreeing, a discussion should be held (for example on zzz.i2p). If that doesn't resolve the issue, a vote is a possibility, or the Project Manager (zzz) or repository maintainers (welterde, eche|on) can make a decision. -

    -
  • -
  • - Status updates: -

    - Status updates will be started next weekend. They will mostly consist of a 'what work did you do last week?' and 'what work will you do next week?'. -

    -
  • -
  • - Development conferences: -

    - Nothing big was mentioned. -

    -
  • -
  • - Promoting the usage of the bittorrent protocol inside I2P: pros and cons: -

    - Filesharing in general and bittorrent more specifically can be either good or bad for I2P. - On one hand, they could give I2P a bad reputation. On the other hand, they could boost I2P popularity. - What to do? -

    -

    - Filesharing on I2P will not be promoted specifically. Instead, general usability should be looked at and improved. - If people decide to use filesharing on I2P (or any other service, like e-mail or browsing), it should become easier as a result of improving the usability. -

    -
  • -
-
-
-

Full IRC Log

-
-{% filter escape %}
 22:02 <@Mathiasdm> okay
 22:02 <@Mathiasdm> meeting time
 22:03 <@Mathiasdm> 0) Hello
@@ -327,8 +261,3 @@
 23:24 < eche|on> COOKIES!
 23:25 <@Mathiasdm> don't eat all of them
 23:25  * Mathiasdm pokes eche|on 
-{% endfilter %}
-{# TODO: pygments #}
-
-
-{% endblock %} diff --git a/www.i2p2/pages/_layout.html b/pages/global/layout.html similarity index 59% rename from www.i2p2/pages/_layout.html rename to pages/global/layout.html index 26fa7599..4889c68a 100644 --- a/www.i2p2/pages/_layout.html +++ b/pages/global/layout.html @@ -1,24 +1,24 @@ -{% include "_urlify" -%} +{% include "global/urlify" -%} - {% filter capture('title') %}{% block title %}{% endblock %}{% endfilter %} - I2P + {% block title %}{% endblock %} - I2P - - + + -

{{ title }}

+

{{ self.title() }}

{% block content %}{% endblock %} diff --git a/www.i2p2/pages/_menu.html b/pages/global/menu.html similarity index 95% rename from www.i2p2/pages/_menu.html rename to pages/global/menu.html index 046e00a2..86adfcae 100644 --- a/www.i2p2/pages/_menu.html +++ b/pages/global/menu.html @@ -1,20 +1,20 @@
-English -Deutsch -Castellano -中文 +English +Deutsch +Castellano +中文
-Français -Italiano -Nederlands -Русский +Français +Italiano +Nederlands +Русский
-Čeština -العربية +Čeština +العربية
Dark  -Light +Light
{% if lang == "de" %} diff --git a/www.i2p2/pages/_urlify b/pages/global/urlify similarity index 79% rename from www.i2p2/pages/_urlify rename to pages/global/urlify index a9bdbf3d..59ffe02c 100644 --- a/www.i2p2/pages/_urlify +++ b/pages/global/urlify @@ -1,4 +1,4 @@ -{% macro urlify url, title, suffix %} +{% macro urlify(url, title, suffix) %} {% if static %} {{title}} {% else %} diff --git a/www.i2p2/pages/meetings.html b/pages/meetings/index.html similarity index 99% rename from www.i2p2/pages/meetings.html rename to pages/meetings/index.html index 9e65b231..b8effc6b 100644 --- a/www.i2p2/pages/meetings.html +++ b/pages/meetings/index.html @@ -1,4 +1,4 @@ -{% extends "_layout.html" %} +{% extends "global/layout.html" %} {% block title %}Meetings{% endblock %} {% block content %}

Logs of past I2P meetings

diff --git a/www.i2p2/static/favicon.ico b/static/favicon.ico similarity index 100% rename from www.i2p2/static/favicon.ico rename to static/favicon.ico diff --git a/www.i2p2/static/images/I2PTunnel-streamr.png b/static/images/I2PTunnel-streamr.png similarity index 100% rename from www.i2p2/static/images/I2PTunnel-streamr.png rename to static/images/I2PTunnel-streamr.png diff --git a/www.i2p2/static/images/add-key-terminal.png b/static/images/add-key-terminal.png similarity index 100% rename from www.i2p2/static/images/add-key-terminal.png rename to static/images/add-key-terminal.png diff --git a/www.i2p2/static/images/bandwidth2009.png b/static/images/bandwidth2009.png similarity index 100% rename from www.i2p2/static/images/bandwidth2009.png rename to static/images/bandwidth2009.png diff --git a/www.i2p2/static/images/cz.png b/static/images/cz.png similarity index 100% rename from www.i2p2/static/images/cz.png rename to static/images/cz.png diff --git a/www.i2p2/static/images/dark.png b/static/images/dark.png similarity index 100% rename from www.i2p2/static/images/dark.png rename to static/images/dark.png diff --git a/www.i2p2/static/images/darkbluebg.png b/static/images/darkbluebg.png similarity index 100% rename from www.i2p2/static/images/darkbluebg.png rename to static/images/darkbluebg.png diff --git a/www.i2p2/static/images/darkbluetile.png b/static/images/darkbluetile.png similarity index 100% rename from www.i2p2/static/images/darkbluetile.png rename to static/images/darkbluetile.png diff --git a/www.i2p2/static/images/darkerbluetile.png b/static/images/darkerbluetile.png similarity index 100% rename from www.i2p2/static/images/darkerbluetile.png rename to static/images/darkerbluetile.png diff --git a/www.i2p2/static/images/de.png b/static/images/de.png similarity index 100% rename from www.i2p2/static/images/de.png rename to static/images/de.png diff --git a/www.i2p2/static/images/download.png b/static/images/download.png similarity index 100% rename from www.i2p2/static/images/download.png rename to static/images/download.png diff --git a/www.i2p2/static/images/download_dark.png b/static/images/download_dark.png similarity index 100% rename from www.i2p2/static/images/download_dark.png rename to static/images/download_dark.png diff --git a/www.i2p2/static/images/endToEndEncryption.png b/static/images/endToEndEncryption.png similarity index 100% rename from www.i2p2/static/images/endToEndEncryption.png rename to static/images/endToEndEncryption.png diff --git a/www.i2p2/static/images/endToEndEncryption_fr.png b/static/images/endToEndEncryption_fr.png similarity index 100% rename from www.i2p2/static/images/endToEndEncryption_fr.png rename to static/images/endToEndEncryption_fr.png diff --git a/www.i2p2/static/images/endToEndEncryption_zh.png b/static/images/endToEndEncryption_zh.png similarity index 100% rename from www.i2p2/static/images/endToEndEncryption_zh.png rename to static/images/endToEndEncryption_zh.png diff --git a/www.i2p2/static/images/es.png b/static/images/es.png similarity index 100% rename from www.i2p2/static/images/es.png rename to static/images/es.png diff --git a/www.i2p2/static/images/eu.png b/static/images/eu.png similarity index 100% rename from www.i2p2/static/images/eu.png rename to static/images/eu.png diff --git a/www.i2p2/static/images/firefox.options.jpg b/static/images/firefox.options.jpg similarity index 100% rename from www.i2p2/static/images/firefox.options.jpg rename to static/images/firefox.options.jpg diff --git a/www.i2p2/static/images/firefox.options_fr.png b/static/images/firefox.options_fr.png similarity index 100% rename from www.i2p2/static/images/firefox.options_fr.png rename to static/images/firefox.options_fr.png diff --git a/www.i2p2/static/images/firefox.proxyports.jpg b/static/images/firefox.proxyports.jpg similarity index 100% rename from www.i2p2/static/images/firefox.proxyports.jpg rename to static/images/firefox.proxyports.jpg diff --git a/www.i2p2/static/images/firefox.proxyports_fr.png b/static/images/firefox.proxyports_fr.png similarity index 100% rename from www.i2p2/static/images/firefox.proxyports_fr.png rename to static/images/firefox.proxyports_fr.png diff --git a/www.i2p2/static/images/fr.png b/static/images/fr.png similarity index 100% rename from www.i2p2/static/images/fr.png rename to static/images/fr.png diff --git a/www.i2p2/static/images/garliccloves.png b/static/images/garliccloves.png similarity index 100% rename from www.i2p2/static/images/garliccloves.png rename to static/images/garliccloves.png diff --git a/www.i2p2/static/images/help.png b/static/images/help.png similarity index 100% rename from www.i2p2/static/images/help.png rename to static/images/help.png diff --git a/www.i2p2/static/images/help_dark.png b/static/images/help_dark.png similarity index 100% rename from www.i2p2/static/images/help_dark.png rename to static/images/help_dark.png diff --git a/www.i2p2/static/images/i2plogo.png b/static/images/i2plogo.png similarity index 100% rename from www.i2p2/static/images/i2plogo.png rename to static/images/i2plogo.png diff --git a/www.i2p2/static/images/i2ptunnel_peertopeer.png b/static/images/i2ptunnel_peertopeer.png similarity index 100% rename from www.i2p2/static/images/i2ptunnel_peertopeer.png rename to static/images/i2ptunnel_peertopeer.png diff --git a/www.i2p2/static/images/i2ptunnel_serverclient.png b/static/images/i2ptunnel_serverclient.png similarity index 100% rename from www.i2p2/static/images/i2ptunnel_serverclient.png rename to static/images/i2ptunnel_serverclient.png diff --git a/www.i2p2/static/images/i2pvstor_zh.png b/static/images/i2pvstor_zh.png similarity index 100% rename from www.i2p2/static/images/i2pvstor_zh.png rename to static/images/i2pvstor_zh.png diff --git a/www.i2p2/static/images/ie.options.jpg b/static/images/ie.options.jpg similarity index 100% rename from www.i2p2/static/images/ie.options.jpg rename to static/images/ie.options.jpg diff --git a/www.i2p2/static/images/ie.options_fr.png b/static/images/ie.options_fr.png similarity index 100% rename from www.i2p2/static/images/ie.options_fr.png rename to static/images/ie.options_fr.png diff --git a/www.i2p2/static/images/ie.proxyports.jpg b/static/images/ie.proxyports.jpg similarity index 100% rename from www.i2p2/static/images/ie.proxyports.jpg rename to static/images/ie.proxyports.jpg diff --git a/www.i2p2/static/images/ie.proxyports_fr.png b/static/images/ie.proxyports_fr.png similarity index 100% rename from www.i2p2/static/images/ie.proxyports_fr.png rename to static/images/ie.proxyports_fr.png diff --git a/www.i2p2/static/images/info.png b/static/images/info.png similarity index 100% rename from www.i2p2/static/images/info.png rename to static/images/info.png diff --git a/www.i2p2/static/images/info_dark.png b/static/images/info_dark.png similarity index 100% rename from www.i2p2/static/images/info_dark.png rename to static/images/info_dark.png diff --git a/www.i2p2/static/images/it.png b/static/images/it.png similarity index 100% rename from www.i2p2/static/images/it.png rename to static/images/it.png diff --git a/www.i2p2/static/images/itoopie.png b/static/images/itoopie.png similarity index 100% rename from www.i2p2/static/images/itoopie.png rename to static/images/itoopie.png diff --git a/www.i2p2/static/images/konqueror.options.jpg b/static/images/konqueror.options.jpg similarity index 100% rename from www.i2p2/static/images/konqueror.options.jpg rename to static/images/konqueror.options.jpg diff --git a/www.i2p2/static/images/konqueror.options_fr.jpg b/static/images/konqueror.options_fr.jpg similarity index 100% rename from www.i2p2/static/images/konqueror.options_fr.jpg rename to static/images/konqueror.options_fr.jpg diff --git a/www.i2p2/static/images/konqueror.proxyports.jpg b/static/images/konqueror.proxyports.jpg similarity index 100% rename from www.i2p2/static/images/konqueror.proxyports.jpg rename to static/images/konqueror.proxyports.jpg diff --git a/www.i2p2/static/images/konqueror.proxyports_fr.jpg b/static/images/konqueror.proxyports_fr.jpg similarity index 100% rename from www.i2p2/static/images/konqueror.proxyports_fr.jpg rename to static/images/konqueror.proxyports_fr.jpg diff --git a/www.i2p2/static/images/lang_ar.png b/static/images/lang_ar.png similarity index 100% rename from www.i2p2/static/images/lang_ar.png rename to static/images/lang_ar.png diff --git a/www.i2p2/static/images/light.png b/static/images/light.png similarity index 100% rename from www.i2p2/static/images/light.png rename to static/images/light.png diff --git a/www.i2p2/static/images/lightbluetile.png b/static/images/lightbluetile.png similarity index 100% rename from www.i2p2/static/images/lightbluetile.png rename to static/images/lightbluetile.png diff --git a/www.i2p2/static/images/link.png b/static/images/link.png similarity index 100% rename from www.i2p2/static/images/link.png rename to static/images/link.png diff --git a/www.i2p2/static/images/link_dark.png b/static/images/link_dark.png similarity index 100% rename from www.i2p2/static/images/link_dark.png rename to static/images/link_dark.png diff --git a/www.i2p2/static/images/logo07c.jpg b/static/images/logo07c.jpg similarity index 100% rename from www.i2p2/static/images/logo07c.jpg rename to static/images/logo07c.jpg diff --git a/www.i2p2/static/images/net.png b/static/images/net.png similarity index 100% rename from www.i2p2/static/images/net.png rename to static/images/net.png diff --git a/www.i2p2/static/images/net_fr.png b/static/images/net_fr.png similarity index 100% rename from www.i2p2/static/images/net_fr.png rename to static/images/net_fr.png diff --git a/www.i2p2/static/images/netdb_get_leaseset.png b/static/images/netdb_get_leaseset.png similarity index 100% rename from www.i2p2/static/images/netdb_get_leaseset.png rename to static/images/netdb_get_leaseset.png diff --git a/www.i2p2/static/images/netdb_get_leaseset_fr.png b/static/images/netdb_get_leaseset_fr.png similarity index 100% rename from www.i2p2/static/images/netdb_get_leaseset_fr.png rename to static/images/netdb_get_leaseset_fr.png diff --git a/www.i2p2/static/images/netdb_get_routerinfo_1.png b/static/images/netdb_get_routerinfo_1.png similarity index 100% rename from www.i2p2/static/images/netdb_get_routerinfo_1.png rename to static/images/netdb_get_routerinfo_1.png diff --git a/www.i2p2/static/images/netdb_get_routerinfo_1_fr.png b/static/images/netdb_get_routerinfo_1_fr.png similarity index 100% rename from www.i2p2/static/images/netdb_get_routerinfo_1_fr.png rename to static/images/netdb_get_routerinfo_1_fr.png diff --git a/www.i2p2/static/images/netdb_get_routerinfo_2.png b/static/images/netdb_get_routerinfo_2.png similarity index 100% rename from www.i2p2/static/images/netdb_get_routerinfo_2.png rename to static/images/netdb_get_routerinfo_2.png diff --git a/www.i2p2/static/images/netdb_get_routerinfo_2_fr.png b/static/images/netdb_get_routerinfo_2_fr.png similarity index 100% rename from www.i2p2/static/images/netdb_get_routerinfo_2_fr.png rename to static/images/netdb_get_routerinfo_2_fr.png diff --git a/www.i2p2/static/images/nl.png b/static/images/nl.png similarity index 100% rename from www.i2p2/static/images/nl.png rename to static/images/nl.png diff --git a/www.i2p2/static/images/plan.png b/static/images/plan.png similarity index 100% rename from www.i2p2/static/images/plan.png rename to static/images/plan.png diff --git a/www.i2p2/static/images/protocol_stack.png b/static/images/protocol_stack.png similarity index 100% rename from www.i2p2/static/images/protocol_stack.png rename to static/images/protocol_stack.png diff --git a/www.i2p2/static/images/protocol_stack_fr.png b/static/images/protocol_stack_fr.png similarity index 100% rename from www.i2p2/static/images/protocol_stack_fr.png rename to static/images/protocol_stack_fr.png diff --git a/www.i2p2/static/images/ru.png b/static/images/ru.png similarity index 100% rename from www.i2p2/static/images/ru.png rename to static/images/ru.png diff --git a/www.i2p2/static/images/sqbullet.png b/static/images/sqbullet.png similarity index 100% rename from www.i2p2/static/images/sqbullet.png rename to static/images/sqbullet.png diff --git a/www.i2p2/static/images/stackoverflow_ad.png b/static/images/stackoverflow_ad.png similarity index 100% rename from www.i2p2/static/images/stackoverflow_ad.png rename to static/images/stackoverflow_ad.png diff --git a/www.i2p2/static/images/tabletile.png b/static/images/tabletile.png similarity index 100% rename from www.i2p2/static/images/tabletile.png rename to static/images/tabletile.png diff --git a/www.i2p2/static/images/tabletile_alt.png b/static/images/tabletile_alt.png similarity index 100% rename from www.i2p2/static/images/tabletile_alt.png rename to static/images/tabletile_alt.png diff --git a/www.i2p2/static/images/tabletitledark.png b/static/images/tabletitledark.png similarity index 100% rename from www.i2p2/static/images/tabletitledark.png rename to static/images/tabletitledark.png diff --git a/www.i2p2/static/images/tabletitlelight-tall.png b/static/images/tabletitlelight-tall.png similarity index 100% rename from www.i2p2/static/images/tabletitlelight-tall.png rename to static/images/tabletitlelight-tall.png diff --git a/www.i2p2/static/images/tabletitlelight.png b/static/images/tabletitlelight.png similarity index 100% rename from www.i2p2/static/images/tabletitlelight.png rename to static/images/tabletitlelight.png diff --git a/www.i2p2/static/images/target.png b/static/images/target.png similarity index 100% rename from www.i2p2/static/images/target.png rename to static/images/target.png diff --git a/www.i2p2/static/images/tunnelSending.png b/static/images/tunnelSending.png similarity index 100% rename from www.i2p2/static/images/tunnelSending.png rename to static/images/tunnelSending.png diff --git a/www.i2p2/static/images/tunnels.png b/static/images/tunnels.png similarity index 100% rename from www.i2p2/static/images/tunnels.png rename to static/images/tunnels.png diff --git a/www.i2p2/static/images/tunnels_fr.png b/static/images/tunnels_fr.png similarity index 100% rename from www.i2p2/static/images/tunnels_fr.png rename to static/images/tunnels_fr.png diff --git a/www.i2p2/static/images/udp.png b/static/images/udp.png similarity index 100% rename from www.i2p2/static/images/udp.png rename to static/images/udp.png diff --git a/www.i2p2/static/images/us.png b/static/images/us.png similarity index 100% rename from www.i2p2/static/images/us.png rename to static/images/us.png diff --git a/www.i2p2/static/images/zh.png b/static/images/zh.png similarity index 100% rename from www.i2p2/static/images/zh.png rename to static/images/zh.png diff --git a/www.i2p2/static/news/news.xml b/static/news/news.xml similarity index 100% rename from www.i2p2/static/news/news.xml rename to static/news/news.xml diff --git a/www.i2p2/static/pdf/I2CP_spec.pdf b/static/pdf/I2CP_spec.pdf similarity index 100% rename from www.i2p2/static/pdf/I2CP_spec.pdf rename to static/pdf/I2CP_spec.pdf diff --git a/www.i2p2/static/pdf/I2NP_spec.pdf b/static/pdf/I2NP_spec.pdf similarity index 100% rename from www.i2p2/static/pdf/I2NP_spec.pdf rename to static/pdf/I2NP_spec.pdf diff --git a/www.i2p2/static/pdf/I2P-PET-CON-2009.1.pdf b/static/pdf/I2P-PET-CON-2009.1.pdf similarity index 100% rename from www.i2p2/static/pdf/I2P-PET-CON-2009.1.pdf rename to static/pdf/I2P-PET-CON-2009.1.pdf diff --git a/www.i2p2/static/pdf/datastructures.pdf b/static/pdf/datastructures.pdf similarity index 100% rename from www.i2p2/static/pdf/datastructures.pdf rename to static/pdf/datastructures.pdf diff --git a/www.i2p2/static/pdf/i2p_philosophy.pdf b/static/pdf/i2p_philosophy.pdf similarity index 100% rename from www.i2p2/static/pdf/i2p_philosophy.pdf rename to static/pdf/i2p_philosophy.pdf diff --git a/www.i2p2/static/pdf/polling_http_transport.pdf b/static/pdf/polling_http_transport.pdf similarity index 100% rename from www.i2p2/static/pdf/polling_http_transport.pdf rename to static/pdf/polling_http_transport.pdf diff --git a/www.i2p2/static/styles/dark.css b/static/styles/dark.css similarity index 100% rename from www.i2p2/static/styles/dark.css rename to static/styles/dark.css diff --git a/www.i2p2/static/styles/light.css b/static/styles/light.css similarity index 100% rename from www.i2p2/static/styles/light.css rename to static/styles/light.css diff --git a/www.i2p2/static/styles/light_ar.css b/static/styles/light_ar.css similarity index 100% rename from www.i2p2/static/styles/light_ar.css rename to static/styles/light_ar.css diff --git a/www.i2p2/static/styles/light_zh.css b/static/styles/light_zh.css similarity index 100% rename from www.i2p2/static/styles/light_zh.css rename to static/styles/light_zh.css From b26bbd81d98b93f91282274c4e2d89a9168d18c9 Mon Sep 17 00:00:00 2001 From: dev Date: Sun, 3 Jun 2012 01:06:09 +0000 Subject: [PATCH 5/5] 1/2 of blog implementation done! --- app.py | 94 ++++++++++++++++--- .../2006/10/10/status.html | 9 +- blog/2006/10/10/status.rst | 6 ++ .../downloads/list.html | 2 +- pages/global/error_404.html | 21 +++++ pages/global/urlify | 2 + {www.i2p2/pages => pages/site}/index.html | 5 +- www.i2p2/pages/not_found.html | 5 - www.i2p2/pages/not_found_de.html | 5 - www.i2p2/pages/not_found_zh.html | 7 -- 10 files changed, 115 insertions(+), 41 deletions(-) rename www.i2p2/pages/status-2006-10-10.html => blog/2006/10/10/status.html (94%) create mode 100644 blog/2006/10/10/status.rst rename www.i2p2/pages/download.html => pages/downloads/list.html (99%) create mode 100644 pages/global/error_404.html rename {www.i2p2/pages => pages/site}/index.html (94%) delete mode 100644 www.i2p2/pages/not_found.html delete mode 100644 www.i2p2/pages/not_found_de.html delete mode 100644 www.i2p2/pages/not_found_zh.html diff --git a/app.py b/app.py index 5108529b..866b6308 100644 --- a/app.py +++ b/app.py @@ -1,5 +1,6 @@ from jinja2 import Environment, FileSystemLoader, environmentfilter from flask import Flask, request, session, g, redirect, url_for, abort, render_template, flash, send_from_directory, safe_join +from docutils.core import publish_parts import os.path import os import fileinput @@ -9,6 +10,7 @@ import codecs TEMPLATE_DIR = os.path.join(os.path.dirname(__file__), 'pages') STATIC_DIR = os.path.join(os.path.dirname(__file__), 'static') +BLOG_DIR = os.path.join(os.path.dirname(__file__), 'blog') MEETINGS_DIR = os.path.join(os.path.dirname(__file__), 'meetings') app = application = Flask(__name__, template_folder=TEMPLATE_DIR, static_url_path='/_static', static_folder=STATIC_DIR) @@ -29,11 +31,6 @@ def after_this_request(f): @app.template_filter('restructuredtext') def restructuredtext(value): - try: - from docutils.core import publish_parts - except ImportError: - print u"Install docutils!!11" - raise parts = publish_parts(source=value, writer_name="html") return parts['html_body'] @@ -44,6 +41,15 @@ def pull_lang(endpoint, values): return g.lang=values.pop('lang', None) +@app.url_defaults +def set_lang(endpoint, values): + if not values: + return + if 'lang' in values: + return + if hasattr(g, 'lang'): + values['lang'] = g.lang + @app.before_request def detect_theme(): theme = 'light' @@ -63,15 +69,30 @@ def detect_theme(): return resp +@app.errorhandler(404) +def page_not_found(error): + return render_template('global/error_404.html'), 404 + @app.route('/') def main_index(): return redirect(url_for('site_show', lang='en')) + + @app.route('//site/') @app.route('//site/') -def site_show(page=''): - # TODO: set content_type - pass +def site_show(page='index'): + if page.endswith('.html'): + return redirect(url_for('site_show', page=page[:-5])) + name = 'site/%s.html' % page + page_file = safe_join(TEMPLATE_DIR, name) + + # bah! those damn users all the time! + if not os.path.exists(page_file): + abort(404) + + # hah! + return render_template(name, page=page) @app.route('//meetings/') def meetings_index(): @@ -131,8 +152,8 @@ def meetings_show_rst(id): @app.route('//download') def downloads_list(): - # TODO: implement - pass + # TODO: read mirror list or list of available files + return render_template('downloads/list.html') @app.route('//download/') def downloads_select(file): @@ -145,6 +166,28 @@ def downloads_redirect(protocol, file, mirror=None): # TODO: implement pass + + +def render_blog_entry(slug): + """ + Render the blog entry + TODO: + - caching + - move to own file + """ + # check if that file actually exists + path = safe_join(BLOG_DIR, slug + ".rst") + if not os.path.exists(path): + abort(404) + + # read file + with codecs.open(path, encoding='utf-8') as fd: + content = fd.read() + + return publish_parts(source=content, source_path=BLOG_DIR, writer_name="html") + + + @app.route('//blog/') @app.route('//blog/page/') def blog_index(page=0): @@ -153,8 +196,15 @@ def blog_index(page=0): @app.route('//blog/entry/') def blog_entry(slug): - # TODO: implement - pass + # try to render that blog entry.. throws 404 if it does not exist + parts = render_blog_entry(slug) + + if parts: + # now just pass to simple template file and we are done + return render_template('blog/entry.html', parts=parts, title=parts['title'], body=parts['fragment']) + else: + abort(404) + @app.route('/feed/blog/rss') def blog_rss(): @@ -181,8 +231,24 @@ def legacy_meeting(id): def legacy_status(year, month, day): return redirect(url_for('blog_entry', lang='en', slug=('%s/%s/%s/status' % (year, month, day)))) +LEGACY_MAP={ + 'download': 'downloads_list' +} +@app.route('/_') +@app.route('/_.html') @app.route('/') +@app.route('/.html') def legacy_show(f): - # TODO: redirect to correct new url - pass + lang = 'en' + if hasattr(g, 'lang') and g.lang: + lang = g.lang + if f in LEGACY_MAP: + return redirect(url_for(LEGACY_MAP[f], lang=lang)) + else: + return redirect(url_for('site_show', lang=lang, page=f)) + + + +if __name__ == '__main__': + app.run(debug=True) diff --git a/www.i2p2/pages/status-2006-10-10.html b/blog/2006/10/10/status.html similarity index 94% rename from www.i2p2/pages/status-2006-10-10.html rename to blog/2006/10/10/status.html index 6578b642..a3c787e3 100644 --- a/www.i2p2/pages/status-2006-10-10.html +++ b/blog/2006/10/10/status.html @@ -1,7 +1,5 @@ -{% extends "_layout.html" %} -{% block title %}I2P Status Notes for 2006-10-10{% endblock %} -{% block content %}

I2P Status Notes for 2006-10-10

-
-----BEGIN PGP SIGNED MESSAGE-----
+
+-----BEGIN PGP SIGNED MESSAGE-----
 Hash: SHA1
 
 Hi y'all, brief status notes this week
@@ -79,7 +77,4 @@ iD8DBQFFK6hgzgi8JTPcjUkRAuG2AJ46vK/13GIEngzQe05KRuEP2ZYvRQCeJB3j
 VmEzybBbtZSpSrFcU4qdvks=
 =QlDy
 -----END PGP SIGNATURE-----
-
-
 
-{% endblock %} diff --git a/blog/2006/10/10/status.rst b/blog/2006/10/10/status.rst new file mode 100644 index 00000000..b77847b7 --- /dev/null +++ b/blog/2006/10/10/status.rst @@ -0,0 +1,6 @@ +=============================== +I2P STATUS NOTES FOR 2006-10-10 +=============================== + +.. raw:: html + :file: blog/2006/10/10/status.html diff --git a/www.i2p2/pages/download.html b/pages/downloads/list.html similarity index 99% rename from www.i2p2/pages/download.html rename to pages/downloads/list.html index 7f5f9201..f7e5667f 100644 --- a/www.i2p2/pages/download.html +++ b/pages/downloads/list.html @@ -1,4 +1,4 @@ -{% extends "_layout.html" %} +{% extends "global/layout.html" %} {% block title %}Download{% endblock %} {% block content %}

Download I2P

diff --git a/pages/global/error_404.html b/pages/global/error_404.html new file mode 100644 index 00000000..d8563c03 --- /dev/null +++ b/pages/global/error_404.html @@ -0,0 +1,21 @@ +{% extends "global/layout.html" %} +{% block title -%} +{% if g.lang == 'de' %} +Nicht gefunden +{% elif g.lang == 'zh' %} +未找到 +{% else %} +Not found +{% endif %} +{%- endblock %} + +{% block content %} +{% if g.lang == 'de' %} +Yep... die Information nach der du suchst, nennt sich anders, existiert nicht oder wurde entfernt. +{% elif g.lang == 'zh' %} +您搜索的页面或资源的名称不正确或不存在或已被删除。 +{% else %} +Yep... the resource, you were searching for, is named differently, doesn't exist or was removed. +{% endif %} + +{% endblock %} diff --git a/pages/global/urlify b/pages/global/urlify index 59ffe02c..e8c9cd78 100644 --- a/pages/global/urlify +++ b/pages/global/urlify @@ -1,7 +1,9 @@ {% macro urlify(url, title, suffix) %} + {% autoescape false %} {% if static %} {{title}} {% else %} {{title}} {% endif %} + {% endautoescape %} {% endmacro %} \ No newline at end of file diff --git a/www.i2p2/pages/index.html b/pages/site/index.html similarity index 94% rename from www.i2p2/pages/index.html rename to pages/site/index.html index 4c6debbf..c3df28ee 100644 --- a/www.i2p2/pages/index.html +++ b/pages/site/index.html @@ -1,10 +1,11 @@ -{% extends "_layout.html" %} +{% extends "global/layout.html" %} +{% from "global/urlify" import urlify as urlify %} {% block title %}I2P Anonymous Network{% endblock %} {% block content %}
Latest version:
-2012-05-02 - I2P 0.9 - {{ urlify("release-0.9", "Announcement", "html")}} +2012-05-02 - I2P 0.9 - Announcement - Download
2007-09-28 - Syndie 1.101a - diff --git a/www.i2p2/pages/not_found.html b/www.i2p2/pages/not_found.html deleted file mode 100644 index a6c2a3fd..00000000 --- a/www.i2p2/pages/not_found.html +++ /dev/null @@ -1,5 +0,0 @@ -{% extends "_layout.html" %} -{% block title %}Not found{% endblock %} -{% block content %} -Yep... the resource, you were searching for, is named differently, doesn't exist or was removed. -{% endblock %} diff --git a/www.i2p2/pages/not_found_de.html b/www.i2p2/pages/not_found_de.html deleted file mode 100644 index 42fa6929..00000000 --- a/www.i2p2/pages/not_found_de.html +++ /dev/null @@ -1,5 +0,0 @@ -{% extends "_layout_de.html" %} -{% block title %}Nicht gefunden{% endblock %} -{% block content %} -Yep... die Information nach der du suchst, nennt sich anders, existiert nicht oder wurde entfernt. -{% endblock %} diff --git a/www.i2p2/pages/not_found_zh.html b/www.i2p2/pages/not_found_zh.html deleted file mode 100644 index 95b66982..00000000 --- a/www.i2p2/pages/not_found_zh.html +++ /dev/null @@ -1,7 +0,0 @@ -{% extends "_layout_zh.html" %} -{% block title %} -未找到 -{% endblock %} -{% block content %} -您搜索的页面或资源的名称不正确或不存在或已被删除。 -{% endblock %} \ No newline at end of file