[Zope3-Users] traversing/publishing a simple attribute
Sascha Ottolski
sascha.ottolski at lalisio.com
Sat Nov 11 12:34:45 EST 2006
Hi,
I hope someone has a hint for a very simple task I just am not able to
resolve: publishing a class attribute to the browser. Pseudo code:
IThing(Interface):
something = schema.TextLine(title='an attribute')
class MyThing(Contained, Persistent):
implements(IThing)
something = FieldProperty(IThing['something'])
<class .MyThing>
<require
permission="zope.View"
interface=".interfaces.IThing"
/>
</class>
In the ZMI, I create an instance of "MyThing" with the name "testhing",
and put the string "sometext" in the "something" attribute.
Now all I want is being able to visit
http://localhost:8080/testhing/something, which would simply return the
string "sometext". I'm wondering if this can be done without writing a
view, and without making MyThing a Container.
As far as I understand the publishing traverser needs to know how to get
from the "testhing" object to it's "something" attribute. If I'm right,
how do I make MyThing traversable?
Of course, the example doesn't make too much sense, but it drives me
crazy that I seem to be too dumb to solve even this :-(
May be it's not possible with a TextLine, as for publishing the
attribute must be callable? In fact I'm trying to get this done with a
custom MyProperty(FieldProperty) that creates an attribute that is
callable and that has an index.html view.
Thanks,
Sascha
--
Lalisio GmbH www.lalisio.com
Puschkinstraße 1 fon +49-(0)361/541 43 80
99084 Erfurt fax +49-(0)361/541 43 79
kontakt at lalisio.com
More information about the Zope3-users
mailing list