Hello community, here is the log from the commit of package python-Coffin for openSUSE:Factory checked in at 2013-09-26 19:47:13 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-Coffin (Old) and /work/SRC/openSUSE:Factory/.python-Coffin.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-Coffin" Changes: -------- --- /work/SRC/openSUSE:Factory/python-Coffin/python-Coffin.changes 2012-11-25 13:28:14.000000000 +0100 +++ /work/SRC/openSUSE:Factory/.python-Coffin.new/python-Coffin.changes 2013-09-26 19:47:14.000000000 +0200 @@ -1,0 +2,6 @@ +Wed Sep 25 14:18:46 UTC 2013 - p.drou...@gmail.com + +- Update to version 0.3.8 + + No changelog available + +------------------------------------------------------------------- Old: ---- Coffin-0.3.7.tar.gz New: ---- Coffin-0.3.8.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-Coffin.spec ++++++ --- /var/tmp/diff_new_pack.4IurTt/_old 2013-09-26 19:47:15.000000000 +0200 +++ /var/tmp/diff_new_pack.4IurTt/_new 2013-09-26 19:47:15.000000000 +0200 @@ -1,7 +1,7 @@ # # spec file for package python-Coffin # -# Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany. +# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -17,7 +17,7 @@ Name: python-Coffin -Version: 0.3.7 +Version: 0.3.8 Release: 0 Url: http://github.com/dcramer/coffin Summary: Jinja2 adapter for Django ++++++ Coffin-0.3.7.tar.gz -> Coffin-0.3.8.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Coffin-0.3.7/Coffin.egg-info/PKG-INFO new/Coffin-0.3.8/Coffin.egg-info/PKG-INFO --- old/Coffin-0.3.7/Coffin.egg-info/PKG-INFO 2012-09-29 18:13:52.000000000 +0200 +++ new/Coffin-0.3.8/Coffin.egg-info/PKG-INFO 2013-06-28 12:49:59.000000000 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 1.0 Name: Coffin -Version: 0.3.7 +Version: 0.3.8 Summary: Jinja2 adapter for Django Home-page: http://github.com/coffin/coffin Author: David Cramer diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Coffin-0.3.7/Coffin.egg-info/SOURCES.txt new/Coffin-0.3.8/Coffin.egg-info/SOURCES.txt --- old/Coffin-0.3.7/Coffin.egg-info/SOURCES.txt 2012-09-29 18:13:52.000000000 +0200 +++ new/Coffin-0.3.8/Coffin.egg-info/SOURCES.txt 2013-06-28 12:49:59.000000000 +0200 @@ -11,8 +11,7 @@ coffin/common.py coffin/interop.py coffin/conf/__init__.py -coffin/conf/urls/__init__.py -coffin/conf/urls/defaults.py +coffin/conf/urls.py coffin/contrib/__init__.py coffin/contrib/loader.py coffin/contrib/auth/__init__.py @@ -29,6 +28,9 @@ coffin/contrib/flatpages/__init__.py coffin/contrib/flatpages/middleware.py coffin/contrib/flatpages/views.py +coffin/contrib/staticfiles/__init__.py +coffin/contrib/staticfiles/templatetags/__init__.py +coffin/contrib/staticfiles/templatetags/static.py coffin/contrib/syndication/__init__.py coffin/contrib/syndication/feeds.py coffin/contrib/syndication/views.py @@ -43,6 +45,8 @@ coffin/template/loader.py coffin/template/loaders.py coffin/template/response.py +coffin/templatetags/__init__.py +coffin/templatetags/static.py coffin/views/__init__.py coffin/views/decorators.py coffin/views/defaults.py diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Coffin-0.3.7/PKG-INFO new/Coffin-0.3.8/PKG-INFO --- old/Coffin-0.3.7/PKG-INFO 2012-09-29 18:13:52.000000000 +0200 +++ new/Coffin-0.3.8/PKG-INFO 2013-06-28 12:49:59.000000000 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 1.0 Name: Coffin -Version: 0.3.7 +Version: 0.3.8 Summary: Jinja2 adapter for Django Home-page: http://github.com/coffin/coffin Author: David Cramer diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Coffin-0.3.7/README.rst new/Coffin-0.3.8/README.rst --- old/Coffin-0.3.7/README.rst 2012-09-29 18:12:34.000000000 +0200 +++ new/Coffin-0.3.8/README.rst 2013-05-08 22:24:51.000000000 +0200 @@ -19,7 +19,7 @@ - {% spaceless %} - {% url %} - additionally, a ``"view"|url()`` filter is also - available. + available. Or use ``view|url()`` for Django 1.5 style lookups by the value of ``view``. - {% with %} @@ -47,7 +47,8 @@ Jinja 2's ``i18n`` extension is hooked up with Django, and a custom version of makemessages supports string extraction from both Jinja2 and Django -templates. +templates. Just add 'coffin' to your INSTALLED_APPS and run makemessages as +usual, specifying additional Jinja extensions if necessary via the -e option. Autoescape ========== diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Coffin-0.3.7/coffin/__init__.py new/Coffin-0.3.8/coffin/__init__.py --- old/Coffin-0.3.7/coffin/__init__.py 2012-09-29 18:12:34.000000000 +0200 +++ new/Coffin-0.3.8/coffin/__init__.py 2013-06-28 12:48:57.000000000 +0200 @@ -14,7 +14,7 @@ __all__ = ('__version__', '__build__', '__docformat__', 'get_revision') -__version__ = (0, 3, '7') +__version__ = (0, 3, '8') __docformat__ = 'restructuredtext en' import os diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Coffin-0.3.7/coffin/common.py new/Coffin-0.3.8/coffin/common.py --- old/Coffin-0.3.7/coffin/common.py 2012-09-29 18:12:34.000000000 +0200 +++ new/Coffin-0.3.8/coffin/common.py 2012-11-26 20:52:42.000000000 +0100 @@ -73,7 +73,6 @@ warnings.warn('Cannot translate loader: %s' % loader) return loaders - def _get_templatelibs(self): """Return an iterable of template ``Library`` instances. @@ -81,30 +80,35 @@ register all libraries globally. """ from django.conf import settings - from django.template import get_library, InvalidTemplateLibrary + from django.template import ( + get_library, import_library, InvalidTemplateLibrary) libs = [] - for a in settings.INSTALLED_APPS: + for app in settings.INSTALLED_APPS: + ns = app + '.templatetags' try: - path = __import__(a + '.templatetags', {}, {}, ['__file__']).__file__ + path = __import__(ns, {}, {}, ['__file__']).__file__ path = os.path.dirname(path) # we now have the templatetags/ directory except ImportError: pass else: - for f in os.listdir(path): - if f == '__init__.py' or f.startswith('.'): + for filename in os.listdir(path): + if filename == '__init__.py' or filename.startswith('.'): continue - if f.endswith('.py'): + if filename.endswith('.py'): try: - # TODO: will need updating when #6587 lands - # libs.append(get_library( - # "django.templatetags.%s" % os.path.splitext(f)[0])) - l = get_library(os.path.splitext(f)[0]) + module = "%s.%s" % (ns, os.path.splitext(filename)[0]) + l = import_library(module) libs.append(l) except InvalidTemplateLibrary: pass + + # In addition to loading application libraries, support a custom list + for libname in getattr(settings, 'JINJA2_DJANGO_TEMPLATETAG_LIBRARIES', ()): + libs.append(get_library(libname)) + return libs def _get_all_extensions(self): @@ -168,19 +172,10 @@ tests.update(from_setting('JINJA2_TESTS', True)) filters.update(from_setting('JINJA2_FILTERS', True)) globals.update(from_setting('JINJA2_GLOBALS')) - # Finally, add extensions defined in application's templatetag libraries - libraries = self._get_templatelibs() - - # Load custom libraries. - from django.template import get_library - for libname in getattr(settings, 'JINJA2_DJANGO_TEMPLATETAG_LIBRARIES', ()): - libraries.append(get_library(libname)) - - for lib in libraries: + for lib in self._get_templatelibs(): _load_lib(lib) - attrs.update(getattr(lib, 'jinja2_environment_attrs', {})) return dict( extensions=extensions, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Coffin-0.3.7/coffin/conf/urls/defaults.py new/Coffin-0.3.8/coffin/conf/urls/defaults.py --- old/Coffin-0.3.7/coffin/conf/urls/defaults.py 2012-09-29 18:12:34.000000000 +0200 +++ new/Coffin-0.3.8/coffin/conf/urls/defaults.py 1970-01-01 01:00:00.000000000 +0100 @@ -1,4 +0,0 @@ -from django.conf.urls.defaults import * - -handler404 = 'coffin.views.defaults.page_not_found' -handler500 = 'coffin.views.defaults.server_error' \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Coffin-0.3.7/coffin/conf/urls.py new/Coffin-0.3.8/coffin/conf/urls.py --- old/Coffin-0.3.7/coffin/conf/urls.py 1970-01-01 01:00:00.000000000 +0100 +++ new/Coffin-0.3.8/coffin/conf/urls.py 2013-05-08 22:17:10.000000000 +0200 @@ -0,0 +1,4 @@ +from django.conf.urls import * + +handler404 = 'coffin.views.defaults.page_not_found' +handler500 = 'coffin.views.defaults.server_error' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Coffin-0.3.7/coffin/contrib/loader.py new/Coffin-0.3.8/coffin/contrib/loader.py --- old/Coffin-0.3.7/coffin/contrib/loader.py 2012-09-29 18:12:34.000000000 +0200 +++ new/Coffin-0.3.8/coffin/contrib/loader.py 2012-11-14 01:01:30.000000000 +0100 @@ -13,20 +13,26 @@ """ +from os.path import splitext from coffin.common import env from django.conf import settings from django.template.loaders import app_directories, filesystem JINJA2_DEFAULT_TEMPLATE_EXTENSION = getattr(settings, - 'JINJA2_DEFAULT_TEMPLATE_EXTENSION', '.jinja') + 'JINJA2_DEFAULT_TEMPLATE_EXTENSION', ('.jinja',)) + +if isinstance(JINJA2_DEFAULT_TEMPLATE_EXTENSION, basestring): + JINJA2_DEFAULT_TEMPLATE_EXTENSION = (JINJA2_DEFAULT_TEMPLATE_EXTENSION,) class LoaderMixin(object): is_usable = True def load_template(self, template_name, template_dirs=None): - if not template_name.endswith(JINJA2_DEFAULT_TEMPLATE_EXTENSION): + extension = splitext(template_name)[1] + + if not extension in JINJA2_DEFAULT_TEMPLATE_EXTENSION: return super(LoaderMixin, self).load_template(template_name, template_dirs) template = env.get_template(template_name) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Coffin-0.3.7/coffin/contrib/staticfiles/templatetags/static.py new/Coffin-0.3.8/coffin/contrib/staticfiles/templatetags/static.py --- old/Coffin-0.3.7/coffin/contrib/staticfiles/templatetags/static.py 1970-01-01 01:00:00.000000000 +0100 +++ new/Coffin-0.3.8/coffin/contrib/staticfiles/templatetags/static.py 2013-01-02 22:21:02.000000000 +0100 @@ -0,0 +1,38 @@ +from coffin import template +from django.contrib.staticfiles.storage import staticfiles_storage +from coffin.templatetags.static import StaticExtension + + +register = template.Library() + + +class StaticExtension(StaticExtension): + """Implements the {% static %} tag as provided by the ``staticfiles`` + contrib module. + + Rreturns the URL to a file using staticfiles' storage backend. + + Usage:: + + {% static path [as varname] %} + + Examples:: + + {% static "myapp/css/base.css" %} + {% static variable_with_path %} + {% static "myapp/css/base.css" as admin_base_css %} + {% static variable_with_path as varname %} + + """ + + @classmethod + def get_statc_url(cls, path): + return super(StaticExtension, cls).get_statc_url( + staticfiles_storage.url(path)) + + +register.tag(StaticExtension) + + +def static(path): + return StaticExtension.get_static_url(path) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Coffin-0.3.7/coffin/template/__init__.py new/Coffin-0.3.8/coffin/template/__init__.py --- old/Coffin-0.3.7/coffin/template/__init__.py 2012-09-29 18:12:34.000000000 +0200 +++ new/Coffin-0.3.8/coffin/template/__init__.py 2013-01-02 22:21:02.000000000 +0100 @@ -88,6 +88,10 @@ You can still use Django's own ``add_to_builtins`` to register directly with Django and bypass Coffin. + Once thing that is special about Coffin is that because {% load %} + is not supported in Coffin, *everything* it provides must be + registered through the builtins. + TODO: Allow passing path to (or reference of) extensions and filters directly. This would make it easier to use this function with 3rd party Jinja extensions that do not know about Coffin and @@ -103,4 +107,5 @@ add_to_builtins('coffin.template.defaulttags') add_to_builtins('coffin.template.defaultfilters') +add_to_builtins('coffin.templatetags.static') diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Coffin-0.3.7/coffin/template/defaultfilters.py new/Coffin-0.3.8/coffin/template/defaultfilters.py --- old/Coffin-0.3.7/coffin/template/defaultfilters.py 2012-09-29 18:12:34.000000000 +0200 +++ new/Coffin-0.3.8/coffin/template/defaultfilters.py 2013-05-08 22:32:18.000000000 +0200 @@ -39,23 +39,39 @@ @register.jinja2_filter(jinja2_only=True) def date(value, arg=None): + """Formats a date according to the given format.""" if value is None or isinstance(value, Undefined): return u'' from django.conf import settings + from django.utils import formats from django.utils.dateformat import format if arg is None: arg = settings.DATE_FORMAT - return format(value, arg) + try: + return formats.date_format(value, arg) + except AttributeError: + try: + return format(value, arg) + except AttributeError: + return '' @register.jinja2_filter(jinja2_only=True) def time(value, arg=None): + """Formats a time according to the given format.""" if value is None or isinstance(value, Undefined): return u'' from django.conf import settings + from django.utils import formats from django.utils.dateformat import time_format if arg is None: arg = settings.TIME_FORMAT - return time_format(value, arg) + try: + return formats.time_format(value, arg) + except AttributeError: + try: + return time_format(value, arg) + except AttributeError: + return '' @register.jinja2_filter(jinja2_only=True) def truncatewords(value, length): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Coffin-0.3.7/coffin/template/loaders.py new/Coffin-0.3.8/coffin/template/loaders.py --- old/Coffin-0.3.7/coffin/template/loaders.py 2012-09-29 18:12:34.000000000 +0200 +++ new/Coffin-0.3.8/coffin/template/loaders.py 2012-11-02 15:39:51.000000000 +0100 @@ -1,5 +1,8 @@ +import re from jinja2 import loaders +match_loader = re.compile(r'^(django|coffin)\.') + def jinja_loader_from_django_loader(django_loader, args=None): """Attempts to make a conversion from the given Django loader to an @@ -9,7 +12,7 @@ :return: The similarly-behaving Jinja loader, or None if a similar loader could not be found. """ - if not django_loader.startswith('django.'): + if not match_loader.match(django_loader): return None for substr, func in _JINJA_LOADER_BY_DJANGO_SUBSTR.iteritems(): if substr in django_loader: @@ -46,6 +49,8 @@ 'app_directories': _make_jinja_app_loader, 'filesystem': _make_jinja_filesystem_loader, 'cached': _make_jinja_cached_loader, + 'AppLoader': _make_jinja_app_loader, + 'FileSystemLoader': _make_jinja_filesystem_loader, } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Coffin-0.3.7/coffin/templatetags/static.py new/Coffin-0.3.8/coffin/templatetags/static.py --- old/Coffin-0.3.7/coffin/templatetags/static.py 1970-01-01 01:00:00.000000000 +0100 +++ new/Coffin-0.3.8/coffin/templatetags/static.py 2013-01-02 22:21:02.000000000 +0100 @@ -0,0 +1,130 @@ +try: + from urllib.parse import urljoin +except ImportError: # Python 2 + from urlparse import urljoin + +from coffin.template import Library +from jinja2.ext import Extension +from jinja2 import nodes +from django.utils.encoding import iri_to_uri + + +register = Library() + + +class PrefixExtension(Extension): + + def parse(self, parser): + stream = parser.stream + lineno = stream.next().lineno + + call_node = self.call_method('render') + + if stream.next_if('name:as'): + var = nodes.Name(stream.expect('name').value, 'store') + return nodes.Assign(var, call_node).set_lineno(lineno) + else: + return nodes.Output([call_node]).set_lineno(lineno) + + def render(self, name): + raise NotImplementedError() + + @classmethod + def get_uri_setting(cls, name): + try: + from django.conf import settings + except ImportError: + prefix = '' + else: + prefix = iri_to_uri(getattr(settings, name, '')) + return prefix + + +class GetStaticPrefixExtension(PrefixExtension): + """ + Populates a template variable with the static prefix, + ``settings.STATIC_URL``. + + Usage:: + + {% get_static_prefix [as varname] %} + + Examples:: + + {% get_static_prefix %} + {% get_static_prefix as static_prefix %} + + """ + + tags = set(['get_static_prefix']) + + def render(self): + return self.get_uri_setting('STATIC_URL') + + +class GetMediaPrefixExtension(PrefixExtension): + """ + Populates a template variable with the media prefix, + ``settings.MEDIA_URL``. + + Usage:: + + {% get_media_prefix [as varname] %} + + Examples:: + + {% get_media_prefix %} + {% get_media_prefix as media_prefix %} + + """ + + tags = set(['get_media_prefix']) + + def render(self): + return self.get_uri_setting('STATIC_URL') + + +class StaticExtension(PrefixExtension): + """ + Joins the given path with the STATIC_URL setting. + + Usage:: + + {% static path [as varname] %} + + Examples:: + + {% static "myapp/css/base.css" %} + {% static variable_with_path %} + {% static "myapp/css/base.css" as admin_base_css %} + {% static variable_with_path as varname %} + + """ + + tags = set(['static']) + + def parse(self, parser): + stream = parser.stream + lineno = stream.next().lineno + + path = parser.parse_expression() + call_node = self.call_method('get_statc_url', args=[path]) + + if stream.next_if('name:as'): + var = nodes.Name(stream.expect('name').value, 'store') + return nodes.Assign(var, call_node).set_lineno(lineno) + else: + return nodes.Output([call_node]).set_lineno(lineno) + + @classmethod + def get_statc_url(cls, path): + return urljoin(PrefixExtension.get_uri_setting("STATIC_URL"), path) + + +register.tag(GetStaticPrefixExtension) +register.tag(GetMediaPrefixExtension) +register.tag(StaticExtension) + + +def static(path): + return StaticExtension.get_static_url(path) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Coffin-0.3.7/coffin/views/generic/__init__.py new/Coffin-0.3.8/coffin/views/generic/__init__.py --- old/Coffin-0.3.7/coffin/views/generic/__init__.py 2012-09-29 18:12:34.000000000 +0200 +++ new/Coffin-0.3.8/coffin/views/generic/__init__.py 2013-05-08 22:29:14.000000000 +0200 @@ -1 +1,15 @@ -from django.views.generic import * +from django.views.generic import GenericViewError +try: + from django.views.generic.base import View, RedirectView +except ImportError: + pass +else: + from coffin.views.generic.base import TemplateView + from coffin.views.generic.dates import (ArchiveIndexView, YearArchiveView, + MonthArchiveView, WeekArchiveView, + DayArchiveView, TodayArchiveView, + DateDetailView) + from coffin.views.generic.detail import DetailView + from coffin.views.generic.edit import (FormView, CreateView, UpdateView, + DeleteView) + from coffin.views.generic.list import ListView -- To unsubscribe, e-mail: opensuse-commit+unsubscr...@opensuse.org For additional commands, e-mail: opensuse-commit+h...@opensuse.org