Re: current context in edit mode

Dan Jacka <[email protected]>
Newsgroups gmane.comp.web.zope.plone.devel
Message-ID <[email protected]>
Hi Luke,

On 19/07/13 10:46, Luke Brannon wrote:
> In Plone 4.x is there a programmatic way to determine if the current
> context is in edit mode?  I'm attempting to write a python expression to
> prevent a javascript from loading when the AT content type is being edited.
>
> Regards,
>
> Luke

The plone_context_state view in plone.app.layout has the 
is_view_template method, which might be what you want.

Try it by adding the following condition to your JavaScript file in 
portal_javascripts:

python:context.restrictedTraverse('@@plone_context_state').is_view_template()

HTH,
Dan

------------------------------------------------------------------------------
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.