I could do: app.restrictedTraverse('/zport/dmd/version')
which gives me 'Zenoss 4.2.4'
, but when I do the same in the browser, it gives me
Site error. An error was encountered while publishing this resource. The requested resource does not exist.
For some other values or functions on dmd
object it works. How do I debug "does not exists" error, and how mapping from url to object in Zope works?
Citing the ZPublisher.BaseRequest.DefaultPublishTraverse.publishTraverse:
# Ensure that the object has a docstring, or that the parent
# object has a pseudo-docstring for the object. Objects that
# have an empty or missing docstring are not published.
doc = getattr(subobject, '__doc__', None)
if not doc:
raise Forbidden(
"The object at %s has an empty or missing " \
"docstring. Objects must have a docstring to be " \
"published." % URL
)
# Hack for security: in Python 2.2.2, most built-in types
# gained docstrings that they didn't have before. That caused
# certain mutable types (dicts, lists) to become publishable
# when they shouldn't be. The following check makes sure that
# the right thing happens in both 2.2.2+ and earlier versions.
if not typeCheck(subobject):
raise Forbidden(
"The object at %s is not publishable." % URL
)
typeCheck
regards this types as forbidden:
('NoneType', 'IntType', 'LongType', 'FloatType', 'StringType',
'BufferType', 'TupleType', 'ListType', 'DictType', 'XRangeType',
'SliceType', 'EllipsisType', 'UnicodeType', 'CodeType',
'TracebackType', 'FrameType', 'DictProxyType', 'BooleanType',
'ComplexType')