[z3-checkins] r36318 - in z3/sqlos/trunk/src/sqlos: . container ftests testing

kobold at codespeak.net kobold at codespeak.net
Mon Jan 8 22:26:54 CET 2007


Author: kobold
Date: Mon Jan  8 22:26:50 2007
New Revision: 36318

Modified:
   z3/sqlos/trunk/src/sqlos/container/mono.py
   z3/sqlos/trunk/src/sqlos/ftesting.zcml
   z3/sqlos/trunk/src/sqlos/ftests/adding.txt
   z3/sqlos/trunk/src/sqlos/ftests/connection.txt
   z3/sqlos/trunk/src/sqlos/ftests/containers.txt
   z3/sqlos/trunk/src/sqlos/ftests/isolated_containers.txt
   z3/sqlos/trunk/src/sqlos/ftests/localutilities.txt
   z3/sqlos/trunk/src/sqlos/ftests/mono_containers.txt
   z3/sqlos/trunk/src/sqlos/sampleapp.zcml
   z3/sqlos/trunk/src/sqlos/testing/sampleperson.py
   z3/sqlos/trunk/src/sqlos/testing/testdb.py
Log:
Improvements for the functional tests; fixed a bug in the mono containers.


Modified: z3/sqlos/trunk/src/sqlos/container/mono.py
==============================================================================
--- z3/sqlos/trunk/src/sqlos/container/mono.py	(original)
+++ z3/sqlos/trunk/src/sqlos/container/mono.py	Mon Jan  8 22:26:50 2007
@@ -19,6 +19,7 @@
 from zope.app.container.contained import NameChooser
 
 from sqlos.container.standard import contained, SQLObjectContainer
+from sqlos.interfaces import ISQLObject
 from sqlos.interfaces.container import ISQLObjectMonoContainer
 
 

Modified: z3/sqlos/trunk/src/sqlos/ftesting.zcml
==============================================================================
--- z3/sqlos/trunk/src/sqlos/ftesting.zcml	(original)
+++ z3/sqlos/trunk/src/sqlos/ftesting.zcml	Mon Jan  8 22:26:50 2007
@@ -27,7 +27,7 @@
       dsn='dbi://:memory:'
       />
 
-  <!-- Connections to other databases people may want to test against. -->
+  <!-- Connections to other databases people may want to test against -->
 
   <configure zcml:condition="installed psycopgda">
     <rdb:provideConnection
@@ -37,6 +37,14 @@
         />
   </configure>
 
+  <configure zcml:condition="installed psycopg2da">
+    <rdb:provideConnection
+        name='pg2sql'
+        component='psycopg2da.adapter.Psycopg2Adapter'
+        dsn='dbi://postgres@localhost:5432/testdb'
+        />
+  </configure>
+
   <configure zcml:condition="installed mysqldbda">
     <rdb:provideConnection
         name='mysql'
@@ -49,32 +57,26 @@
        low level testing -->
 
   <sqlos:factory
-      id="Dog"
-      component=".testing.sampleperson.Dog"
-      description="A Sample Dog"
-      />
-
-  <sqlos:factory
-      id="SampleIsolatedPerson"
+      id="sqlos.testing.SampleIsolatedPerson"
       component=".testing.sampleperson.SampleIsolatedPerson"
       description="A Sample Person for isolated containers"
       />
 
-  <!-- Define a Sample Person with some views so we can test through the ZMI -->
+  <!-- Define a sample Person with some views so we can test through the ZMI -->
 
   <sqlos:factory
-      id="sqlos.somename.SamplePerson"
+      id="sqlos.testing.SamplePerson"
       component=".testing.sampleperson.SamplePerson"
       description="A Sample Person"
       />
 
   <class class=".testing.sampleperson.SamplePerson">
-    <!-- The followinf factory directive is actually uneccessary and
+    <!-- The following factory directive is actually uneccessary and
          probably a bad idea as sqlos:factory with register the factory.
-         It is included here as a decoy to be sure that sqlos still functions
+         It is included here as a decoy to be sure that sqlos still works
          when it is present. -->
     <factory
