def __call__(self, field, last = False, depth = 0, **kwargs):
        # if (prepend < 0 or append < 0 or span < 1 or
        #     prepend + append + span < 1 or prepend + append + span > 24):
        #     raise ValueError, "Grid parameters inappropriate"

        classes = []
        span, prepend, append = grid_parameters(depth)

        classes.append('span-{0}'.format(span))

        if append > 0  : classes.append('append-{0}'.format(append))
        if prepend > 0 : classes.append('prepend-{0}'.format(prepend))
        if last        : classes.append('last')

        for key in ['class', 'class_', 'class__']:
            if key in kwargs :  classes.append(kwargs[key])

        add_classes = ' '.join(classes)

        field.widget = self.widget
        return template_render(self.template, {
                'field'         : field,
                'grid_classes'  : add_classes,
                'span_class'    : 'span-{0}'.format(span),
                'width'         : span,
                'depth'         : depth
                })
    def __call__(self, doc, row, href, short = False):
        modified = doc.get('meta', {}).get('modified', None)
        if modified:
            modified_string = modified.strftime(_('%Y-%m-%d at %H:%M').encode('utf-8')).decode('utf-8')
        else:
            modified_string = None

        template = env.get_template('summary.html')
        context = self.context(doc)
        context['modified'] = modified_string
        context['short'] = short
        context['doc'] = doc
        context['row'] = row
        context['href'] = href
        context['doctype'] = doc['_type']
        return template_render(template, context)
 def __call__(self, field, **kwargs):
     template_params = PeriodWidget.template_params(field = field)
     return template_render(self.template, template_params)