[Zope] zclass propertysheets
Danny Morgan
danielhmorgan@cox.net
Mon, 28 Oct 2002 19:24:09 -0600
from within
the following one-line .py script returns '1':
return(context.propertysheets.common.history.hasProperty('recent'))
when changed to:
return(context.propertysheets.common.history.getProperty('recent'))'',
the result is an attribute error, with the following traceback:
Traceback (innermost last):
File /usr/local/zope/2.3.3/lib/python/ZPublisher/Publish.py, line 223, in publish_module
File /usr/local/zope/2.3.3/lib/python/ZPublisher/Publish.py, line 187, in publish
File /usr/local/zope/2.3.3/lib/python/Zope/__init__.py, line 221, in zpublisher_exception_hook
(Object: Traversable)
File /usr/local/zope/2.3.3/lib/python/ZPublisher/Publish.py, line 171, in publish
File /usr/local/zope/2.3.3/lib/python/ZPublisher/mapply.py, line 160, in mapply
(Object: test)
File /usr/local/zope/2.3.3/lib/python/ZPublisher/Publish.py, line 112, in call_object
(Object: test)
File /usr/local/zope/2.3.3/lib/python/Shared/DC/Scripts/Bindings.py, line 324, in __call__
(Object: test)
File /usr/local/zope/2.3.3/lib/python/Shared/DC/Scripts/Bindings.py, line 354, in _bindAndExec
(Object: test)
File /usr/local/zope/2.3.3/lib/python/Products/PythonScripts/PythonScript.py, line 336, in _exec
(Object: test)
(Info: ({'script': <PythonScript instance at 8a0a080>, 'context': <ZClassMethodsSheet instance at 8a845a0>, 'container': <ZClassMethodsSheet instance at 8a845a0>, 'traverse_subpath': []}, (), {}, None))
File Script (Python), line 2, in test
(Object: <lambda>)
File /usr/local/zope/2.3.3/lib/python/OFS/PropertySheets.py, line 224, in getProperty
(Object: Traversable)
File /usr/local/zope/2.3.3/lib/python/ZClasses/Property.py, line 139, in v_self
(Object: Traversable)
AttributeError: _zclass_
thanks again,
Danny
==============================
Dieter Maurer wrote:
>Danny Morgan writes:
> > for some reason, I can get some propertysheet information, but not others:
> >
> > with 'history' being a property sheet of a ZClass,
> >
> > These work:
> > return(context.propertysheets.history.propertyMap())
> >
> > return(context.propertysheets.history.getPropertyType('recent'))
> >
> > But not this:
> >
> > return(context.propertysheets.history.getProperty('recent'))
> >
> >
> >
> > Any clues will be appreciated
>You forget to give us enough clues to help you:
>
> Error Type, Error Value and traceback, if "does not work" means an exception
>
> precise error description, if "does not work" means something else.
>
>In your case, I can expect that "context" does not have the property
>"recent". Then, "getProperty" will return "None".
>ZPublisher and your brower will behave strange when they see the "None".
>
>
>Dieter
>
>
>