Posts tagged 'pfg'

Checking Plone REQUEST for Ajax’d requests (XMLHttpRequest)

Recently, I’ve needed a PloneFormGen (PFG) form of mine to have certain fields excluded when the form is displayed in one of Plone 4’s fancy popups.  At the same time, I need this field to still persist within the ‘standard’ view of the form.  It’s the request object to the rescue, and all I’ve had to do is insert this TALES expression against the Enabling Expression for my PFG field:

python:request.environ.get('HTTP_X_REQUESTED_WITH') != 'XMLHttpRequest'

and the end result is that unless the request is one of XMLHttpRequest, then we’ll show the field.

Shouldn …

PloneFormGen (Plone) & Google Calendar Integration

It’s a little bit of a different mash-up, but it’s still nonetheless useful to have, given types of booking forms and so forth that could utilise it.  The easiest way I found (to avoid security issues with Python scripts in Plone) was to create an external method and just import it within a PFG Custom Adapter.

Parts

  • My GoogleCalendar.py external method.  I’ve had to add this into a policy product I have.  The function should be generalised enough to work with any Google account, hosted or not.  In short:

    • It takes in a variety of arguments …