-        id="sqlos.Sampleperson"
+        id="sqlos.SamplePerson"
         title="SamplePerson Factory"
         description="SamplePerson factory"
         />
@@ -83,7 +85,6 @@
         interface="sqlos.testing.sampleperson.IPerson"
         set_schema="sqlos.testing.sampleperson.IPerson"
         />
-
     <require
         permission="zope.View"
         interface="sqlos.interfaces.ISQLObject"
@@ -93,7 +94,7 @@
   <browser:addform
       schema="sqlos.testing.sampleperson.IPerson"
       content_factory="sqlos.testing.sampleperson.SamplePerson"
-      keyword_arguments="username fullname password"
+      keyword_arguments="fullname username password"
       label="New Sample Person"
       name="AddPerson.html"
       permission="zope.ManageContent"
@@ -114,15 +115,71 @@
 
   <browser:addMenuItem
       title="SamplePerson"
-      factory="sqlos.somename.SamplePerson"
+      factory="sqlos.testing.SamplePerson"
       permission="zope.ManageContent"
       view="AddPerson.html"
       />
 
-  <!-- Set up a MultiContainer which can contain the Sample People-->
+  <!-- Define a sample Dog with some views so we can test through the ZMI -->
+
+  <sqlos:factory
+      id="sqlos.testing.SampleDog"
+      component=".testing.sampleperson.SampleDog"
+      description="A Sample Dog"
+      />
+
+  <class class=".testing.sampleperson.SampleDog">
+    <!-- The following factory directive is actually uneccessary and
+         probably a bad idea as sqlos:factory with register the factory.
+         It is included here as a decoy to be sure that sqlos still works
+         when it is present. -->
+    <factory
+        id="sqlos.SampleDog"
+        title="SampleDog Factory"
+        description="SampleDog factory"
+        />
+    <require
+        permission="zope.ManageContent"
+        interface="sqlos.testing.sampleperson.IDog"
+        set_schema="sqlos.testing.sampleperson.IDog"
+        />
+    <require
+        permission="zope.View"
+        interface="sqlos.interfaces.ISQLObject"
+        />
+  </class>
+
+  <browser:addform
+      schema="sqlos.testing.sampleperson.IDog"
+      content_factory="sqlos.testing.sampleperson.SampleDog"
+      keyword_arguments="fullname owner"
+      label="New Sample Dog"
+      name="AddDog.html"
+      permission="zope.ManageContent"
+      />
+
+  <browser:editform
+      schema="sqlos.testing.sampleperson.IDog"
+      name="edit.html"
+      menu="zmi_views"
+      label="Edit a Sample Dog"
+      permission="zope.ManageContent"
+      />
+
+  <browser:defaultView
+      for="sqlos.testing.sampleperson.IDog"
+      name="edit.html"
+      />
+
+  <browser:addMenuItem
+      title="SampleDog"
+      factory="sqlos.testing.SampleDog"
+      permission="zope.ManageContent"
+      view="AddDog.html"
+      />
+
+  <!-- MultiContainer which can contain the sample Person and Dog -->
 
-  <!--we have to register an adding view for the container, we just use the
-      standard one. Should this be defined on all SQLObject containrs?-->
   <browser:view
       name="+"
       menu="zmi_actions" title="Add SQLObjects"
@@ -137,7 +194,7 @@
   <class class="sqlos.testing.sampleperson.MultiContainer">
     <factory
         id="sqlos.testing.sampleperson.MultiContainer"
-        title="SQLObject Multi Container (Dogs and people)"
+        title="SQLObject Multi Container (Persons and Dogs)"
         description="A persistent container for SQL-backed Person and Dog Objects"
         />
     <require
@@ -156,7 +213,47 @@
 
   <browser:addMenuItem
       class="sqlos.testing.sampleperson.MultiContainer"
