Can't fathom 'method-populated' selection lists in Zclasses
Hi Folks, I'm having a little issue with selection-type values in ZClass property sheets (I'm using Zope 2.7 but have the same issue under 2.6) What I'm trying to achieve is this: All the documentation I've read says that the 'selection' type for a property of a ZClass property sheet can be a variable *or a method*. Fine. This works as advertised, except where the method is a method *defined within the Zclass* (e.g. as MyZClass.propertysheets.methods.myMethod ). Is this a known bug? A feature? Do I need some arcane Zope Zen syntax to unlock this behaviour? N.B. If the method resides *outside* the ZClass (e.g. as a python script in the root folder) all things works just fine. The only 'diagnostic' I get is on the property sheet containing the selection type property: it displays e.g. 'No value for myMethod' instead of the expected drop-down box. Any help most appreciated. Cheers Bob
Bob Marshall wrote at 2003-7-18 09:04 -0000:
... All the documentation I've read says that the 'selection' type for a property of a ZClass property sheet can be a variable *or a method*. Fine. This works as advertised, except where the method is a method *defined within the Zclass* (e.g. as MyZClass.propertysheets.methods.myMethod ). Is this a known bug? A feature? Do I need some arcane Zope Zen syntax to unlock this behaviour?
N.B. If the method resides *outside* the ZClass (e.g. as a python script in the root folder) all things works just fine.
The only 'diagnostic' I get is on the property sheet containing the selection type property: it displays e.g. 'No value for myMethod' instead of the expected drop-down box.
I used this already and it worked (so I do not have time at the moment to check whether it still works). It will not work in the constructor form (as at that time there is not yet a ZInstance that can access "methods" directly). It should work as soon as you have a ZInstance. Dieter
Thanks greatly for the insight! Ironically, the main reason I was doing things this way was to get the constructor form and the Zinstances to *both work* and 'sing from the same method'. It was indeed the constructor form not working that was puzzling me. Oh well, back to the drawing board... Just in case anyone has cracked the undelying issue: what I'd really like is some way to have both the ZClass constructor form and its ZInstances to use the same mechanism (encapsulated within the ZClass) for 'sourcing' selection list data. Just tell me it isn't possible and I'll move on... Dieter Maurer <dieter@handshake.de> said:
Bob Marshall wrote at 2003-7-18 09:04 -0000:
... All the documentation I've read says that the 'selection' type for a property of a ZClass property sheet can be a variable *or a method*. Fine. This works as advertised, except where the method is a method *defined within the Zclass* (e.g. as MyZClass.propertysheets.methods.myMethod ). Is this a known bug? A feature? Do I need some arcane Zope Zen syntax to unlock this behaviour?
N.B. If the method resides *outside* the ZClass (e.g. as a python script in the root folder) all things works just fine.
The only 'diagnostic' I get is on the property sheet containing the selection type property: it displays e.g. 'No value for myMethod' instead of the expected drop-down box.
I used this already and it worked (so I do not have time at the moment to check whether it still works).
It will not work in the constructor form (as at that time there is not yet a ZInstance that can access "methods" directly). It should work as soon as you have a ZInstance.
Dieter
--
Bob Marshall wrote at 2003-7-19 06:03 -0000:
Thanks greatly for the insight! Ironically, the main reason I was doing things this way was to get the constructor form and the Zinstances to *both work* and 'sing from the same method'. It was indeed the constructor form not working that was puzzling me. Oh well, back to the drawing board...
Just in case anyone has cracked the undelying issue: what I'd really like is some way to have both the ZClass constructor form and its ZInstances to use the same mechanism (encapsulated within the ZClass) for 'sourcing' selection list data. Just tell me it isn't possible and I'll move on...
I would try my "Reference" products and put a reference to your method in your product. Then the constructor would use the method (via the reference) from the product while the ZInstance would use it directly. For my "Reference" product, see <http://www.dieter.handshake.de/pyprojects/zope> Dieter
Hi Dieter, Thanks anew for your continued help and advice. I've downloaded and installed your Reference product as suggested. I see where it's coming from in general terms, but it's way beyond me to get it working. Guess I'm just too dumb. So I will indeed place this issue in the 'bucking horse' category and walk down another street... Cheers Bob Dieter Maurer <dieter@handshake.de> said:
Bob Marshall wrote at 2003-7-19 06:03 -0000:
Thanks greatly for the insight! Ironically, the main reason I was doing things this way was to get the constructor form and the Zinstances to *both work* and 'sing from the same method'. It was indeed the constructor form not working that was puzzling me. Oh well, back to the drawing board...
Just in case anyone has cracked the undelying issue: what I'd really like is some way to have both the ZClass constructor form and its ZInstances to use the same mechanism (encapsulated within the ZClass) for 'sourcing' selection list data. Just tell me it isn't possible and I'll move on...
I would try my "Reference" products and put a reference to your method in your product.
Then the constructor would use the method (via the reference) from the product while the ZInstance would use it directly.
For my "Reference" product, see
<http://www.dieter.handshake.de/pyprojects/zope>
Dieter
--
Bob Marshall wrote at 2003-7-22 07:03 -0000:
... I've downloaded and installed your Reference product as suggested. I see where it's coming from in general terms, but it's way beyond me to get it working.
Why? What happened? A "Reference" is like a symbolic link on Unix. You have an objects that behaves (almost) like the object it links to (identified via a path). It should not be difficult to use... Dieter
participants (2)
-
Bob Marshall -
Dieter Maurer