Generated: Wed 2013-03-13 10:33 CET
Source file: /media/Envs/Envs/filer-gallery/lib/python2.7/site-packages/sekizai/data.py
Stats: 0 executed, 16 missed, 0 excluded, 17 ignored
class SekizaiList(list):
"""
A sekizai namespace in a template.
"""
def __init__(self, namespace):
self._namespace = namespace
super(SekizaiList, self).__init__()
def append(self, obj):
"""
When content gets added, run the filters for this namespace.
"""
if obj not in self:
super(SekizaiList, self).append(obj)
def render(self, between='\n'):
"""
When the data get's rendered, run the postprocess filters.
"""
return between.join(self)
class SekizaiDictionary(dict):
"""
A dictionary which auto fills itself instead of raising key errors.
"""
def __init__(self):
super(SekizaiDictionary, self).__init__()
def __getitem__(self, item):
if item not in self:
self[item] = SekizaiList(item)
return super(SekizaiDictionary, self).__getitem__(item)