[z3-checkins] r25422 - in z3/sqlos/trunk: . includes src/sqlos

jinty at codespeak.net jinty at codespeak.net
Wed Apr 5 23:28:49 CEST 2006


Author: jinty
Date: Wed Apr  5 23:28:44 2006
New Revision: 25422

Added:
   z3/sqlos/trunk/includes/sqlos.ftesting-configure.zcml
      - copied, changed from r25354, z3/sqlos/trunk/includes/sqlos-ftesting.zcml
   z3/sqlos/trunk/src/sqlos/sampleapp.zcml   (contents, props changed)
Removed:
   z3/sqlos/trunk/patch-test.py
   z3/sqlos/trunk/sampleapp.py
Modified:
   z3/sqlos/trunk/makefile
   z3/sqlos/trunk/src/sqlos/README.txt
Log:
Re-do the sample application in a better way and actually document it.

Copied: z3/sqlos/trunk/includes/sqlos.ftesting-configure.zcml (from r25354, z3/sqlos/trunk/includes/sqlos-ftesting.zcml)
==============================================================================
--- z3/sqlos/trunk/includes/sqlos-ftesting.zcml	(original)
+++ z3/sqlos/trunk/includes/sqlos.ftesting-configure.zcml	Wed Apr  5 23:28:44 2006
@@ -1 +1 @@
-<include package="sqlos" file="ftesting.zcml"/>
+<include package="sqlos" file="sampleapp.zcml"/>

Modified: z3/sqlos/trunk/makefile
==============================================================================
--- z3/sqlos/trunk/makefile	(original)
+++ z3/sqlos/trunk/makefile	Wed Apr  5 23:28:44 2006
@@ -30,11 +30,6 @@
 	rm -rf build
 	rm -rf Zope3
 
-reindent :
-	~/src/reindent.py -r -v .
-
-reindent_clean : reindent clean
-
 .PHONY: z3-checkout
 z3-checkout:
 	-test -d Zope3 || svn co svn://svn.zope.org/repos/main/Zope3/$(Z3BRANCH) Zope3
@@ -46,7 +41,7 @@
 Zope3:
 	$(MAKE) z3-checkout
 
-$(z3includes)/sqlos-%.zcml: includes/sqlos-%.zcml Zope3
+$(z3includes)/%.zcml: includes/%.zcml Zope3
 	cp $< $@
 
 .PHONY: sqlos-meta
@@ -61,22 +56,13 @@
 	touch Zope3/src/easy-install.pth
 	PYTHONPATH=Zope3/src $(PYTHON) setup.py develop -S Zope3/src --install-dir Zope3/src
 
-.PHONY: patch
-patch:
-	# This is butttt ugly pul hopefully temporary
-	set - e;\
-	    if [ `grep 'site.addsitedir(src)' Zope3/test.py -c` == 0 ]; then\
-		cat patch-test.py | patch -p0;\
-	    fi
-
 .PHONY: testall
-test: develop patch
+test: develop
 	cd Zope3 && $(PYTHON) test.py --test-path=../src -s sqlos
 
 Zope3/principals.zcml: Zope3 Zope3/sample_principals.zcml
 	cp Zope3/sample_principals.zcml $@
 
-.PHONY: run-sample
-run-sample: develop Zope3/principals.zcml
-	cp includes/sqlos-ftesting.zcml $(z3includes)/sqlos.testing-configure.zcml
-	sampleapp.py ; rm $(z3includes)/sqlos.testing-configure.zcml
+.PHONY: run-sampleapp
+run-sampleapp: develop Zope3/principals.zcml $(z3includes)/sqlos.ftesting-configure.zcml
+	cd Zope3; ./z3.py

Deleted: /z3/sqlos/trunk/patch-test.py
==============================================================================
--- /z3/sqlos/trunk/patch-test.py	Wed Apr  5 23:28:44 2006
+++ (empty file)
@@ -1,13 +0,0 @@
-Index: Zope3/test.py
-===================================================================
---- Zope3/test.py	(revision 65897)
-+++ Zope3/test.py	(working copy)
-@@ -26,6 +26,8 @@
- # add src to path
- src = os.path.join(here, 'src')
- sys.path.insert(0, src) # put at beginning to avoid one in site_packages
-+import site
-+site.addsitedir(src)
- 
- from zope.testing import testrunner
- 

