Hi Blogofilers,
I just found your wonderful package and forced myself to learn some useful HTML/CSS/mako template stuff to make my own themes with Blogofile 0.8b1. Now I have everything working well for my standard blog but I really need the photo gallery functionality. I thought I would try the sample photo_gallery code in blogofile docs here:
So I copy that code into _controllers/photo.gallery, create the supplied templates for photo.mako and photo_index.mako, and enable it in _config.py. But when I attempt to build I get the following:
(blogofile)[achakraberti@fragged]:~>blogofile build -s
testblog.comERROR:blogofile:Fatal build error occured, calling bf.config.build_exception()
Traceback (most recent call last):
File "/home/achakraberti/.virtualenvs/blogofile/bin/blogofile", line 9, in <module>
load_entry_point('Blogofile==0.8b1', 'console_scripts', 'blogofile')()
File "/home/achakraberti/.virtualenvs/blogofile/local/lib/python2.7/site-packages/Blogofile-0.8b1-py2.7.egg/blogofile/main.py", line 58, in main
args.func(args)
File "/home/achakraberti/.virtualenvs/blogofile/local/lib/python2.7/site-packages/Blogofile-0.8b1-py2.7.egg/blogofile/main.py", line 388, in do_build
writer.write_site()
File "/home/achakraberti/.virtualenvs/blogofile/local/lib/python2.7/site-packages/Blogofile-0.8b1-py2.7.egg/blogofile/writer.py", line 49, in write_site
self.__run_controllers()
File "/home/achakraberti/.virtualenvs/blogofile/local/lib/python2.7/site-packages/Blogofile-0.8b1-py2.7.egg/blogofile/writer.py", line 162, in __run_controllers
controller.run_all(namespaces)
File "/home/achakraberti/.virtualenvs/blogofile/local/lib/python2.7/site-packages/Blogofile-0.8b1-py2.7.egg/blogofile/controller.py", line 229, in run_all
c.mod.run()
File "_controllers/photo_gallery.py", line 18, in run
write_pages(photos)
File "_controllers/photo_gallery.py", line 29, in write_pages
bf.writer.materialize_template("photo.mako", (photos_dir,photo+".html"), {"photo":photo})
AttributeError: 'Writer' object has no attribute 'materialize_template'
OK, so this may be my Python ignorance, but I thought ok, let me try to just run the relevant bits from photo_gallery.py manually on python command line to see if I get a different result. Here's what I got:
Python 2.7.3 (default, Aug 1 2012, 05:14:39)
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> from blogofile.cache import bf
>>> photos_dir='pictures'
>>> photos = [p for p in os.listdir(photos_dir) if p.lower().endswith(".jpg")]
>>> photos
['IMAG1570.jpg', 'IMAG1571.jpg']
>>> for photo in photos:
... bf.writer.materialize_template("photo.mako", (photos_dir,photo+".html"), {"photo":photo})
...
Traceback (most recent call last):
File "<stdin>", line 2, in <module>
TypeError: __call__() takes exactly 1 argument (4 given)
So I am very confused - how can I make this simple controller work? Any help is appreciated.
Thanks!
--Anindya