2009/9/12 Chris McDonough <chr...@plope.com>:
> At some point I had considered using a Chameleon expression prefix to
> separate these sorts of "builtin" names from the main template namespace
> names.  For example, instead of "tal:replace="href api.context_url",
> you'd access builtins via an expression type, e.g. "tal:replace="href
> api:context_url".  That bugged Malthe because it's essentially a "second
> "python:" expression type that happens to not use the "main" template
> namespace.  I'm not sure about it either, because it's obvious that
> you'll want to use the names passed to the template explicitly in those
> expressions too, and the semantics and implementation could get pretty
> confusing if you need to make that possible.

I think if we did have an "api prefix" expression translator, it ought
to have a more declarative behavior, e.g. tal:attributes="src api:
context/url". I'm not sure "/" is the best character to use here, for
obvious reasons.

I've had a different idea for some time. In code:

  def some_view(obj, request):
    context = get_context(obj, request)
    return template(context=context)

Then, in the template, tal:attributes="src context.url".

This emaciates the idea that a context-object isn't a model object;
it's a model object in the context of some request. I think this
follows the Zope 2 interpretation of "context" quite well.

Repoze-dev mailing list

Reply via email to