[Grok-dev] regebro-guido-templates: comments

Lennart Regebro regebro at gmail.com
Wed Oct 17 13:51:25 EDT 2007


On 10/16/07, Martijn Faassen <faassen at startifact.com> wrote:
> * We should seriously reconsider the naming_convention. Several methods
> are added that have underscores in them. Zope 3's camelCase and we tend
> to mostly follow those conventions for Grok, and this would break that.
> Of course if we can come up with good single word method names we can
> forgo this entire discussion.

Yeah, I know. We flip-flopped because the camelCase names were so ugly.

> * having to do self.__grok_module__ = martian.util.caller_module()
> everywhere in the Genshi integration isn't very nice. I wonder whether
> we can set this information externally during the grokking process so it
> won't put a constraint on subclassing.

Yeah, if someboy can come up with a clever solution for this one, that
would be great. I only understand this to 75% (or rather, I may
understand it, but I'm not at all sure I do.)

> I think the responsibility for setting up the namespace should be
> primarily in the template language implementation. Therefore I'd suggest
> we move default_namespace() to the template language implementation,
> something like this:
>
> def namespace(self, view):
>      namespace = {}
>      namespace['request'] = view.request
>      namespace['view'] = view
>      namespace['context'] = view.context
>      namespace['static'] = view.static
>      return namespace
>
> Since we access view consistently here that indeed suggests the method
> should be on View. I think we're dealing with an exception here though,
> as the control needs to be with the template language. If we think we
> need to we can always introduce a helper method on the view to help set
> this up, but I think this is so simple it's not really required at all.

Well, if not you just extended the code needed for the Genshi
integration with four lines, which is a significant amount in the
already short code. ;-)

> Note that incidentally I eliminated the naming discussion, as both these
> methods are called 'namespace()'. (following Brandon's suggestion in an
> earlier thread)

Yeah, that's better, and makes sense when you switch the responsabilities.

-- 
Lennart Regebro: Zope and Plone consulting.
http://www.colliberty.com/
+33 661 58 14 64


More information about the Grok-dev mailing list