[Zope3-Users] Schemas / Interfaces / Constructor Arguments
Chris Lehmann
clehmann at booksys.com
Mon Sep 5 10:52:27 EDT 2005
Hello,
I'm new to zope3 and have run into some questions using schemas. I have
an interface defined called IMusicPlayer. It looks like the following:
class IMusicPlayer( Interface ):
"A device that can play music"
description= TextLine(
title=u"description",
description=u"Description of this music player.",
default=u"",
required=False)
...
I have 2 classes that implement this interface, a LocalMusicPlayer and a
RemoteMusicPlayer. The constructors on these two classes differ.
class LocalMusicPlayer:
implements(IMusicPlayer)
"A music player on the local machine"
def __init__( self, xmmsPath )
...
class RemoteMusicPlayer:
implements(IMusicPlayer)
"A music player on the local machine"
def __init__( self, ipAddress )
...
I've been trying to use the browser:addForm zcml directive to auto
generate forms to add these objects. How do (can I?) specify the
additional arguments to the implementing classes without them actually
being in the schema or must I define a schema for every single object?
Being able to add arbitrary fields on a form and using zcml to describe
how they should be passed to a factory as argument would be a very
powerful feature.
Thanks for your help,
Chris
--
Chris Lehmann
Software Developer
Booksystems, Inc
clehmann at booksys.com
More information about the Zope3-users
mailing list