# HG changeset patch # User Thierry Florac # Date 1498562770 -7200 # Node ID 65e4710b699f4b3d46aeb46917e7f0752c7acd71 # Parent e82b56583f6583832fbba2de9beaf566848d6f27 Updated docstring diff -r e82b56583f65 -r 65e4710b699f src/pyams_i18n/expr.py --- a/src/pyams_i18n/expr.py Wed Jun 21 16:23:21 2017 +0200 +++ b/src/pyams_i18n/expr.py Tue Jun 27 13:26:10 2017 +0200 @@ -25,7 +25,12 @@ def render_i18n_expression(econtext, name): - """Render an I18n expression""" + """Render an I18n expression + + Value can be given as a single attribute name (for example: "i18n:title"), in which case value + is extracted from current "context". + But value can also be given as a dotted name, for example "i18n:local_var.property.title". + """ name = name.strip() if '.' in name: @@ -35,8 +40,7 @@ context = getattr(context, name) attr = names[-1] else: - context_name = 'context', - context = econtext.get(context_name) + context = econtext.get('context') attr = name request = econtext.get('request') return II18n(context).query_attribute(attr, request=request)