Make it easier to build Zope3 + MySQL applications

Bug #56853 reported by Michael R. Bernstein
6
Affects Status Importance Assigned to Milestone
sqlobject (Ubuntu)
Invalid
Wishlist
Unassigned
zope3 (Debian)
Fix Released
Unknown
zope3 (Ubuntu)
Won't Fix
Wishlist
Unassigned

Bug Description

I recently started delving into building a Zope3 + MySQL application on Ubuntu Dapper. Here are the steps I had to do:

I've elided starting and stopping the Zope3 process, the false starts, and dead ends.

        Install the zope3-sandbox package, which gets all dependencies for Zope3, and sets up a sandbox instance at /var/lib/zope3/instance/sandbox/

        Add my Ubuntu login user to the 'zope' group (makes editing easier).
        Make sure the sandbox and all subfolders are writable by group:
                sudo chmod -R g+w /var/lib/zope3/instance/sandbox/

        install mysql-server package

        install mysql-client package

        install mysqladmin package

        Install setuptools with ez_setup.py, as described here:
                http://peak.telecommunity.com/DevCenter/EasyInstall#installation-instructions

        Install SQLObject by running:
                sudo easy_install 'sqlobject'
                (this is because the Dapper package of SQLObject conflicts with SQLOS)

        Install SQLOS (Zope3 SQLObject Support) by running:
                sudo easy_install 'sqlos'

        Download a tarball of SQLOS:
        http://cheeseshop.python.org/pypi/sqlos/

        From the tarball, extract the four files
        in /sqlos-0.2.1/includes/ to /var/lib/zope3/instance/sandbox/etc/package-includes/

After that, I had to do some fiddling to get the sample app included with SQLOS working with MySQL:

        Go to /var/lib/zope3/instance/sandbox/lib/python/ and do a subversion checkout of the MySQLdbDA trunk:
                svn co svn://svn.zope.org/repos/main/mysqldbda/trunk mysqldbda

        Create a file named 'mysqldbda-configure.zcml'
        inside /var/lib/zope3/instance/sandbox/etc/package-includes/
        with the following contents:
                <include package='mysqldbda' />

Edit /usr/lib/python2.4/site-packages/sqlos-0.2.1-py2.4.egg/sqlos/ftesting.zcml to use the 'mysql' DB adapter predefined in the file instead of the 'sqlite' one.

        Added a testdb to MySQL, and a testuser (with a password of testuser) with full privileges on that DB:
                mysqladmin --user=root -p create testdb

                mysql> grant select, insert, update, create, alter,
                delete, drop ON testdb.* to testuser@localhost
                identified by 'testuser';

        Create the required sample_person table:
                CREATE TABLE `sample_person` (
                  `fullname` varchar(50) NOT NULL default '',
                  `username` varchar(20) NOT NULL default '',
                  `password` varchar(20) NOT NULL default '',
                  `id` int(11) NOT NULL auto_increment,
                  PRIMARY KEY (`id`)
                ) ENGINE=MyISAM DEFAULT CHARSET=latin1

         Create the required dog and sample_isolated_person tables:
                (details elided)

After accomplishing all of that, Zope now has a new 'SQLObject MultiContainer' available that you can add through the web, and to which you can then add simple 'Person' objects that are persistent in the table. Adding a second container shows the same person objects as exist in the first. Deleting a person deletes the record. Deleting the containers does not.

After deleting all the added containers, deleting the
sqlos.ftesting-configure.zcml file from /var/lib/zope3/instance/sandbox/etc/package-includes disables the sample app objects from being addable in Zope.

The following enhancements are requested:

1) Add a package to Ubuntu for MySQLdbDA, so a subversion source checkout is not necessary (Debian bug: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=345831)

2) Updating SQLObject under Dapper to 0.7 in order to support SQLOS. (Edgy has the newer version)

3) Add a package to Ubuntu for SQLOS for gluing Zope3 and MySQL together via SQLObject.

Revision history for this message
In , Laurent Bigonville (bigon) wrote :

submitter 323296 !
submitter 355415 !
submitter 349802 !
submitter 345831 !
submitter 333012 !
submitter 299264 !
submitter 248234 !
thanks

Revision history for this message
Michael R. Bernstein (webmaven) wrote :
Download full text (3.9 KiB)

I recently started delving into building a Zope3 + MySQL application on Ubuntu Dapper. Here are the steps I had to do:

