UnpickleableError

Django, Flask, Bottle, WSGI, CGI…
Antworten
xturbo

Hallo,

ich versuche gerade mein erstes eigenes Zope Product zu bauen.

Leider bekomme ich beim Anlegen eines neuen Objekt im ZMI immer einen UnpickleableError.

Code: Alles auswählen

Site Error

An error was encountered while publishing this resource.

UnpickleableError
Sorry, a site error occurred.

Traceback (innermost last):

    * Module ZPublisher.Publish, line 175, in publish_module_standard
    * Module ZPublisher.Publish, line 132, in publish
    * Module Zope.App.startup, line 204, in zpublisher_exception_hook
    * Module ZPublisher.Publish, line 107, in publish
    * Module Zope.App.startup, line 222, in commit
    * Module ZODB.Transaction, line 241, in commit
    * Module ZODB.Transaction, line 356, in _commit_objects
    * Module ZODB.Connection, line 452, in commit
      __traceback_info__: (('Products.BloodBowl.bbskill', 'ZBBSkill'), '\x00\x00\x00\x00\x00\x00\x11\xe1', '')

UnpickleableError: Cannot pickle <type 'weakproxy'> objects (Also, an error occurred while attempting to render the standard error message.)
Ich habe zunächst eine simple Basisklasse, die sieht in etwa so aus:

Code: Alles auswählen

class BBSkill:
    """This class represents a skill, trait or racial characteristic.
    To create a skill object use
    
    >>> skill = BBSkill('Block', skillparser)
    
    The skillname must be found in the skills.xml config file, otherwise all skill properties will be empty."""
    def __init__(self, skillname, skillparser):
        """Constructor"""
        self.skillname = skillname
        self.skillparser = skillparser
        self.__initProperties()
        
    def __initProperties(self):
        """Initialize skill properties."""
        try:
            skillprops = self.skillparser.getSkill(self.skillname)
            self.type = skillprops[0]
            self.category = skillprops[1]
            self.description = skillprops[2]
        except KeyError, err:
            self.type = ""
            self.category = ""
            self.description = ""
            print "Invalid skill:", err
        
    def isTrait(self):
        """-> bool
        Returns true if the skill is a trait, otherwise false."""
        if string.lower(self.type) in __IS_TRAIT__:
            return True
        else:
            return False
        
    def getSkillname(self):
        """-> str
        Returns the name of the skill."""
        return self.skillname
        
    def getCategory(self):
        """-> str
        Returns the category of the skill."""
        return self.category
        
    def getDescription(self):
        """-> str
        Returns a detailed description of the skill/trait."""
        return self.description
Die eigentlich Zope Klasse heisst ZBBSkill und ist von BBSkill abgeleitet.

Code: Alles auswählen

class ZBBSkill(BBSkill, SimpleItem, PropertyManager, JMZPTMacros):

  def __init__(self,id,title='',skillname='',description=''):
    """Contructor method to initialize the properties of our class"""
    #Create and initilize the class attributes
    BBSkill.__init__(self, skillname, parser) #wenn ich diese zeile weglasse geht es!?!?
    self.id=id
    self.title=title
    self.description=description
Das seltsame ist, wenn ich den Konstruktor der Superklasse nicht aufrufe funktioniert es!
Was mach ich falsch???
Antworten