Пример #1
0
    def __call__(self, context, view, request, name=u''):
        if context is None:
            return u''
        widget = getMultiAdapter((context, view, request,),
            IWidget, name=name)

        return render_widget(widget)
Пример #2
0
    def __call__(self, context, field_name, view, request, name=u''):
        field = get_field(context, field_name)
        if field is None:
            raise TypeError, 'invalid field name %s' % field_name
        field.bind(context)
        if IObject.providedBy(field):
            widget = getMultiAdapter((field.get(context), view,
                request,), name=name)
        else:
            widget = getMultiAdapter((field, view, request,),
                IFieldWidget, name=name)

        return render_widget(widget)