Roman Klesel wrote:
> Hello,
> 
> I'm in the process of learning to develop fs-zope-products.
> 
> The developers guide recommends to write interfaces and implement them in 
> classes. Now my question:
> 
> When I have an interface:
> 
> DoThings
> 
> with several methods:
> 
> doThis()
> doThat()
> doThattoo()
> ...
> 
> and I have an implementation:
> 
> DoThingsClass
> 
> How will I then access the methods e.g. in a Template?

myObject = DoThingsClass(any_args_here)
myObject.doThis()

> 
> Through the interface:
> 
> tal:define="context/DoThings/doThis"

should be:
tal:define="some_name context/some_thing/some_attribute_or_method"

> or through the implemantation:
> 
> tal:define="context/DoThingsClass/doThis"

Looks like you're newbie to OO too !-)

A class defines a type. You then need to have an instance of that type
(like, say, 42 is an instance of type integer and 'foo' is an instance
of type string).

(Interfaces (I mean, 'explicit' interfaces) defines an 'abstract' type,
that can be implemented by many classes. With Python's dynamic typing,
you don't *need* explicit interfaces - at least with Zope 2.x. AFAICT,
the recommandation to use explicit interfaces is mostly about Zope3
relying on them to implement some nice features).

So it would be:

tal:define="some_name context/myObject/doThis"

As you see, you don't have to worry about interface at this level...

> I would think the first one should be the case. 

And you would be wrong.

> Please shed some light on me!
> 

Hope that does...

-- 
bruno desthuilliers
développeur
[EMAIL PROTECTED]
http://www.modulix.com
_______________________________________________
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )

Reply via email to