Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Zope: CMF

Proposal: Action expression contexts

 

 

Zope cmf RSS feed   Index | Next | Previous | View Threaded


miles at jamkit

Mar 31, 2009, 2:10 AM

Post #1 of 3 (1059 views)
Permalink
Proposal: Action expression contexts

Hi,

One of the things that we find slightly cumbersome here in our
applications is that when defining actions, there's no easy way to
adjust the variables available to an expression. This tends to make the
expressions longer and harder to read, plus commonly used variables are
calculated multiple times.

For example, my application has a concept of a "page", and I would like
to make this available as a variable rather than work it out each time.

Therefore I think it would be useful to adjust getExprContext in
CMFCore.Expression so that it is pluggable, by using a factory to create
the ExpressionContext. In that way I can register different ones as
required.

Is this a desirable change?

Miles

_______________________________________________
Zope-CMF maillist - Zope-CMF [at] lists
http://mail.zope.org/mailman/listinfo/zope-cmf

See https://bugs.launchpad.net/zope-cmf/ for bug reports and feature requests


optilude+lists at gmail

Mar 31, 2009, 5:16 AM

Post #2 of 3 (986 views)
Permalink
Re: Proposal: Action expression contexts [In reply to]

Miles wrote:
> Hi,
>
> One of the things that we find slightly cumbersome here in our
> applications is that when defining actions, there's no easy way to
> adjust the variables available to an expression. This tends to make the
> expressions longer and harder to read, plus commonly used variables are
> calculated multiple times.
>
> For example, my application has a concept of a "page", and I would like
> to make this available as a variable rather than work it out each time.
>
> Therefore I think it would be useful to adjust getExprContext in
> CMFCore.Expression so that it is pluggable, by using a factory to create
> the ExpressionContext. In that way I can register different ones as
> required.
>
> Is this a desirable change?

+1

It'd be nice to used named adapters on the context to achieve this. You
look up all named adapters from the action context to some interface.
This way, you can plug in new ones, override per type, and override by
name, if required.

Note that actions are currently a performance bottleneck in Plone. We
should at least try not to make it slower, and see if we can make it faster.

Martin

--
Author of `Professional Plone Development`, a book for developers who
want to work with Plone. See http://martinaspeli.net/plone-book

_______________________________________________
Zope-CMF maillist - Zope-CMF [at] lists
http://mail.zope.org/mailman/listinfo/zope-cmf

See https://bugs.launchpad.net/zope-cmf/ for bug reports and feature requests


dieter at handshake

Apr 1, 2009, 12:11 PM

Post #3 of 3 (981 views)
Permalink
Re: Proposal: Action expression contexts [In reply to]

Miles wrote at 2009-3-31 10:10 +0100:
>One of the things that we find slightly cumbersome here in our
>applications is that when defining actions, there's no easy way to
>adjust the variables available to an expression. This tends to make the
>expressions longer and harder to read, plus commonly used variables are
>calculated multiple times.
>
>For example, my application has a concept of a "page", and I would like
>to make this available as a variable rather than work it out each time.
>
>Therefore I think it would be useful to adjust getExprContext in
>CMFCore.Expression so that it is pluggable, by using a factory to create
>the ExpressionContext. In that way I can register different ones as
>required.
>
>Is this a desirable change?

I like it.



--
Dieter
_______________________________________________
Zope-CMF maillist - Zope-CMF [at] lists
http://mail.zope.org/mailman/listinfo/zope-cmf

See https://bugs.launchpad.net/zope-cmf/ for bug reports and feature requests

Zope cmf RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.