Hello, I try to write a Zope-Product and I always get following Error: Error Type: UnpickleableError Error Value: Cannot pickle objects The problem is the following line in the __init__ method of the class: self.menuHeader = HTML('<table>',globals()) I thought it should be possible as the class HTML inherits from Persistent or is it impossible to include objects in the first place. Thanks for any help! arne ######################################### from OFS.SimpleItem import SimpleItem import Persistence from Globals import HTML class AmazingMenu(SimpleItem,Persistence.Persistent): title = "Amazing Menu Tree" meta_type = 'Amazing Menu' manage_options = ( { 'label':'Tree','action':'manageTree' }, { 'label':'Header','action':'manageTemplates' }, { 'label':'Settings','action':'manageSettings' }, { 'label':'Consistency Check','action':'consistencycheck' }, ) def __init__(self,id): self.id = id self.menuHeader = HTML('<table>',globals()) self.link_target = '' return . . . . def manageAddAmazingMenuForm(self,REQUEST): o = AmazingMenu('amazing_menu') self._setObject('amazing_menu',o) return "abcd" #####################################
Arne Krug writes:
I try to write a Zope-Product and I always get following Error:
Error Type: UnpickleableError Error Value: Cannot pickle objects
The problem is the following line in the __init__ method of the class: self.menuHeader = HTML('<table>',globals()) I thought it should be possible as the class HTML inherits from Persistent or is it impossible to include objects in the first place. No, you can include objects, even non-persistent ones.
They need only be picklable. I do not see what is the cause of your problem, though. I would try: from Globals import DTMLFile class AmazingMenu(....) menuHeader= DTMLFile('the file name',globals()) ... def __init__(...): Dieter
Thanks, it works with DTMLFile or HTMLFile. But I still have a general question about the Globals.HTML class. I tried to include a HTML object in the Boring Product: __init__.... self.test = HTML('<table>', globals()) for example and it did not work either. The same "UnpickleableError" occurred. What is wrong with including a HTML object in the product. Isn't it more or less just a string.... Arne
Arne Krug writes:
I try to write a Zope-Product and I always get following Error:
Error Type: UnpickleableError Error Value: Cannot pickle objects
The problem is the following line in the __init__ method of the class: self.menuHeader = HTML('<table>',globals()) I thought it should be possible as the class HTML inherits from Persistent or is it impossible to include objects in the first place. No, you can include objects, even non-persistent ones.
They need only be picklable.
I do not see what is the cause of your problem, though.
I would try:
from Globals import DTMLFile
class AmazingMenu(....) menuHeader= DTMLFile('the file name',globals()) ... def __init__(...):
Dieter
--- Arne Krug: --- --- ufcx@rz.uni-karlsruhe.de --- --- akrug@mps.de ---
participants (3)
-
Arne Krug -
Arne Krug -
Dieter Maurer