-      title="SQLObject Multi Container (Dogs and people)"
+      title="SQLObject Multi Container (Persons and Dogs)"
+      description="A persistent container for SQL-backed Person and Dog Objects"
+      permission="zope.ManageContent"
+      />
+
+  <!-- MonoContainer which can contain the sample Person -->
+
+  <browser:view
+      name="+"
+      menu="zmi_actions" title="Add SQLObjects"
+      for="sqlos.testing.sampleperson.IPersonContainer"
+      permission="zope.ManageContent"
+      class="zope.app.container.browser.adding.Adding"
+      >
+    <browser:page name="index.html" attribute="index"/>
+    <browser:page name="action.html" attribute="action"/>
+  </browser:view>
+
+  <class class="sqlos.testing.sampleperson.SamplePersonMonoContainer">
+    <factory
+        id="sqlos.testing.sampleperson.SamplePersonMonoContainer"
+        title="SQLObject Mono Container (Persons)"
+        description="A persistent container for SQL-backed Person and Dog Objects"
+        />
+    <require
+        permission="zope.View"
+        interface="zope.app.container.interfaces.IReadContainer"
+        />
+    <require
+        permission="zope.ManageContent"
+        interface="zope.app.container.interfaces.IWriteContainer"
+        />
+    <require
+        permission="zope.View"
+        attributes="select"
+        />
+  </class>
+
+  <browser:addMenuItem
+      class="sqlos.testing.sampleperson.SamplePersonMonoContainer"
+      title="SQLObject Mono Container (Persons)"
       description="A persistent container for SQL-backed Person and Dog Objects"
       permission="zope.ManageContent"
       />

Modified: z3/sqlos/trunk/src/sqlos/ftests/adding.txt
==============================================================================
--- z3/sqlos/trunk/src/sqlos/ftests/adding.txt	(original)
+++ z3/sqlos/trunk/src/sqlos/ftests/adding.txt	Mon Jan  8 22:26:50 2007
@@ -19,7 +19,7 @@
 Go to the main interface and add a SQLObject MultiContainer
 
     >>> browser.open('http://localhost/manage')
-    >>> 'SamplePerson' not in str(browser.contents)
+    >>> 'sqlos.testing.SamplePerson' not in str(browser.contents)
     True
     >>> browser.getLink('SQLObject Multi Container').click()
     >>> browser.getControl(name='new_value').value = 'multicontainer1'
@@ -36,7 +36,7 @@
 
 Lets try editing bob:
 
-    >>> browser.getLink('sqlos.somename.SamplePerson.1').click()
+    >>> browser.getLink('sqlos.testing.SamplePerson.1').click()
     >>> print browser.contents
     <!DOC...
     ...
@@ -68,13 +68,74 @@
 
     >>> browser.getLink('multicontainer1').click()
     >>> page = browser.url
-    >>> 'sqlos.somename.SamplePerson.1' in browser.contents
+    >>> 'sqlos.testing.SamplePerson.1' in browser.contents
     True
     >>> ctrl = browser.getControl(name='ids:list')
-    >>> ctrl.value = ['sqlos.somename.SamplePerson.1']
+    >>> ctrl.value = ['sqlos.testing.SamplePerson.1']
     >>> browser.getControl('Delete').click()
     >>> browser.open(page)
