--- /dev/null
+/* http://meyerweb.com/eric/tools/css/reset/
+ v2.0 | 20110126
+ License: none (public domain)
+*/
+
+html, body, div, span, applet, object, iframe,
+h1, h2, h3, h4, h5, h6, p, blockquote, pre,
+a, abbr, acronym, address, big, cite, code,
+del, dfn, em, img, ins, kbd, q, s, samp,
+small, strike, strong, sub, sup, tt, var,
+b, u, i, center,
+dl, dt, dd, ol, ul, li,
+fieldset, form, label, legend,
+table, caption, tbody, tfoot, thead, tr, th, td,
+article, aside, canvas, details, embed,
+figure, figcaption, footer, header, hgroup,
+menu, nav, output, ruby, section, summary,
+time, mark, audio, video {
+ margin: 0;
+ padding: 0;
+ border: 0;
+ font-size: 100%;
+ font: inherit;
+ vertical-align: baseline;
+}
+/* HTML5 display-role reset for older browsers */
+article, aside, details, figcaption, figure,
+footer, header, hgroup, menu, nav, section {
+ display: block;
+}
+body {
+ line-height: 1;
+}
+ol, ul {
+ list-style: none;
+}
+blockquote, q {
+ quotes: none;
+}
+blockquote:before, blockquote:after,
+q:before, q:after {
+ content: '';
+ content: none;
+}
+table {
+ border-collapse: collapse;
+ border-spacing: 0;
+}
\ No newline at end of file
--- /dev/null
+# -*- mode: python; coding: utf-8; -*-
+from django.shortcuts import render_to_response
+from django.template import RequestContext
+
+def render_to(template):
+ """
+ Decorator for Django views that sends returned dict to render_to_response
+ function with given template and RequestContext as context instance.
+
+ If view doesn't return dict then decorator simply returns output.
+ Additionally view can return two-tuple, which must contain dict as first
+ element and string with template name as second. This string will
+ override template name, given as parameter
+
+ Parameters:
+
+ - template: template name to use
+
+ Examples::
+ from sugar.views.decorators import render_to, ajax_request
+
+ @render_to('some/tmpl.html')
+ def view(request):
+ if smth:
+ return {'context': 'dict'}
+ else:
+ return {'context': 'dict'}, 'other/tmpl.html'
+
+ (c) 2006-2009 Alexander Solovyov, new BSD License
+ """
+ def renderer(func):
+ def wrapper(request, *args, **kw):
+ output = func(request, *args, **kw)
+ if isinstance(output, (list, tuple)):
+ return render_to_response(output[1], output[0],
+ RequestContext(request))
+ elif isinstance(output, dict):
+ return render_to_response(template, output,
+ RequestContext(request))
+ return output
+ wrapper.__name__ = func.__name__
+ wrapper.__module__ = func.__module__
+ wrapper.__doc__ = func.__doc__
+ return wrapper
+ return renderer