Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/page_builder.py
diff options
context:
space:
mode:
Diffstat (limited to 'page_builder.py')
-rw-r--r--page_builder.py28
1 files changed, 28 insertions, 0 deletions
diff --git a/page_builder.py b/page_builder.py
new file mode 100644
index 0000000..ded0214
--- /dev/null
+++ b/page_builder.py
@@ -0,0 +1,28 @@
+import os
+
+from sugar.datastore import datastore
+
+tfile = open('templates', 'r')
+templates = tfile.read()
+tfile.close()
+
+def fill_out_template(template, content):
+ template = templates.split('#!%s\n' % template)[1].split('\n!#')[0]
+ for x in content.keys():
+ template = template.replace('{%s}' % x, content[x])
+ return template
+
+def build_journal():
+ objects_starred, no = datastore.find({'keep': '1'})
+ print objects_starred, no
+
+ objects = [{'file': 'a', 'name': 'No Te Va Gustar - A las nueve', 'icon': 'audio-x-generic.svg'},
+ {'file': 'b', 'name': 'Perla jugando con el gato BOB', 'icon': 'image.svg'}]
+
+ objects_html = ''
+ for o in objects:
+ objects_html += '%s' % fill_out_template('object', o)
+
+ print fill_out_template('index', {'nick': 'Agus', 'objects': objects_html})
+
+build_journal()