diff --git a/.hgignore b/.hgignore index 88eefb1..80e5592 100644 --- a/.hgignore +++ b/.hgignore @@ -1,2 +1,3 @@ \.py[co]$ \.DS_Store$ +bootstrap.py diff --git a/TODO b/TODO index de39776..b5f209a 100644 --- a/TODO +++ b/TODO @@ -4,4 +4,6 @@ * Improve i18n support * Improve LodgeIt Interface (null-interface + star) * use udiff module instead of pygments-diff-highlighter for diff highlighning - * use flatland for forms \ No newline at end of file + * use flatland for forms + * comparisons are suprising by using the paste being compared to as the + initial diff --git a/lodgeit/controllers/pastes.py b/lodgeit/controllers/pastes.py index 572f15f..9ecf7da 100644 --- a/lodgeit/controllers/pastes.py +++ b/lodgeit/controllers/pastes.py @@ -11,7 +11,7 @@ from werkzeug import redirect, Response from werkzeug.exceptions import NotFound from lodgeit import local -from lodgeit.i18n import list_languages as i18n_list_languages, _ +from lodgeit.i18n import list_languages as i18n_list_languages from lodgeit.utils import render_to_response, url_for from lodgeit.models import Paste from lodgeit.database import session @@ -19,7 +19,6 @@ from lodgeit.lib.highlighting import list_languages, STYLES, get_style from lodgeit.lib.pagination import generate_pagination - class PasteController(object): """Provides all the handler callback for paste related stuff.""" @@ -177,5 +176,10 @@ class PasteController(object): return redirect(local.request.headers.get('referer') or url_for('pastes/new_paste')) + def rss(self): + query = Paste.find_all() + items = query.all() + return render_to_response('rss.html', items=items, + mimetype='application/rss+xml') controller = PasteController diff --git a/lodgeit/models.py b/lodgeit/models.py index 7f89251..58155c4 100644 --- a/lodgeit/models.py +++ b/lodgeit/models.py @@ -90,6 +90,7 @@ class Paste(db.Model): """Get the new replies for the ower of a request and flag them as handled. """ + #XXX:dc:clean this query up to just return the ids ids = [x.paste_id for x in Paste.query.filter_by( user_hash=local.request.user_hash).all()] paste_list = Paste.query.filter(db.and_( diff --git a/lodgeit/urls.py b/lodgeit/urls.py index a52f421..5c2b6fa 100644 --- a/lodgeit/urls.py +++ b/lodgeit/urls.py @@ -39,4 +39,7 @@ urlmap = Map([ # language Rule('/language//', endpoint='pastes/set_language'), + + # rss + Rule('/rss.xml', endpoint='pastes/rss'), ]) diff --git a/lodgeit/utils.py b/lodgeit/utils.py index 9a5a95c..60ea587 100644 --- a/lodgeit/utils.py +++ b/lodgeit/utils.py @@ -39,9 +39,9 @@ _word_only = partial(re.compile(r'[^a-zA-Z0-9]').sub, '') COOKIE_NAME = u'lodgeit_session' -def url_for(endpoint, _external=False, **values): +def url_for(endpoint, external=False, **values): builder = local.ctx.url_adapter.build - return builder(endpoint, values, force_external=_external) + return builder(endpoint, values, force_external=external) jinja_environment.globals['url_for'] = url_for @@ -109,7 +109,7 @@ def render_template(template_name, **context): return jinja_environment.get_template(template_name).render(context) -def render_to_response(template_name, **context): +def render_to_response(template_name, mimetype='text/html', **context): """Render a template to a response. This automatically fetches the list of new replies for the layout template. It also adds the current request to the context. This is used for the @@ -120,4 +120,4 @@ def render_to_response(template_name, **context): if request.method == 'GET': context['new_replies'] = Paste.fetch_replies() return Response(render_template(template_name, **context), - mimetype='text/html') + mimetype=mimetype) diff --git a/lodgeit/views/rss.html b/lodgeit/views/rss.html new file mode 100644 index 0000000..3ec6db5 --- /dev/null +++ b/lodgeit/views/rss.html @@ -0,0 +1,15 @@ + + + + Paste + {{ url_for('pastes/new_paste', external=True) }} + Public pastes + {%- for item in items %} + + {{ item.paste_id }} + {{ url_for('pastes/show_paste', identifier=item.paste_id, external=True) }} + {{ url_for('pastes/show_paste', identifier=item.paste_id, external=True) }} + + {%- endfor %} + +