Chris Withers <[EMAIL PROTECTED]> wrote:
> Martijn Faassen wrote:
>> class TemplateView(grok.View):
>> template = unassociated
>> module_info = module_info_
> I'm not sure. Debugging becomes a nightmare with generated classes,
> which is how I ran into these problems in the first place.
> Can you explain what the what the above code snippet actually does?
It generates a view for a template file that doesn't have its own view.
>> I've done it too recently in the form support. The *real* formlib-level
>> form class is dynamically created for each grok-level form:
>> class RealEditForm(form.EditForm):
>> form_fields = get_form_fields(factory, context)
>> actions = actions_
>> This one is a bit more scary, as the end-user interacts with an
>> *instance* of this class; the form attribute on grok-level forms is one.
> There must be a nicer way :-S
Possibly. It's not that bad right now. The difficulty is that I do
need to generate a class, not an instance, as I can only initialize the
instance when the view is initialized because the context and request
I could probably do some scary hacking to make it an instance after all,
but that will make the code far less easy to understand.
Zope3-dev mailing list