There is probabaly some nuance that I'm missing, but I don't see it. I have a product that I'm trying to get going, but I keep getting this nagging AttributeError on line 8 of my __init__.py file regarding them manage_addDoctrineAction. For the life of me, I don't see what the problem could be. Any hints anyone? Here is the __init__.py file... import Doctrine def initialize(context): """Initialize the Legal Doctrine Product.""" context.registerClass( Doctrine, constructors = ( Doctrine.manage_addDoctrineForm, Doctrine.manage_addDoctrineAction ), icon = 'images/Doctrine.jpg' ) Here is the Doctrine.py file... __doc__ = """Legal Doctrine Object""" __version__ = '0.1' from OFS import SimpleItem from Globals import DTMLFile manage_addDoctrineForm = DTMLFile('doctrine/manage_addDoctrineForm', globals()) manage_editDoctrineForm = DTMLFile('doctrine/manage_editDoctrineForm', globals()) class Doctrine(SimpleItem.SimpleItem): "Legal Doctrine Object" meta_type = 'Legal Doctrine' mange_options = ( {'label': 'Properties', 'action': 'manage_editForm'}, {'label': 'View', 'action': 'index_html'}, ) def __init__(self, id, title, comments, status, thumbs_up, maintainer): "Initialize a new instance of the Legal Doctrine object" self.id = id self.title = title self.comments = comments self.status = status self.thumbs_up = thumbs_up self.maintainer = maintainer # The following is used to display the object's contents... index_html = DTMLFile('doctrine/index_html', globals()) def manage_addDoctrineAction(self, id, title, comments, status, thumbs_up, maintainer, RESPONSE=None): "Add a Doctrine to a folder." self._setObject(id, Doctrine(id, title, comments, status, thumbs_up, maintainer)) RESONSE.redirect('index_html') def manage_editDoctrineAction(self, title, comments, status, thumbs_up, maintainer, RESPONSE=None): "Change the instance values." self.title = title self.comments = comments self.status = status self.thumbs_up = thumbs_up self.maintainer = maintainer self._p_changed = 1 RESPONSE.redirect('manage_editDoctrineForm')
Hi, "Ronald L. Chichester" wrote:
There is probabaly some nuance that I'm missing, but I don't see it. I have a product that I'm trying to get going, but I keep getting this nagging AttributeError on line 8 of my __init__.py file regarding them manage_addDoctrineAction. For the life of me, I don't see what the problem could be. Any hints anyone?
...
Here is the Doctrine.py file...
__doc__ = """Legal Doctrine Object""" __version__ = '0.1'
def manage_addDoctrineAction(self, id, title, comments, status, thumbs_up, maintainer, RESPONSE=None): "Add a Doctrine to a folder." self._setObject(id, Doctrine(id, title, comments, status, thumbs_up, maintainer)) RESONSE.redirect('index_html')
perhaps it would help to say RESPONSE.redirect('index_html') instead of RESONSE.redirect('index_html') ? Ciao, Jochen -- -------------------------------------------------- Jochen Knuth WebMaster http://www.ipro.de IPRO GmbH Phone ++49-7152-93330 Steinbeisstr. 6 Fax ++49-7152-933340 71229 Leonberg EMail: J.Knuth@ipro.de
Several problems. Comments inserted into your post... Ronald L. Chichester writes:
a product that I'm trying to get going, but I keep getting this nagging AttributeError on line 8 of my __init__.py file regarding them manage_addDoctrineAction. For the life of me, I don't see what the problem could be. Any hints anyone?
Here is the __init__.py file...
import Doctrine
def initialize(context): """Initialize the Legal Doctrine Product."""
context.registerClass( Doctrine, This should be a class, not a module... You want:
Doctrine.Doctrine
constructors = ( Doctrine.manage_addDoctrineForm, Doctrine.manage_addDoctrineAction
Your "manage_addDoctrineAction" is a class method not a module function. Therefore, it is not in the module's namespace ("Doctrine"). The "AttributeError" is justified. It should become a module function, as it is used to create the object. It cannot be a method, as this would require the object is already there.
), icon = 'images/Doctrine.jpg' )
Dieter
participants (3)
-
Dieter Maurer -
Jochen Knuth -
Ronald L. Chichester