[Zope3-checkins] SVN: Zope3/branches/srichter-twisted-integration2/
* Fixed multi-databases support. I accidently used an old
schema version.
Stephan Richter
srichter at cosmos.phy.tufts.edu
Fri Sep 9 10:45:23 EDT 2005
Log message for revision 38431:
* Fixed multi-databases support. I accidently used an old schema version.
* Use new feature support in server setup. This way the twisted or zserver
configuration is only loaded when the server is used.
Changed:
U Zope3/branches/srichter-twisted-integration2/src/zope/app/appsetup/schema.xml
U Zope3/branches/srichter-twisted-integration2/src/zope/app/server/configure.zcml
U Zope3/branches/srichter-twisted-integration2/src/zope/app/server/main.py
U Zope3/branches/srichter-twisted-integration2/src/zope/app/twisted/configure.zcml
U Zope3/branches/srichter-twisted-integration2/src/zope/app/twisted/ftp/configure.zcml
U Zope3/branches/srichter-twisted-integration2/src/zope/app/twisted/ftp/ftp.py
U Zope3/branches/srichter-twisted-integration2/src/zope/app/twisted/main.py
U Zope3/branches/srichter-twisted-integration2/src/zope/app/wsgi/__init__.py
U Zope3/branches/srichter-twisted-integration2/zope.conf.in
-=-
Modified: Zope3/branches/srichter-twisted-integration2/src/zope/app/appsetup/schema.xml
===================================================================
--- Zope3/branches/srichter-twisted-integration2/src/zope/app/appsetup/schema.xml 2005-09-09 14:33:04 UTC (rev 38430)
+++ Zope3/branches/srichter-twisted-integration2/src/zope/app/appsetup/schema.xml 2005-09-09 14:45:23 UTC (rev 38431)
@@ -13,12 +13,21 @@
<!-- logging configuration -->
<import package="ZConfig.components.logger" />
- <section type="ZODB.database" name="*" required="yes"
- attribute="database">
+ <multisection type="ZODB.database" name="*" required="yes"
+ attribute="databases">
<description>
- The main application database that should be used.
+
+ Application database.
+
+ At least one database must be specified. The first will be used
+ as the main database. At most one of the databases can be unnamed.
+
+ All of the databases specified will be part of a multi-database.
+ See the ZODB documentation of multi-databases for details of how
+ this is useful.
+
</description>
- </section>
+ </multisection>
<section type="eventlog" attribute="eventlog" name="*" required="yes">
<description>
Modified: Zope3/branches/srichter-twisted-integration2/src/zope/app/server/configure.zcml
===================================================================
--- Zope3/branches/srichter-twisted-integration2/src/zope/app/server/configure.zcml 2005-09-09 14:33:04 UTC (rev 38430)
+++ Zope3/branches/srichter-twisted-integration2/src/zope/app/server/configure.zcml 2005-09-09 14:45:23 UTC (rev 38431)
@@ -1,4 +1,7 @@
-<configure xmlns="http://namespaces.zope.org/zope">
+<configure
+ xmlns="http://namespaces.zope.org/zope"
+ xmlns:zcml="http://namespaces.zope.org/zcml"
+ zcml:condition="have zserver">
<utility
component=".servercontrol.serverControl"
Modified: Zope3/branches/srichter-twisted-integration2/src/zope/app/server/main.py
===================================================================
--- Zope3/branches/srichter-twisted-integration2/src/zope/app/server/main.py 2005-09-09 14:33:04 UTC (rev 38430)
+++ Zope3/branches/srichter-twisted-integration2/src/zope/app/server/main.py 2005-09-09 14:45:23 UTC (rev 38431)
@@ -98,9 +98,10 @@
options.eventlog()
options.accesslog()
- zope.app.appsetup.config(options.site_definition)
+ zope.app.appsetup.config(options.site_definition,
+ features=('zserver',))
- db = multi_database(options.databases)[0][0]
+ db = zope.app.appsetup.appsetup.multi_database(options.databases)[0][0]
notify(zope.app.appsetup.interfaces.DatabaseOpened(db))
Modified: Zope3/branches/srichter-twisted-integration2/src/zope/app/twisted/configure.zcml
===================================================================
--- Zope3/branches/srichter-twisted-integration2/src/zope/app/twisted/configure.zcml 2005-09-09 14:33:04 UTC (rev 38430)
+++ Zope3/branches/srichter-twisted-integration2/src/zope/app/twisted/configure.zcml 2005-09-09 14:45:23 UTC (rev 38431)
@@ -1,25 +1,26 @@
-<configure xmlns="http://namespaces.zope.org/zope">
+<configure
+ xmlns="http://namespaces.zope.org/zope"
+ xmlns:zcml="http://namespaces.zope.org/zcml"
+ zcml:condition="have twisted">
-<!-- XXX: Temporary, till we figure this out.
<utility
component=".servercontrol.serverControl"
provides="zope.app.applicationcontrol.interfaces.IServerControl" />
--->
<utility
- name="Twisted-HTTP"
+ name="HTTP"
component=".http.http"
provides=".interfaces.IServerType"
/>
<utility
- name="Twisted-HTTPS"
+ name="HTTPS"
component=".http.https"
provides=".interfaces.IServerType"
/>
<utility
- name="Twisted-PostmortemDebuggingHTTP"
+ name="PostmortemDebuggingHTTP"
component=".http.pmhttp"
provides=".interfaces.IServerType"
/>
Modified: Zope3/branches/srichter-twisted-integration2/src/zope/app/twisted/ftp/configure.zcml
===================================================================
--- Zope3/branches/srichter-twisted-integration2/src/zope/app/twisted/ftp/configure.zcml 2005-09-09 14:33:04 UTC (rev 38430)
+++ Zope3/branches/srichter-twisted-integration2/src/zope/app/twisted/ftp/configure.zcml 2005-09-09 14:45:23 UTC (rev 38431)
@@ -1,13 +1,13 @@
<configure xmlns="http://namespaces.zope.org/zope">
<utility
- name="Twisted-SFTP"
+ name="SFTP"
component=".sftpserver"
provides="..interfaces.IServerType"
/>
<utility
- name="Twisted-FTP"
+ name="FTP"
component=".ftpserver"
provides="..interfaces.IServerType"/>
Modified: Zope3/branches/srichter-twisted-integration2/src/zope/app/twisted/ftp/ftp.py
===================================================================
--- Zope3/branches/srichter-twisted-integration2/src/zope/app/twisted/ftp/ftp.py 2005-09-09 14:33:04 UTC (rev 38430)
+++ Zope3/branches/srichter-twisted-integration2/src/zope/app/twisted/ftp/ftp.py 2005-09-09 14:45:23 UTC (rev 38431)
@@ -97,7 +97,8 @@
def _stat(self, path, keys):
if self.fs_access.type(path) == 'd':
- raise ftp.WrongFileType()
+ import pdb; pdb.set_trace()
+ raise ftp.WrongFiletype()
result = self._gotlisting(self.fs_access.lsinfo(path), keys)
return result[1]
@@ -118,19 +119,25 @@
def _list_size(self, value):
return value.get('size', 0)
+
def _list_hardlinks(self, value):
return value.get('nlinks', 1)
+
def _list_owner(self, value):
return value.get('owner_name', 'na')
+
def _list_group(self, value):
return value.get('group_name', 'na')
+
def _list_directory(self, value):
return value['type'] == 'd'
+
def _list_modified(self, value):
mtime = value.get('mtime', None)
if mtime:
return int(mtime.strftime('%s'))
return 0
+
def _list_permissions(self, value):
ret = 0
if value.get('other_executable', False):
Modified: Zope3/branches/srichter-twisted-integration2/src/zope/app/twisted/main.py
===================================================================
--- Zope3/branches/srichter-twisted-integration2/src/zope/app/twisted/main.py 2005-09-09 14:33:04 UTC (rev 38430)
+++ Zope3/branches/srichter-twisted-integration2/src/zope/app/twisted/main.py 2005-09-09 14:45:23 UTC (rev 38431)
@@ -110,9 +110,10 @@
observer = log.CommonAccessLoggingObserver()
observer.start()
- zope.app.appsetup.config(options.site_definition)
+ zope.app.appsetup.config(options.site_definition,
+ features=('twisted',))
- db = multi_database(options.databases)[0][0]
+ db = zope.app.appsetup.appsetup.multi_database(options.databases)[0][0]
notify(zope.app.appsetup.interfaces.DatabaseOpened(db))
Modified: Zope3/branches/srichter-twisted-integration2/src/zope/app/wsgi/__init__.py
===================================================================
--- Zope3/branches/srichter-twisted-integration2/src/zope/app/wsgi/__init__.py 2005-09-09 14:33:04 UTC (rev 38430)
+++ Zope3/branches/srichter-twisted-integration2/src/zope/app/wsgi/__init__.py 2005-09-09 14:45:23 UTC (rev 38431)
@@ -97,8 +97,7 @@
appsetup.config(options.site_definition, features=features)
# Connect to and open the database
- # XXX: Handle multiple databases.
- db = options.database.open()
+ db = appsetup.multi_database(options.databases)[0][0]
# Send out an event that the database has been opened
notify(appsetup.interfaces.DatabaseOpened(db))
Modified: Zope3/branches/srichter-twisted-integration2/zope.conf.in
===================================================================
--- Zope3/branches/srichter-twisted-integration2/zope.conf.in 2005-09-09 14:33:04 UTC (rev 38430)
+++ Zope3/branches/srichter-twisted-integration2/zope.conf.in 2005-09-09 14:45:23 UTC (rev 38431)
@@ -6,13 +6,13 @@
interrupt-check-interval 200
<server>
- type Twisted-HTTP
+ type HTTP
address 8080
</server>
# Ready to go HTTPS server. You just need to make sure OpenSSL is installed.
# <sslserver>
-# type Twisted-HTTPS
+# type HTTPS
# address 8443
# privatekeypath server.pem
# certificatepath server.pem
@@ -22,25 +22,25 @@
# (obviously if it's as well, use a different port number). If there's
# an exception, Zope will drop into pdb at the point of the exception.
#<server>
-# type Twisted-PostmortemDebuggingHTTP
+# type PostmortemDebuggingHTTP
# address 8080
#</server>
# A special HTTP server that records HTTP session that can be converted to
# functional tests.
# <server>
-# type Twisted-RecordingHTTP
+# type RecordingHTTP
# address 8081
# </server>
<server>
- type Twisted-FTP
+ type FTP
address 8021
</server>
# You must install pycrypto to use the SFTP server.
# <sshserver>
-# type Twisted-SFTP
+# type SFTP
# address 8115
# hostkey ssh_host_rsa_key
# </sshserver>
More information about the Zope3-Checkins
mailing list