hyde/hyde — Issue #153: Expando dies if you have a tag "transform"
Author: pib
Created: 2012-02-21 18:47:57+00:00
State: open

As shown in pull request https://github.com/hyde/hyde/pull/152

Using the basic layout, if you add the tag "transform" to a blog post, you get this error:

Traceback (most recent call last):
File "/Users/pbonser/.virtualenvs/blog/bin/hyde", line 9, in
load_entry_point('hyde==0.8.5a14', 'console_scripts', 'hyde')()
File "/Users/pbonser/.virtualenvs/blog/src/hyde/hyde/main.py", line 10, in main
Engine().run()
File "/Users/pbonser/.virtualenvs/blog/src/hyde/hyde/engine.py", line 39, in run
super(Engine, self).run(args)
File "/Users/pbonser/.virtualenvs/blog/lib/python2.7/site-packages/commando.py", line 198, in run
args.run(self, args)
File "/Users/pbonser/.virtualenvs/blog/src/hyde/hyde/engine.py", line 118, in gen
gen.generate_all(incremental=incremental)
File "/Users/pbonser/.virtualenvs/blog/src/hyde/hyde/generator.py", line 202, in generate_all
self.events.begin_site()
File "/Users/pbonser/.virtualenvs/blog/src/hyde/hyde/plugin.py", line 47, in __call_plugins__
res = function(*args)
File "/Users/pbonser/.virtualenvs/blog/src/hyde/hyde/ext/plugins/tagger.py", line 106, in begin_site
self.site.tagger = Expando(dict(tags=tags))
File "/Users/pbonser/.virtualenvs/blog/src/hyde/hyde/model.py", line 23, in __init__
self.update(d)
File "/Users/pbonser/.virtualenvs/blog/src/hyde/hyde/model.py", line 39, in update
self.set_expando(key, value)
File "/Users/pbonser/.virtualenvs/blog/src/hyde/hyde/model.py", line 48, in set_expando
setattr(self, unicode(key).encode('utf-8'), self.transform(value))
File "/Users/pbonser/.virtualenvs/blog/src/hyde/hyde/model.py", line 57, in transform
return Expando(primitive)
File "/Users/pbonser/.virtualenvs/blog/src/hyde/hyde/model.py", line 23, in __init__
self.update(d)
File "/Users/pbonser/.virtualenvs/blog/src/hyde/hyde/model.py", line 39, in update
self.set_expando(key, value)
File "/Users/pbonser/.virtualenvs/blog/src/hyde/hyde/model.py", line 48, in set_expando
setattr(self, unicode(key).encode('utf-8'), self.transform(value))
TypeError: 'Tag' object is not callable

The way the Expando class fills in its own attributes is a bit dangerous, since arbitrary tags could cause it to explode like this...