[Zope3-checkins] CVS: Zope3/src/zope/app/sqlscript -
configure.zcml:1.6 interfaces.py:1.5
Stephan Richter
srichter at cosmos.phy.tufts.edu
Sat Apr 24 19:20:10 EDT 2004
Update of /cvs-repository/Zope3/src/zope/app/sqlscript
In directory cvs.zope.org:/tmp/cvs-serv30633/src/zope/app/sqlscript
Modified Files:
configure.zcml interfaces.py
Log Message:
Get rid of special SQLConnectionName field in favor of Choice and a vocabulary.
=== Zope3/src/zope/app/sqlscript/configure.zcml 1.5 => 1.6 ===
--- Zope3/src/zope/app/sqlscript/configure.zcml:1.5 Sat Mar 13 18:01:12 2004
+++ Zope3/src/zope/app/sqlscript/configure.zcml Sat Apr 24 19:20:10 2004
@@ -16,7 +16,10 @@
alias="zope.app.interfaces.content.sql"
/>
-
+ <vocabulary
+ name="Connections"
+ factory="zope.app.utility.vocabulary.UtilityVocabulary"
+ interface="zope.app.rdb.interfaces.IZopeDatabaseAdapter" />
<permission
id="zope.AddSQLScripts"
=== Zope3/src/zope/app/sqlscript/interfaces.py 1.4 => 1.5 ===
--- Zope3/src/zope/app/sqlscript/interfaces.py:1.4 Wed Apr 14 18:32:48 2004
+++ Zope3/src/zope/app/sqlscript/interfaces.py Sat Apr 24 19:20:10 2004
@@ -16,37 +16,20 @@
"""
import zope.schema
from zope.app import zapi
-from zope.app.rdb.interfaces import IZopeDatabaseAdapter, ISQLCommand
+from zope.app.rdb.interfaces import ISQLCommand
from zope.component import getService, ComponentLookupError
from zope.app.i18n import ZopeMessageIDFactory as _
class MissingInput(Exception):
pass
-class SQLConnectionName(zope.schema.EnumeratedTextLine):
- """SQL Connection Name"""
-
- def __allowed(self):
- """Note that this method works only if the Field is context wrapped."""
-
- try:
- connections = zapi.getUtilitiesFor(self.context,
- IZopeDatabaseAdapter)
-
- except ComponentLookupError:
- return []
-
- return [c[0] for c in connections]
-
-
- allowed_values = property(__allowed)
-
class ISQLScript(ISQLCommand):
"""A persistent script that can execute SQL."""
- connectionName = SQLConnectionName(
+ connectionName = zope.schema.Choice(
title=_(u"Connection Name"),
description=_(u"The Connection Name for the connection to be used."),
+ vocabulary="Connections",
required=False)
arguments = zope.schema.BytesLine(
More information about the Zope3-Checkins
mailing list