Deleted: /z3/sqlos/trunk/sampleapp.py
==============================================================================
--- /z3/sqlos/trunk/sampleapp.py	Wed Apr  5 23:28:44 2006
+++ (empty file)
@@ -1,79 +0,0 @@
-#!/usr/bin/env python2.4
-##############################################################################
-#
-# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
-# All Rights Reserved.
-#
-# This software is subject to the provisions of the Zope Public License,
-# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
-# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
-# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
-# FOR A PARTICULAR PURPOSE.
-#
-##############################################################################
-"""Start script for Zope3: loads configuration and starts the server.
-
-$Id: z3.py 40235 2005-11-18 21:30:31Z srichter $
-"""
-import os
-import sys
-
-basepath = filter(None, sys.path)
-
-def run(argv=list(sys.argv)):
-
-    if sys.version_info < ( 2,3,5 ):
-        print """\
-        ERROR: Your python version is not supported by Zope3.
-        Zope3 needs Python 2.3.5 or greater. You are running:""" + sys.version
-        sys.exit(1)
-
-    # Refuse to run without principals.zcml
-    if not os.path.exists('principals.zcml'):
-        print """\
-        ERROR: You need to create principals.zcml
-
-        The file principals.zcml contains your "bootstrap" user
-        database. You aren't going to get very far without it.  Start
-        by copying sample_principals.zcml and then modify the
-        example principal and role settings.
-        """
-        sys.exit(1)
-
-    # setting python paths
-    program = argv[0]
-    if "--build" in argv:
-        argv.remove("--build")
-        from distutils.util import get_platform
-        PLAT_SPEC = "%s-%s" % (get_platform(), sys.version[0:3])
-        src = os.path.join("build", "lib.%s" % PLAT_SPEC)
-    else:
-        src = 'src'
-
-    here = os.path.dirname(os.path.abspath(program))
-    srcdir = os.path.abspath(src)
-    sys.path = [srcdir] + basepath
-    sys.path[:] = [p for p in sys.path if os.path.abspath(p) != here]
-    
-    # Register the paths
-    import site
-    site.addsitedir(srcdir)
-
-    # setup a subscriber to create the sampleperson tables 
-    def setupTestingTables(event):
-        from sqlos.testing import sampleperson
-        sampleperson.createTestingTables()
-    
-    from zope.app.appsetup.interfaces import IDatabaseOpenedEvent
-    from zope.component import getGlobalSiteManager
-    gsm = getGlobalSiteManager()
-    gsm.subscribe([IDatabaseOpenedEvent], None, setupTestingTables)
-
-    from zope.app.twisted.main import main
-    main(argv[1:])
-
-
-if __name__ == '__main__':
-    os.chdir('Zope3')
-    run()

Modified: z3/sqlos/trunk/src/sqlos/README.txt
==============================================================================
--- z3/sqlos/trunk/src/sqlos/README.txt	(original)
+++ z3/sqlos/trunk/src/sqlos/README.txt	Wed Apr  5 23:28:44 2006
@@ -48,6 +48,8 @@
 Dependencies
 ------------
 
+    + setuptools >= 0.6a11
+
     + SQLObject >= 0.7
 
         Place the sqlobject package somewhere in python's sys.path
@@ -107,6 +109,32 @@
 connection and any registered class you wish.
 
 
+A Sample Application
+--------------------
+
+The functional test setup for sqlos is really a sample application. You can
+run and play with this to see how sqlos works.
+
+First install a Z3 database adapter, create a database, edit
+src/sqlos/ftesting.zcml to change the connection settings as
+described below in "Setting up a connection for SQLObject".
+
+NOTE: This currently does not work with the default testing database
+      (memory based SQLite) due to threading issues.
+
+Then, from a checkout of sqlos run:
+
+    $ make run-sampleapp
+
+This should download Zope3 install sqlos and set up the functional
+test suite as a sample application. You can then log into zope3 on
+http://localhost:8080 with gandalf:123.
+
+Try adding a "SQLObject MultiContainer" and then some people.
+
+NOTE: changing debug=1 in src/sqlos/adapter.py will cause the SQL
+      executed to be printed on the terminal
+
 Setting up a connection for SQLObject
 -------------------------------------
 

Added: z3/sqlos/trunk/src/sqlos/sampleapp.zcml
==============================================================================
--- (empty file)
+++ z3/sqlos/trunk/src/sqlos/sampleapp.zcml	Wed Apr  5 23:28:44 2006
@@ -0,0 +1,13 @@
+<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 -->
+  <include file="ftesting.zcml"/>
+
+  <!-- We try to create the tables at db open time -->
+  <subscriber
+      handler="sqlos.testing.sampleperson.createTestingTablesSubscriber"
+      for="zope.app.appsetup.interfaces.IDatabaseOpenedEvent"
+      />
+
+</configure>


More information about the z3-checkins mailing list