Welcome, guest | Sign In | My Account | Store | Cart

Notice! PyPM is being replaced with the ActiveState Platform, which enhances PyPM’s build and deploy capabilities. Create your free Platform account to download ActivePython or customize Python with the packages you require and get automatic updates.

Download
ActivePython
INSTALL>
pypm install products.sqlpfgadapter

How to install Products.sqlpfgadapter

  1. Download and install ActivePython
  2. Open Command Prompt
  3. Type pypm install products.sqlpfgadapter
 Python 2.7Python 3.2Python 3.3
Windows (32-bit)
1.0.1 Available View build log
0.1b2 Available View build log
0.1a2 Available View build log
Windows (64-bit)
1.0.1 Available View build log
0.1b2 Available View build log
0.1a2 Available View build log
Mac OS X (10.5+)
1.0.1 Available View build log
0.1b2 Available View build log
0.1a2 Available View build log
Linux (32-bit)
1.0.1 Available View build log
0.1b2 Available View build log
0.1a2 Available View build log
Linux (64-bit)
1.0.1 Available View build log
0.1b2 Available View build log
0.1a2 Available View build log
 
Author
License
GPL
Lastest release
version 1.0.1 on Jan 10th, 2011

Introduction

The goal for this package is:

  • to make SQL storage from PloneFormGen easy
  • to be usable with collective.megaphone

To achieve this, we create a new PloneFormGen action-adapter. This uses SQLAlchemy (collective.lead) to save the form data to the database. (SQLAlchemy should work on most SQL dialects.)

You could also save PFG data in SQL by using a Z SQL Method as an after-validation script, as described in the SQL-CRUD-tutorial. This works, but:

Installing

Developers

To install a complete development setup:

svn co https://svn.plone.org/svn/collective/Products.PloneFormGen/adapters/Products.sqlpfgadapter/buildout/plone4 sqlpfg-plone4
cd sqlpfg-plone4
python2.6 bootstrap.py
./bin/buildout -c buildout-dvl.cfg

Or, for Plone 3:

svn co https://svn.plone.org/svn/collective/Products.PloneFormGen/adapters/Products.sqlpfgadapter/buildout/plone3 sqlpfg-plone3
cd sqlpfg-plone3
python2.4 bootstrap.py
./bin/buildout -c buildout-dvl.cfg

If you use another buildout configuration, be sure to include the "Known good set" for plone.app.registry for your version of Plone. In the case of Plone 3, you'll also want to pin z3c.form to 1.9.0.

Configuration

As a site admin, go to the "SQL Settings" in Plone's control panel. You'll be taken to "@@sqlpfg-controlpanel". Here you can set your database connection settings.

Usage

To save a form's data in the database, add an "SQL Storage" from the "Add new..." menu in the Form Folder. Give it a title and save it.

A database table will be created. Its name is generated (from the Form Folder's id, among others), you can see it by viewing the adapter object. The table has an 'id' column, and a column for each form field.

That's it! From now on, succesfully submitted forms will be stored in the database.

Usage with collective.megaphone

The product will work just as well with collective.megaphone. However, to be able to add the action adapter to an Action Letter or Megaphone Action, you have to add "SQLPFGAdapter" to the "Allowed content types" via the ZMI.

The product collective.megaphonesql can do this for you.

Limitations

This product is under development. For now, we have major limitations:

  • Not all PloneFormGen fields work, notably:
    • file field
    • rating-scale field
  • Adding and removing fields, or changing their names, doesn't change the database table. Field names for which there is no column will just be discarded.

Compatibility / Dependencies

Tested with:

  • Plone: 3.3.5, 4.0
  • PloneFormGen: 1.6.0b4, 1.6.0b5
  • megaphone: 1.4.1, 2.0b1
  • collective.lead 1.0, SQLAlchemy 0.4.8
  • SQL: MySQL 5.1.41

This product uses plone.app.registry for its controlpanel. In order for it to work, use its "Known good set" (see section "Developers" above).

Changelog

1.0.1 (2011-01-10)

Re-release as source dist.

1.0.0 (2010-11-10)

Python 2.4 binary release.

0.1b2 (2010-09-26)
  • typo in sqlApadapter.py
0.1b1 (2010-09-26)
  • Updated doc (tested and works on Plone 4)
  • Add handling for decimal form field
0.1a2 (2010-09-22)
  • Renamed all "MySQL" to "SQL", including content types. No upgrade provided!
  • Added documentation about usage with collective.megaphone.
0.1a1 (2010-09-20)
  • Initial release

Subscribe to package updates

Last updated Jan 10th, 2011

Download Stats

Last month:1

What does the lock icon mean?

Builds marked with a lock icon are only available via PyPM to users with a current ActivePython Business Edition subscription.

Need custom builds or support?

ActivePython Enterprise Edition guarantees priority access to technical support, indemnification, expert consulting and quality-assured language builds.

Plan on re-distributing ActivePython?

Get re-distribution rights and eliminate legal risks with ActivePython OEM Edition.