[Zope] "Empty or invalid id specified" when trying to add a new product

Alexander Busorgin aleksandrmailbox at yahoo.com
Mon Feb 9 01:15:49 EST 2004


Hi All,
I've created a simple product, but I cant add it to
folder. I get this error "Empty or invalid id
specified"
can you tell me where is a problem?

thanks.


__init__.py
========
import helloMod

def initialize(context):
    context.registerClass(
    helloMod.helloClass,
    permission="HelloObj",
    constructors=(helloMod.manage_addHelloForm,
    helloMod.manage_addHello)
    )

helloMod.py
========
from OFS.SimpleItem import Item
from Globals import Persistent
from Acquisition import Implicit

def manage_addHelloForm(self, REQUEST):
    "to add HelloObj"
    return """
    <html>
    <head></head>
    <body>
    <form method="post" action="./manage_addHello">
    <input type="text" name="id">
    <input type="submit" value="Add HelloObj">
    </form>
    </body>
    </html>
    """

def manage_addHello(self):
    "to add HelloObj"
    newHello = helloClass(id)
    self._setObject(id, newHello)
    return self.manage_main(self, REQUEST)


class helloClass(Item, Persistent, Implicit):
    def __init__(self, id, Name = 'hi'):
        self.id = id
        self.Name = Name

    meta_type = "HelloObj"

    def saySomething(self):
        return "Hi, " + self.Name
    def edit(self, Name):
        self.Name = Name






__________________________________
Do you Yahoo!?
Yahoo! Finance: Get your refund fast by filing online.
http://taxes.yahoo.com/filing.html



More information about the Zope mailing list