O'Reilly logo

Professional Plone Development: Building robust, content-centric web applications with Plone 3, an open source Content Management System by Martin Aspeli

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Writing the Database Utilities

Now that we have the means to access the database, and the full power of SQLAlchemy at our fingertips, implementing the utilities that perform database operations is easy.

Database Tests

Of course, we should start with the tests. We have opted to use a doctest to demonstrate the database interaction pattern, found in tests/database.txt, and invoked with the following lines in tests/test_doctest.py:

ztc.ZopeDocFileSuite(
    'tests/database.txt', package='optilux.cinemacontent',
    test_class=base.CinemaContentFunctionalTestCase,
    optionflags=doctest.REPORT_ONLY_FIRST_FAILURE |
                 doctest.NORMALIZE_WHITESPACE | doctest.ELLIPSIS),

These tests create some sample content, populate a few records in the database, and then exercise the ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required