I've elided starting and stopping the Zope3 process, the false starts, and dead ends.

        Install the zope3-sandbox package, which gets all dependencies for Zope3, and sets up a sandbox instance at /var/lib/zope3/instance/sandbox/

        Add my Ubuntu login user to the 'zope' group (makes editing easier).
        Make sure the sandbox and all subfolders are writable by group:
                sudo chmod -R g+w /var/lib/zope3/instance/sandbox/

        install mysql-server package

        install mysql-client package

        install mysqladmin package

        Install setuptools with ez_setup.py, as described here:
                http://peak.telecommunity.com/DevCenter/EasyInstall#installation-instructions

        Install SQLObject by running:
                sudo easy_install 'sqlobject'
                (this is because the Dapper package of SQLObject conflicts with SQLOS)

        Install SQLOS (Zope3 SQLObject Support) by running:
                sudo easy_install 'sqlos'

        Download a tarball of SQLOS:
        http://cheeseshop.python.org/pypi/sqlos/

        From the tarball, extract the four files
        in /sqlos-0.2.1/includes/ to /var/lib/zope3/instance/sandbox/etc/package-includes/

After that, I had to do some fiddling to get the sample app included with SQLOS working with MySQL:

        Go to /var/lib/zope3/instance/sandbox/lib/python/ and do a subversion checkout of the MySQLdbDA trunk:
                svn co svn://svn.zope.org/repos/main/mysqldbda/trunk mysqldbda

        Create a file named 'mysqldbda-configure.zcml'
        inside /var/lib/zope3/instance/sandbox/etc/package-includes/
        with the following contents:
                <include package='mysqldbda' />

Edit /usr/lib/python2.4/site-packages/sqlos-0.2.1-py2.4.egg/sqlos/ftesting.zcml to use the 'mysql' DB adapter predefined in the file instead of the 'sqlite' one.

        Added a testdb to MySQL, and a testuser (with a password of testuser) with full privileges on that DB:
                mysqladmin --user=root -p create testdb

                mysql> grant select, insert, update, create, alter,
                delete, drop ON testdb.* to testuser@localhost
                identified by 'testuser';

        Create the required sample_person table:
                CREATE TABLE `sample_person` (
                  `fullname` varchar(50) NOT NULL default '',
                  `username` varchar(20) NOT NULL default '',
                  `password` varchar(20) NOT NULL default '',
                  `id` int(11) NOT NULL auto_increment,
                  PRIMARY KEY (`id`)
                ) ENGINE=MyISAM DEFAULT CHARSET=latin1

                Create the required dog and sample_isolated_person tables: (details elided)

After accomplishing all of that, Zope now has a new 'SQLObject MultiContainer' available that you can add through the web, and to which you can then add simple 'Person' objects that are persistent ...

Read more...

Revision history for this message
Michael R. Bernstein (webmaven) wrote :

BTW, this is an enhancement request.

Revision history for this message
Andrew Mitchell (ajmitch) wrote :

Updating dapper packages is unlikely to happen, but it's possible to get these new packages into edgy if someone picks them up in time.

Changed in sqlobject:
importance: Untriaged → Wishlist
Changed in zope3:
importance: Untriaged → Wishlist
Changed in zope3:
status: Unknown → Unconfirmed
description: updated
Revision history for this message
In , David Moreno Garza (damog-merkel) wrote : WNPP bug closing

Hello,

This is an automatic mail sent to close the RFP you have reported or
are involved with.

Your RFP wnpp bug is being closed because of the following reasons:
- It is, as of today, older than 365 days.
- It hasn't had any activity recently.

As this is an automatic procedure, it could of course have something
wrong and probably it would be closing some bugs that are not
intended by owners and submitters (like you) to be closed, for
example if the RFP is still of your interest, or there has been
some kind of activity around it. In that case, please reopen the
bug, do it, DO IT NOW! (I don't want to be blamed because of
mass closing and not let people know that they can easily reopen
their bugs ;-).

To re-open it, you simply have to mail <email address hidden>
with a body text like this:

 reopen 345831
 stop

Further comments on the work done in the bug sent to
<email address hidden> would be truly welcomed.
Anyway, if you have any kind of problems when dealing with
the BTS, feel free to contact me and I'd be more than happy to help
you on this: <email address hidden>.

A similar process is being applied to other kind of wnpp bugs.

Thanks for your cooperation,

 -- David Moreno Garza <email address hidden>.

Changed in zope3:
status: Unconfirmed → Fix Released
Revision history for this message
Matthias Klose (doko) wrote :

zope3 was removed from karmic; closing this report as won't fix.

Changed in zope3 (Ubuntu):
status: New → Won't Fix
Changed in sqlobject (Ubuntu):
status: New → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.