[Zope-CVS] CVS: Products3/psycopgda - README.txt:1.3
configure.zcml:1.9
Sidnei da Silva
sidnei at awkly.org
Tue Jul 6 15:47:48 EDT 2004
Update of /cvs-repository/Products3/psycopgda
In directory cvs.zope.org:/tmp/cvs-serv18188
Modified Files:
README.txt configure.zcml
Log Message:
Update to work with (at least) Zope X3.0
=== Products3/psycopgda/README.txt 1.2 => 1.3 ===
--- Products3/psycopgda/README.txt:1.2 Wed Jan 22 10:44:10 2003
+++ Products3/psycopgda/README.txt Tue Jul 6 15:47:18 2004
@@ -1,127 +1,72 @@
This file outlines the basics of using Zope3 with PostgreSQL via PsycopgDA.
In this document I'm assuming your Zope3 lives in ~/Zope3.
-
Installing PsycopgDA
- 1. Check out the PsycopgDA product into ~/Zope3/src/zopeproducts
+ 1. Check out the PsycopgDA product into ~/Zope3/src
cd ~/Zope3/src
cvs -d :pserver:anonymous at cvs.zope.org:/cvs-repository login
cvs -d :pserver:anonymous at cvs.zope.org:/cvs-repository checkout \
- zopeproducts/psycopgda
+ psycopgda
- 2. Add the following line into ~/Zope3/products.zcml
+ 2. Create a file named 'psycopgda-configure.zcml' inside
+ ~/Zope3/package-includes with the following contents:
- <include package='zopeproducts.psycopgda' />
+ <include package='psycopgda' />
+Creating Database Connections
-Enabling SQL Connection Service
+ It is time to add some connections. A connection in Zope 3 is
+ registered as a utility.
3. Open a web browser on your Zope root folder (http://localhost:8080/ if
- you use the default settings in zserver.zcml).
-
- 4. Click on the 'Manage Local Services' action on the right side of the
- screen.
-
- 5. Go into the default package (click on 'Visit Default Package' in the
- actions box).
-
- 6. Click on 'Add' in the actions box.
-
- 7. Select 'SQL Connection Service'.
-
- 8. You can enter the name for the service, but it is optional. If you do
- not provide a name, your service will be called 'ConnectionService'.
-
- 9. Click on the 'Add' button.
-
- 10. You are again in the default package. Click on an item called
- 'configure'.
-
- 11. Click on the 'Add' button.
-
- 12. Select 'Service' and click on the 'Add' button.
-
- 13. Select 'SQLDatabaseConnections' in the type drop-list. Title and
- description are for informational purposes only.
-
- 14. Click on the 'Next' button.
-
- 15. Select the connection service component you added in step 8.
-
- 16. Change the status to 'Active'.
-
- 17. Click on the 'Finish' button.
+ you use the default settings in zope.conf.in).
- Whew! You now have a functioning connection service. That took some work.
- Let's hope the repetetive steps 10-17 will be eliminated in the future.
+ 4. Click on the 'Manage Site' action on the right side of the
+ screen. You should see a screen which reads 'Common Site
+ Management Tasks'
+ 5. Around the middle of that page, you should see a link named 'Add
+ Utility'. Click on it.
-Creating Database Connections
-
- It is time to add some connections.
-
- 18. Go back to the default package.
-
- 19. Click on 'Add' in the actions box.
-
- 20. Select 'Psycopg DA' and type in a name (the default is
- 'zopeproducts.psycopgda', which is too cumbersome).
+ 6. Select 'Psycopg DA' and type in a name at the bottom of the page.
- 21. Enter the database connection string. It looks like this:
+ 7. Enter the database connection string. It looks like this:
dbi://username:password@host:port/databasename
-
- 22. Click on the 'Add' button.
-
- 23. You are again in the default package. Click on the adapter you just
- added.
-
- 24. Click on the 'Connect' button. If you see an error message, go back
- and check the database connection string.
-
- 25. If you want to, you can go to the Test page and execute arbitrary SQL
- queries to see whether the connection is working as expected.
-
- 26. Go back to the default package. Click on an item called 'configure'.
- 27. Click on the 'Add' button.
+ 8. Click on the 'Add' button.
- 28. Select 'Connection' and click on the 'Add' button.
+ 9. You should be on a page which reads 'Add Database Connection
+ Registration'. There you can configure the permission needed to
+ use the database connection, the name of the registration and the
+ registration status. You can use any name for 'Register As'
+ field, as long as it doesn't clash with an existing one. Choose a
+ permission. Choose between 'Registered' and 'Active' for the
+ 'Registration Status'. Only one component of a kind can be
+ 'Active' at a time, so be careful.
- 29. Enter the connection name (it will be used later to identify
- connections used for SQLScripts). I suggest using the same name as in
- step 20, to reduce confusion.
-
- 30. Select the database adapter component you added in step 20.
-
- 31. Select a permission that will be required to access the connection.
- (XXX: the input box or the drop-down?)
-
- 32. Change the status to 'Active'.
-
- 33. Click on the 'Submit Query' button.
-
- Repeat steps 18-33 for every connection you want to use. Let's hope again
- that eventually there will be shortcuts for steps 23-24 and 26-30.
+ 10. You should be redirected to the 'Edit' screen of the connection
+ utility.
+ 11. If you want to, you can go to the Test page and execute arbitrary SQL
+ queries to see whether the connection is working as expected.
Using SQL Scripts
-
+
You can create SQL Scripts in the content space. For example:
- 34. Go to Zope root.
+ 12. Go to Zope root.
- 35. Add an SQL script (you can use the Common Tasks box on the left, or
+ 13. Add an SQL script (you can use the Common Tasks box on the left, or
the Add action on the right).
- 36. Click on the name of your new SQL script.
+ 14. Click on the name of your new SQL script.
- 37. Choose a connection name (the one you entered in step 29) from the
+ 15. Choose a connection name (the one you entered in step 29) from the
drop-down.
-
- 38. Enter your query and click on the 'Save Changes' button.
- 39. You can test the script in the -- surprise! -- Test page.
+ 16. Enter your query and click on the 'Save Changes' button.
+ 17. You can test the script in the -- surprise! -- Test page.
=== Products3/psycopgda/configure.zcml 1.8 => 1.9 ===
--- Products3/psycopgda/configure.zcml:1.8 Mon Feb 23 09:47:36 2004
+++ Products3/psycopgda/configure.zcml Tue Jul 6 15:47:18 2004
@@ -1,40 +1,42 @@
<configure
- xmlns="http://namespaces.zope.org/zope"
- xmlns:browser="http://namespaces.zope.org/browser"
- i18n_domain="psycopgda">
+ xmlns="http://namespaces.zope.org/zope"
+ xmlns:browser="http://namespaces.zope.org/browser"
+ i18n_domain="psycopgda">
<content class=".adapter.PsycopgAdapter">
- <factory
- id="zope.da.PsycopgDA"
- permission="zope.Public" />
+ <factory id="zope.da.PsycopgDA" />
<require
- permission="zope.Public"
- interface="zope.app.interfaces.rdb.IZopeDatabaseAdapter"/>
+ permission="zope.Public"
+ interface="zope.app.rdb.interfaces.IZopeDatabaseAdapter"
+ />
</content>
<browser:addform
- name="AddPsycopgDA"
- schema="zope.app.interfaces.rdb.IZopeDatabaseAdapter"
- label="Add Psycopg (PostGreSQL) Database Adapter"
- content_factory=".adapter.PsycopgAdapter"
- arguments="dsn"
- fields="dsn"
- permission="zope.ManageContent" />
+ name="AddPsycopgDA"
+ schema="zope.app.rdb.interfaces.IZopeDatabaseAdapter"
+ label="Add Psycopg (PostGreSQL) Database Adapter"
+ content_factory=".adapter.PsycopgAdapter"
+ arguments="dsn"
+ fields="dsn"
+ permission="zope.ManageContent"
+ />
<!-- Menu entry for "add utility" menu -->
<browser:addMenuItem
- class=".adapter.PsycopgAdapter"
- title="Psycopg DA"
- description="A PostgreSQL Database Adapter using the Psycopg driver"
- permission="zope.ManageApplication"
- />
+ class=".adapter.PsycopgAdapter"
+ title="Psycopg DA"
+ description="A PostgreSQL Database Adapter using the Psycopg driver"
+ permission="zope.ManageApplication"
+ view="AddPsycopgDA"
+ />
<!-- Menu entry for "add connection" menu -->
<browser:menuItem
- menu="add_connection"
- for="zope.app.interfaces.container.IAdding"
- title="Psycopg DA"
- description="A PostgreSQL Database Adapter using the Psycopg driver"
- action="AddPsycopgDA"/>
+ menu="add_connection"
+ for="zope.app.container.interfaces.IAdding"
+ title="Psycopg DA"
+ description="A PostgreSQL Database Adapter using the Psycopg driver"
+ action="AddPsycopgDA"
+ />
</configure>
More information about the Zope-CVS
mailing list