My favorites
▼
|
Sign in
json-template
Minimal but powerful templating language implemented in multiple languages
Project Home
Downloads
Wiki
Issues
Source
Export to GitHub
READ-ONLY: This project has been
archived
. For more information see
this post
.
Search
Search within:
All issues
Open issues
New issues
Issues to verify
for
Advanced search
Search tips
Subscriptions
Issue
75
attachment: dict.patch
(595 bytes)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
diff --git a/jsontemplate.py b/jsontemplate.py
index 1b60795..e706799 100644
--- a/jsontemplate.py
+++ b/jsontemplate.py
@@ -1094,9 +1094,11 @@ def _DoRepeatedSection(args, context, callback):
block = args
items = context.PushSection(block.section_name)
- # TODO: if 'items' is a dictionary, allow @name and @value.
if items:
+ if isinstance(items, dict):
+ items = [{'@name': k, '@value': v} for k,v in items.iteritems()]
+ context.stack[-1].context = items
if not isinstance(items, list):
raise EvaluationError('Expected a list; got %s' % type(items))
Powered by
Google Project Hosting