Newbie question: sample code doesn't work in 0.8b1?

Skip to first unread message

Jan 24, 2013, 9:56:23 AM1/24/13
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/, create the supplied templates for photo.mako and photo_index.mako, and enable it in But when I attempt to build I get the following:

(blogofile)[achakraberti@fragged]:~>blogofile build -s
ERROR: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/", line 58, in main
  File "/home/achakraberti/.virtualenvs/blogofile/local/lib/python2.7/site-packages/Blogofile-0.8b1-py2.7.egg/blogofile/", line 388, in do_build
  File "/home/achakraberti/.virtualenvs/blogofile/local/lib/python2.7/site-packages/Blogofile-0.8b1-py2.7.egg/blogofile/", line 49, in write_site
  File "/home/achakraberti/.virtualenvs/blogofile/local/lib/python2.7/site-packages/Blogofile-0.8b1-py2.7.egg/blogofile/", line 162, in __run_controllers
  File "/home/achakraberti/.virtualenvs/blogofile/local/lib/python2.7/site-packages/Blogofile-0.8b1-py2.7.egg/blogofile/", line 229, in run_all
  File "_controllers/", line 18, in run
  File "_controllers/", 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 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.


Reply all
Reply to author
0 new messages