[Zope3-checkins] CVS: zopeproducts/sqlauth - __init__.py:1.2

Albertas Agejevas alga@codeworks.lt
Mon, 21 Jul 2003 12:28:31 -0400


Update of /cvs-repository/zopeproducts/sqlauth
In directory cvs.zope.org:/tmp/cvs-serv16336

Modified Files:
	__init__.py 
Log Message:
Minor cleanups.


=== zopeproducts/sqlauth/__init__.py 1.1 => 1.2 ===
--- zopeproducts/sqlauth/__init__.py:1.1	Fri Jul 18 09:31:13 2003
+++ zopeproducts/sqlauth/__init__.py	Mon Jul 21 12:28:25 2003
@@ -34,7 +34,7 @@
 class SQLPrincipalSource(Persistent):
     """SQL based principal source for the Pluggable Authentication Service.
 
-    The table should be defined thus:
+    The table (for PostgreSQL) should be defined thus:
     CREATE TABLE Users (
         id          SERIAL       PRIMARY KEY,
         login       VARCHAR(255) UNIQUE,
@@ -69,7 +69,7 @@
         "See zope.app.interfaces.services.pluggableauth.IPrincipalSource"
         conn = self._getConnection()
         try:
-            return SQLPrincipal(conn, id, self.table)
+            return SQLPrincipal(conn, int(id), self.table)
         except (IndexError, TypeError):
             raise NotFoundError
 
@@ -77,7 +77,7 @@
         "See zope.app.interfaces.services.pluggableauth.IPrincipalSource"
         conn = self._getConnection()
         cursor = conn.cursor()
-        cursor.execute('SELECT id FROM "%s" where login LIKE \'%%%s%%\'' %
+        cursor.execute('SELECT id FROM "%s" WHERE login LIKE \'%%%s%%\'' %
                        (self.table, name))
         result = []
         for row in cursor.fetchall():
@@ -206,7 +206,7 @@
         self._id = id
         cursor = self._connection.cursor()
         cursor.execute(
-            'SELECT login, password, title, description from "%s" where id = %s'
+            'SELECT login, password, title, description FROM "%s" WHERE id = %s'
             % (table, id))
         self._login, self._password, self._title, self._description = (
             cursor.fetchone())