[Python-modules-commits] [python-kajiki] 01/05: New upstream version 0.6.3
Takaki Taniguchi
takaki at moszumanska.debian.org
Tue Jun 27 09:29:37 UTC 2017
This is an automated email from the git hooks/post-receive script.
takaki pushed a commit to branch master
in repository python-kajiki.
commit b76fc7c49607210ef2d421fe8447e226df4c8216
Author: TANIGUCHI Takaki <takaki at asis.media-as.org>
Date: Tue Jun 27 18:17:07 2017 +0900
New upstream version 0.6.3
---
CHANGES.rst | 7 ++++++-
Kajiki.egg-info/PKG-INFO | 9 +++++++--
PKG-INFO | 9 +++++++--
kajiki/i18n.py | 17 +++++++++++++++--
kajiki/loader.py | 2 ++
kajiki/version.py | 2 +-
6 files changed, 38 insertions(+), 8 deletions(-)
diff --git a/CHANGES.rst b/CHANGES.rst
index 8910a74..9150aec 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -1,8 +1,13 @@
CHANGES
=======
+0.6.3 (2017-05-25)
+------------------
+
+* Added ``extract_python`` option to babel message extractor, this allows extracting gettext calls in ``${}`` expressions
+
0.6.1 (2016-11-28)
------------------
+------------------
* Actually report 0.6 in kajiki/version.py
* Expose ``strip_text`` option in loader
diff --git a/Kajiki.egg-info/PKG-INFO b/Kajiki.egg-info/PKG-INFO
index 5415aef..b6df910 100644
--- a/Kajiki.egg-info/PKG-INFO
+++ b/Kajiki.egg-info/PKG-INFO
@@ -1,6 +1,6 @@
Metadata-Version: 1.1
Name: Kajiki
-Version: 0.6.1
+Version: 0.6.3
Summary: Fast XML-based template engine with Genshi syntax and Jinja blocks
Home-page: https://github.com/nandoflorestan/kajiki
Author: Nando Florestan
@@ -78,8 +78,13 @@ Description: Kajiki provides fast well-formed XML templates
CHANGES
=======
+ 0.6.3 (2017-05-25)
+ ------------------
+
+ * Added ``extract_python`` option to babel message extractor, this allows extracting gettext calls in ``${}`` expressions
+
0.6.1 (2016-11-28)
- -----------------
+ ------------------
* Actually report 0.6 in kajiki/version.py
* Expose ``strip_text`` option in loader
diff --git a/PKG-INFO b/PKG-INFO
index 5415aef..b6df910 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,6 +1,6 @@
Metadata-Version: 1.1
Name: Kajiki
-Version: 0.6.1
+Version: 0.6.3
Summary: Fast XML-based template engine with Genshi syntax and Jinja blocks
Home-page: https://github.com/nandoflorestan/kajiki
Author: Nando Florestan
@@ -78,8 +78,13 @@ Description: Kajiki provides fast well-formed XML templates
CHANGES
=======
+ 0.6.3 (2017-05-25)
+ ------------------
+
+ * Added ``extract_python`` option to babel message extractor, this allows extracting gettext calls in ``${}`` expressions
+
0.6.1 (2016-11-28)
- -----------------
+ ------------------
* Actually report 0.6 in kajiki/version.py
* Expose ``strip_text`` option in loader
diff --git a/kajiki/i18n.py b/kajiki/i18n.py
index 28f9040..0e6b1e1 100644
--- a/kajiki/i18n.py
+++ b/kajiki/i18n.py
@@ -2,7 +2,8 @@
from __future__ import (absolute_import, division, print_function,
unicode_literals)
-from .ir import TranslatableTextNode
+from io import BytesIO
+from .ir import TranslatableTextNode, ExprNode
def gettext(s):
@@ -12,6 +13,14 @@ def gettext(s):
def extract(fileobj, keywords, comment_tags, options):
"""Babel entry point that extracts translation strings from XML templates."""
from .xml_template import _Parser, _Compiler, _DomTransformer
+
+ try:
+ from babel.messages.extract import extract_python
+ extract_expr = options.get('extract_python', False)
+ except ImportError:
+ extract_python = None
+ extract_expr = False
+
source = fileobj.read()
if isinstance(source, bytes):
source = source.decode('utf-8')
@@ -24,4 +33,8 @@ def extract(fileobj, keywords, comment_tags, options):
for node in ir:
if isinstance(node, TranslatableTextNode):
if node.text.strip():
- yield (node.lineno, '_', node.text, [])
\ No newline at end of file
+ yield (node.lineno, '_', node.text, [])
+ elif extract_expr and isinstance(node, ExprNode):
+ for e in extract_python(BytesIO(node.text.encode('utf-8')),
+ keywords, comment_tags, options):
+ yield (node.lineno, e[1], e[2], e[3])
\ No newline at end of file
diff --git a/kajiki/loader.py b/kajiki/loader.py
index 25fd978..b120fa2 100644
--- a/kajiki/loader.py
+++ b/kajiki/loader.py
@@ -87,6 +87,8 @@ class FileLoader(Loader):
options.update(kwargs)
filename = self._filename(name)
+ if filename is None:
+ raise IOError('Unknown template %r' % name)
self._timestamps[name] = os.stat(filename).st_mtime
if self._force_mode == 'text':
return TextTemplate(filename=filename,
diff --git a/kajiki/version.py b/kajiki/version.py
index 09418bb..82b8273 100644
--- a/kajiki/version.py
+++ b/kajiki/version.py
@@ -3,4 +3,4 @@ from __future__ import (absolute_import, division, print_function,
unicode_literals)
__version__ = '0.6'
-__release__ = '0.6.1'
+__release__ = '0.6.3'
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/python-kajiki.git
More information about the Python-modules-commits
mailing list