-    >>> 'sqlos.somename.SamplePerson.1' in browser.contents
+    >>> 'sqlos.testing.SamplePerson.1' in browser.contents
+    False
+
+Now, go to the main interface and add a SQLObject Mono Container:
+
+    >>> browser.open('http://localhost/manage')
+    >>> 'sqlos.testing.SamplePerson' not in str(browser.contents)
+    True
+    >>> browser.getLink('SQLObject Mono Container').click()
+    >>> browser.getControl(name='new_value').value = 'monocontainer1'
+    >>> browser.getControl('Apply').click()
+
+Now add a Sample Person to the container:
+
+    >>> browser.getLink('monocontainer1').click()
+    >>> browser.getLink('SamplePerson').click()
+    >>> browser.getControl(name='field.fullname').value = 'Boe'
+    >>> browser.getControl(name='field.username').value = 'boe'
+    >>> browser.getControl(name='field.password').value = 'ebo'
+    >>> browser.getControl('Add').click()
+
+Lets try editing boe:
+
+    >>> browser.open('http://localhost/monocontainer1/1/@@edit.html')
+    >>> print browser.contents
+    <!DOC...
+    ...
+    ...Full Name...
+    ...
+    ...Boe...
+    ...
+    ...Username...
+    ...
+    ...boe...
+    ...
+    ...Password...
+    ...
+    ...ebo...
+    ...
+    >>> browser.getControl(name='field.fullname').value = 'Beo Bones'
+    >>> browser.getControl('Change').click()
+    >>> print browser.contents
+    <!DOC...
+    ...
+    ...Updated on...
+    ...
+    ...Full Name...
+    ...
+    ...Beo Bones...
+    ...
+
+Finally, lets delete boe:
+
+    >>> browser.getLink('monocontainer1').click()
+    >>> page = browser.url
+    >>> '"1/@@Selected' in browser.contents
+    True
+    >>> ctrl = browser.getControl(name='ids:list')
+    >>> ctrl.value = ['1']
+    >>> browser.getControl('Delete').click()
+    >>> browser.open(page)
+    >>> '"1/@@Selected' in browser.contents
     False
 
 CleanUp:

Modified: z3/sqlos/trunk/src/sqlos/ftests/connection.txt
==============================================================================
--- z3/sqlos/trunk/src/sqlos/ftests/connection.txt	(original)
+++ z3/sqlos/trunk/src/sqlos/ftests/connection.txt	Mon Jan  8 22:26:50 2007
@@ -43,7 +43,7 @@
     >>> from zope.app import zapi
     >>> from sqlos.interfaces import IISQLObject
     >>> SamplePerson = zapi.getUtility(IISQLObject,
-    ...                                u'sqlos.somename.SamplePerson')
+    ...                                u'sqlos.testing.SamplePerson')
     >>> harry = SamplePerson(username='h', fullname='H', password='p')
 
     >>> tmpcon = harry._connection

Modified: z3/sqlos/trunk/src/sqlos/ftests/containers.txt
==============================================================================
--- z3/sqlos/trunk/src/sqlos/ftests/containers.txt	(original)
+++ z3/sqlos/trunk/src/sqlos/ftests/containers.txt	Mon Jan  8 22:26:50 2007
@@ -19,7 +19,7 @@
 In the ftesting.zcml a SamplePerson factory should be registered:
 
     >>> utilities = [i for i, j in container._getAllowedIISQLObjectUtilities()]
-    >>> u'sqlos.somename.SamplePerson' in utilities
+    >>> u'sqlos.testing.SamplePerson' in utilities
     True
 
 So let's create some database tables if not already there:
@@ -50,7 +50,7 @@
     >>> from zope.app import zapi
     >>> from sqlos.interfaces import IISQLObject
     >>> SamplePerson = zapi.getUtility(IISQLObject,
-    ...                                u'sqlos.somename.SamplePerson',
+    ...                                u'sqlos.testing.SamplePerson',
     ...                                context=container)
     >>> harry = SamplePerson(**people[0])
     >>> len(container)
@@ -62,20 +62,20 @@
 Lets see whats inside:
 
     >>> [i[0] for i in container.items()]
-    [u'sqlos.somename.SamplePerson.1', u'sqlos.somename.SamplePerson.2']
+    [u'sqlos.testing.SamplePerson.1', u'sqlos.testing.SamplePerson.2']
     >>> [i[1] for i in container.items()] == [harry, sally]
     True
     >>> [i for i in container.values()] == [harry, sally]
     True
     >>> [i for i in container.keys()]
-    [u'sqlos.somename.SamplePerson.1', u'sqlos.somename.SamplePerson.2']
+    [u'sqlos.testing.SamplePerson.1', u'sqlos.testing.SamplePerson.2']
     >>> [i for i in container]
-    [u'sqlos.somename.SamplePerson.1', u'sqlos.somename.SamplePerson.2']
+    [u'sqlos.testing.SamplePerson.1', u'sqlos.testing.SamplePerson.2']
 
 Notice that the keys are generated from the name of the factory and the id of
 the instance:
 
