[Zope-dev] Extending Zope's ZConfig Schema in a Product?

Stuart Bishop stuart at stuartbishop.net
Sun Jul 3 22:19:59 EDT 2005


Sidnei da Silva wrote:

> Right, seems that's my only choice for the time being.
> 

We currently do this in our 'start Z3' script before any of the Zope imports
are done:

# Disgusting hack to use our extended config file schema rather than the
# Z3 one. TODO: Add command line options or other to Z3 to enable
# overriding this -- StuartBishop 20050406
from zdaemon.zdoptions import ZDOptions
ZDOptions.schemafile = the_path_to_our_schema_dot_xml

You can then write a schema.xml that inherits from the Z3 one:

<schema extends="../../zope/app/server/schema.xml">
  <sectiontype name="foo">
     <key name="bar" datatype="string" default="Fnord" />
  </sectiontype>

  <multisection name="+" type="foo" attribute="foo" />
</schema>


We are trying to centralize all our knobs and buttons into one place - ZCML
isn't suitable for tweaking an application being rolled out to multiple
servers (dev boxes, staging servers, production server instances) because
there is too much boilerplate and syntax around the knob you need to tweak,
and way too complex for a drunk sysadmin to handle. eg. it is much easier to
have 'smtp on' in launchpad.conf than it is to configure the correct IMailer
directives and whatnot with he correct magic names so that the application
sends email via SMTP rather than sendmail.

So far, ZConfig has been way overkill for this but allows us to keep our
config in the same config as the port numbers and logfile destinations
(without having to generate it from some other source, which we will
probably do in the future to solve some production rollout issues).

-- 
Stuart Bishop <stuart at stuartbishop.net>
http://www.stuartbishop.net/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: OpenPGP digital signature
Url : http://mail.zope.org/pipermail/zope-dev/attachments/20050704/90ef6161/signature.bin


More information about the Zope-Dev mailing list