Problem with Zclass Property Sheet
Hello, I have developed a product with ZClasses called Newster. The newsclass contains a subclass called message that contains the messages. Everything works really swell (you can see the frontpage at www.openauth.co.uk <http://www.openauth.co.uk/> ) but I have the following problems: 1. I tried to create a Boolean property in the message class basic property sheet to tick to expire messages. However, when I create a propert_sheet_interface, the template code is generated fine except that for some reason the Boolean property doesn't work properly. I cannot unselect it once it is selected and no matter how much I scratch around in the code, I cannot resolve this issue. In the end I replaced the Boolean property with a string object and just set it from 0 to 1 when I want to expire messaged. Is this a known issue and is there a Boolean based workaround? 2. Also, how do I give my Zope product an icon in the free view? I guess I have to set this somewhere in the Zclass, but how? All help appreciated, Thanks, Pieter
Hi, as to 1) I guess you used a checkbox to represent yor boolean property?? If so, those beasts are a little nasty to handle. If you uncheck a checkbox in a HTML from, it means that the value will not be posted to the recieving action at all! So you need to check if the variable is posted at all, if not, you need to set the boolean property to 0 by yourself. There are ways around this in your form, but this might be the solution... Cheers Jochen Am Donnerstag, 30.01.03, um 18:33 Uhr (Europe/Berlin) schrieb pieter claassen:
Hello,
I have developed a product with ZClasses called Newster. The newsclass contains a subclass called message that contains the messages.
Everything works really swell (you can see the frontpage at www.openauth.co.uk ) but I have the following problems:
1. I tried to create a Boolean property in the message class basic property sheet to tick to expire messages. However, when I create a propert_sheet_interface, the template code is generated fine except that for some reason the Boolean property doesn’t work properly. I cannot unselect it once it is selected and no matter how much I scratch around in the code, I cannot resolve this issue. In the end I replaced the Boolean property with a string object and just set it from 0 to 1 when I want to expire messaged. Is this a known issue and is there a Boolean based workaround? 2. Also, how do I give my Zope product an icon in the free view? I guess I have to set this somewhere in the Zclass, but how?
All help appreciated,
Thanks,
Pieter
At 11:15 AM 1/30/2003, Jochen Haeberle wrote:
as to 1) I guess you used a checkbox to represent yor boolean property?? If so, those beasts are a little nasty to handle. If you uncheck a checkbox in a HTML from, it means that the value will not be posted to the recieving action at all!
That's true, and having this problem strongly suggests the original poster is not doing any input validation. Server-side input validation should be considered a baseline requirement in any non-trivial project. That goes double for any user-supplied data that gets supplied to a SQL database. At a minimum, validation should consist of iterating over a list of *expected* fields, not the list of fields that are posted to REQUEST.form. Assuming you're now working with *expected* fields, you extract the posted value with REQUEST.get(field_name, default_value) where default_value is the appropriate value for the condition where the field is not found. For checkboxes, that "not found" value should map to what value you associate with "not checked", i.e., 0. FWIW, Dylan
pieter claassen a écrit:
Hello,
I have developed a product with ZClasses called Newster. The newsclass contains a subclass called message that contains the messages.
Everything works really swell (you can see the frontpage at www.openauth.co.uk <http://www.openauth.co.uk/> ) but I have the following problems:
1. I tried to create a Boolean property in the message class basic property sheet to tick to expire messages. However, when I create a propert_sheet_interface, the template code is generated fine except that for some reason the Boolean property doesn?t work properly. I cannot unselect it once it is selected and no matter how much I scratch around in the code, I cannot resolve this issue. In the end I replaced the Boolean property with a string object and just set it from 0 to 1 when I want to expire messaged. Is this a known issue and is there a Boolean based workaround? 2. Also, how do I give my Zope product an icon in the free view? I guess I have to set this somewhere in the Zclass, but how?
Through the ZMI, go to ControlPanel / Products / <yourproduct> / <yourzclass> and click the Basic Tab, and fill in the icon path field.
All help appreciated,
Thanks,
Pieter
-- Andre PZP Enthusiast
participants (4)
-
D2 -
Dylan Reinhardt -
Jochen Haeberle -
pieter claassen