-    >>> harry_name = 'sqlos.somename.SamplePerson.%s' % harry.id
+    >>> harry_name = 'sqlos.testing.SamplePerson.%s' % harry.id
     >>> container[harry_name] == harry
     True
     >>> container[unicode(harry_name)] == harry
@@ -83,7 +83,7 @@
 
 Let's test to see what the container does with bad id's (must raise KeyError):
 
-    >>> container['sqlos.somename.SamplePerson.oops']
+    >>> container['sqlos.testing.SamplePerson.oops']
     Traceback (most recent call last):
         ...
     KeyError: ...
@@ -109,7 +109,7 @@
     >>> container[harry_name]
     Traceback (most recent call last):
         ...
-    KeyError: 'sqlos.somename.SamplePerson.1'
+    KeyError: 'sqlos.testing.SamplePerson.1'
 
 Lets make another container which can have dogs as well as people:
 
@@ -124,7 +124,7 @@
 
 Now we add sally's dog:
 
-    >>> fido = sampleperson.Dog(fullname='Fido', owner='sally')
+    >>> fido = sampleperson.SampleDog(fullname='Fido', owner='sally')
     >>> len(multicontainer)
     2
     >>> fido in [i for i in multicontainer.values()]

Modified: z3/sqlos/trunk/src/sqlos/ftests/isolated_containers.txt
==============================================================================
--- z3/sqlos/trunk/src/sqlos/ftests/isolated_containers.txt	(original)
+++ z3/sqlos/trunk/src/sqlos/ftests/isolated_containers.txt	Mon Jan  8 22:26:50 2007
@@ -19,7 +19,7 @@
 In the ftesting.zcml a SampleIsolatedPerson factory should be registered:
 
     >>> utilities = [i for i, j in container._getAllowedIISQLObjectUtilities()]
-    >>> u'SampleIsolatedPerson' in utilities
+    >>> u'sqlos.testing.SampleIsolatedPerson' in utilities
     True
 
 So let's create some database tables if not already there:
@@ -53,7 +53,7 @@
     >>> from zope.app import zapi
     >>> from sqlos.interfaces import IISQLObject
     >>> SampleIsolatedPerson = zapi.getUtility(IISQLObject,
-    ...                                        u'SampleIsolatedPerson',
+    ...                                        u'sqlos.testing.SampleIsolatedPerson',
     ...                                        context=container)
     >>> harry = SampleIsolatedPerson(**people[0])
     >>> sally = SampleIsolatedPerson(**people[1])
@@ -71,20 +71,20 @@
 Lets see whats inside:
 
     >>> [i[0] for i in container.items()]
-    [u'SampleIsolatedPerson.1', u'SampleIsolatedPerson.2']
+    [u'sqlos.testing.SampleIsolatedPerson.1', u'sqlos.testing.SampleIsolatedPerson.2']
     >>> [i[1] for i in container.items()] == [harry, sally]
     True
     >>> [i for i in container.values()] == [harry, sally]
     True
     >>> [i for i in container.keys()]
-    [u'SampleIsolatedPerson.1', u'SampleIsolatedPerson.2']
+    [u'sqlos.testing.SampleIsolatedPerson.1', u'sqlos.testing.SampleIsolatedPerson.2']
     >>> [i for i in container]
-    [u'SampleIsolatedPerson.1', u'SampleIsolatedPerson.2']
+    [u'sqlos.testing.SampleIsolatedPerson.1', u'sqlos.testing.SampleIsolatedPerson.2']
 
 Notice that the keys are generated from the name of the factory and the id of
 the instance:
 
-    >>> harry_name = 'SampleIsolatedPerson.%s' % harry.id
+    >>> harry_name = 'sqlos.testing.SampleIsolatedPerson.%s' % harry.id
     >>> container[harry_name] == harry
     True
     >>> container[unicode(harry_name)] == harry

