[Zope] Error publishing resource
Johan Carlsson
johanc at virtutech.com
Mon Aug 30 06:49:43 EDT 2004
Garito wrote:
> Hi Johan and Paul
> I would __bobo_traverse__ returns a string instead an object because
> this function generates the response dynamically (is for that reason
> that the function returns a string)
> How can I return a string? Do I need to create an object obligatorily?
Well, you could return the object declaring the __bobo_traverse__ and
let that objects index_html/__call__ return the string,
but first setting the string in a _v_attribute or in the REQUEST.
Or you could create an object on-the-fly that:
class TempPublishable(some base classes: Aquisition.Implicit maybe??):
def __init__(self, the_string):
self.the_string=the_string
def index_html(self, REQUEST=None):
"""return the string"""
return self.the_string
I'm not sure exactly what base classes and security settings that needs
to be use on the TempPublishable?
Also you might want to peek att ZSQLMethods which uses traverse to
publish databse rows as objects.
Regards,
Johan Carlsson
More information about the Zope
mailing list