eionet european environment information and observation network * * * eionet training zope absolute...
TRANSCRIPT
EIONETEuropean Environment Information and Observation Network
http://www.eionet.eu.int/
* * *EIONET Training
Zope absolute beginner's course
Built-in tools (presentation and best practice):Database connectivity: MySQL and LDAP
Monday, 27 Oct 2003 - Tuesday, 28 Oct 2003
Hermann Peifer, Project Manager EIONET Data Flow
Version 0.3 2003-10-07
3
ZMySQLDA and ZSQLMethods
ZMySQLDA is the MySQL database adapter product for ZOPE.
• The Z MySQL database adapter product requires that the Python MySQLmodule extension is installed.
Z SQL Method Object: Query relational databases with SQL
• Z SQL Methods allows you to access data in SQL databases.
• Z SQL Methods define and call SQL statements on databases which are defined by database adapter objects.
• To create a new Z SQL Method you will need to setup a database adapter first.
4
MySQL Demo Folderhttp://peifer.eionet.eu.int/wdbgw/
(Use the ‘View DTML Source’ function)
ZSQLMethodsto access the database
ZMySQLDADatabase Connection
DTML MethodsTo render the ZSQL query results on the Zope site
6
<dtml-var standard_html_header><h2><dtml-var title_or_id></h2><table border=1><caption>Available GWbodies</caption> <tr> <th align="left">Country ID</th> <th align="left">Country Name</th> <th align="right">No. of bodies</th> </tr><dtml-in select_country_body> <tr> <td><dtml-var ctyID></td> <td><a href="list_body?ctyID=<dtml-var ctyID>">
<dtml-var ctyName></a></td> <td align="right"><dtml-var c_bdyID></td> </tr></dtml-in></table><dtml-var standard_html_footer>
DTML Method at /wdbgw/index_html(Countries and No. of Gwbodies)
HTML table with column headers
DTML loop using ZSQL Method to render the query results
9
ZLDAPConnection and ZLDAPMethods
ZopeLDAP Product consists of 2 products in the same release
• Downloadable at:http://www.zope.org/Members/jshell/ZopeLDAP
1. ZLDAPConnection is the LDAP database adapter product.
• For managing connections to LDAP Servers and returning Zope-ish entry objects.
• It needs David Leonard's ldapmodule, from http://python-ldap.sourceforge.net/
2. ZLDAP Filter Methods for querying LDAP Servers
• ZLDAP Filter Methods allows you to browse an LDAP database.
• Known problems with the transactional behaviour, but connection can be run in a non-transactional mode.
10
ZLDAPDatabase Connection
DTML Documentsto render the ZLDAP query results on the Zope site
ZLDAP Methodsto search in the LDAP database
LDAP Search Folderhttp://directory.eionet.eu.int/quick/
12
<dtml-var standard_html_header><h2><dtml-var title_or_id></h2><table border=1> <tr> <th>No</th> <th>UserID</th> <th>Name</th> <th>Email</th> <th>Organisation</th> </tr><dtml-in search_users> <tr> <td><dtml-var sequence-number></td> <td><dtml-var uid></td> <td><dtml-var cn></td> <td><dtml-var mail missing></td> <td><dtml-var o missing></td> </tr></dtml-in></table><dtml-var standard_html_footer>
DTML Document at /quick/list_users (Results of users search)
HTML table with column headers
DTML loop using ZLDAP Methodto render the query results