Modified: z3/sqlos/trunk/src/sqlos/ftests/localutilities.txt
==============================================================================
--- z3/sqlos/trunk/src/sqlos/ftests/localutilities.txt	(original)
+++ z3/sqlos/trunk/src/sqlos/ftests/localutilities.txt	Mon Jan  8 22:26:50 2007
@@ -58,7 +58,7 @@
 
     >>> cursor = localUtility().cursor()
     >>> c = cursor.execute(
-    ...         '''create table dog (
+    ...         '''create table sample_dog (
     ...                   id integer primary key,
     ...                   fullname varchar(50) not null,
     ...                   owner varchar(20) not null)''')

Modified: z3/sqlos/trunk/src/sqlos/ftests/mono_containers.txt
==============================================================================
--- z3/sqlos/trunk/src/sqlos/ftests/mono_containers.txt	(original)
+++ z3/sqlos/trunk/src/sqlos/ftests/mono_containers.txt	Mon Jan  8 22:26:50 2007
@@ -48,7 +48,7 @@
     >>> from zope.app import zapi
     >>> from sqlos.interfaces import IISQLObject
     >>> SamplePerson = zapi.getUtility(IISQLObject,
-    ...                                u'sqlos.somename.SamplePerson',
+    ...                                u'sqlos.testing.SamplePerson',
     ...                                context=container)
     >>> harry = SamplePerson(**people[0])
     >>> len(container)

Modified: z3/sqlos/trunk/src/sqlos/sampleapp.zcml
==============================================================================
--- z3/sqlos/trunk/src/sqlos/sampleapp.zcml	(original)
+++ z3/sqlos/trunk/src/sqlos/sampleapp.zcml	Mon Jan  8 22:26:50 2007
@@ -1,11 +1,11 @@
-<?xml version="1.0"?
+<?xml version="1.0"?>
 <configure xmlns="http://namespaces.zope.org/zope"
            i18n_domain="sqlos">
 
-  <!-- this slug sets up the functional test suite as a test application. which it is -->
+  <!-- set up the functional test suite as a test application -->
   <include file="ftesting.zcml"/>
 
-  <!-- We try to create the tables at db open time -->
+  <!-- create the tables at database open time -->
   <subscriber
       handler="sqlos.testing.sampleperson.createTestingTablesSubscriber"
       for="zope.app.appsetup.interfaces.IDatabaseOpenedEvent"

Modified: z3/sqlos/trunk/src/sqlos/testing/sampleperson.py
==============================================================================
--- z3/sqlos/trunk/src/sqlos/testing/sampleperson.py	(original)
+++ z3/sqlos/trunk/src/sqlos/testing/sampleperson.py	Mon Jan  8 22:26:50 2007
@@ -1,43 +1,72 @@
+##############################################################################
+#
+# Copyright (c) 2004 Enfold Systems LLC. All rights reserved.
+#
+# This software is distributed under the terms of the Zope Public
+# License (ZPL) v2.1. See COPYING.txt for more information.
+#
+##############################################################################
+"""
+$Id$
+"""
+
 from sqlobject import *
 import transaction
+
 from zope.interface import implements, classProvides, Interface
-from zope.schema import TextLine, Text, Datetime
+from zope.schema import TextLine, Datetime
 from zope.app.container import constraints
+from zope.app.container.interfaces import IContained
 
 from sqlos.zsqlobject import SQLOS
 from sqlos.interfaces import ISQLSchema, IISQLObjectIsolated, ISQLObjectIsolated
+from sqlos.container import SQLObjectContainer
+from sqlos.container import SQLObjectIsolatedContainer, SQLObjectMonoContainer
 from sqlos.interfaces.container import ISQLObjectContainer
-from sqlos.container import SQLObjectContainer, SQLObjectIsolatedContainer, SQLObjectMonoContainer
+
 
 def createTestingTablesSubscriber(obj):
-    # An event subscriber that can be used to create the testing tables
+    """An event subscriber that can be used to create the testing tables"""
     createTestingTables()
 
+
 def createTestingTables():
-    """Creates the tables of the SQLObject calsses defined here."""
+    """Creates the tables of the SQLOS classes defined here"""
     transaction.get().commit()
-    for table in [SamplePerson, SampleIsolatedPerson, Dog]:
+    for table in [SamplePerson, SampleIsolatedPerson, SampleDog]:
         if table._connection.tableExists(table.sqlmeta.table):
             print 'WARNING: Table already exists. Dirty test???'
         table.createTable(ifNotExists=True)
     transaction.get().commit()
 
+
 def dropTestingTables():
-    """Creates the tables of the SQLObject calsses defined here."""
+    """Drops the tables of the SQLOS classes defined here"""
     transaction.get().commit()
-    for table in [SamplePerson, SampleIsolatedPerson, Dog]:
+    for table in [SamplePerson, SampleIsolatedPerson, SampleDog]:
         table.dropTable()
     transaction.get().commit()
 
 
 class IPerson(ISQLSchema):
 
-    fullname = TextLine(title=u'Full Name',
-                        description=u"The full name of the user")
-    username = TextLine(title=u'Username',
-                        description=u"The user's login")
-    password = TextLine(title=u'Password',
-                        description=u"The user's password")
+    fullname = TextLine(
+        title=u'Full Name',
+        description=u"The full name of the user",
+        required=True,
+    )
+
+    username = TextLine(
+        title=u'Username',
+        description=u"The user's login",
+        required=True,
+    )
+
+    password = TextLine(
+        title=u'Password',
+        description=u"The user's password",
+        required=True,
+    )
 
 
 class IPersonContainer(ISQLObjectContainer):
@@ -45,7 +74,7 @@
     constraints.contains(IPerson)
 
 
-class IPersonContained(Interface):
+class IPersonContained(IContained):
 
     constraints.containers(IPersonContainer)
 
@@ -58,7 +87,7 @@
 class SamplePersonMonoContainer(SQLObjectMonoContainer):
 
     implements(IPersonContainer)
-    factory = 'sqlos.somename.SamplePerson'
+    factory = 'sqlos.testing.SamplePerson'
 
 
 class SamplePerson(SQLOS):
@@ -120,13 +149,20 @@
 
 class IDog(ISQLSchema):
 
-    fullname = TextLine(title=u'Full Name',
-                        description=u'The full name of the dog')
-    owner = TextLine(title=u'Owner username',
-                     description=u'The username of the dog\'s owner')
+    fullname = TextLine(
+        title=u'Full Name',
+        description=u'The full name of the dog',
+        required=True,
+    )
+
+    owner = TextLine(
+        title=u'Owner username',
+        description=u'The username of the dog\'s owner',
+        required=True,
+    )
 
 
-class Dog(SQLOS):
+class SampleDog(SQLOS):
 
     implements(IDog)
 

Modified: z3/sqlos/trunk/src/sqlos/testing/testdb.py
==============================================================================
--- z3/sqlos/trunk/src/sqlos/testing/testdb.py	(original)
+++ z3/sqlos/trunk/src/sqlos/testing/testdb.py	Mon Jan  8 22:26:50 2007
@@ -22,7 +22,6 @@
 
 from sqlos.adapter import SQLiteAdapter
 
-# Try first to use pysqlite2
 try:
     from pysqlite2 import dbapi2 as sqlite
 except ImportError:
@@ -30,7 +29,8 @@
 
 
 class SQLiteda(ZopeDatabaseAdapter):
-    """A not very fancy SQLLite database adapter."""
+    """A not very fancy SQLite database adapter"""
+
     def _connection_factory(self):
         path = urlparse.urlparse(self.dsn)[2]
         if path == '//:memory:':
@@ -56,7 +56,7 @@
         if classes is None:
             classes = []
         self.zda = SQLiteda('dbi://:memory:')
-        self.history = []  # store the original connection and classes
+        self.history = [] # store the original connection and classes
         for cls in classes:
             self.history.append((cls, cls._connection))
             cls._connection = self.getConnection()


More information about the z3-checkins mailing list