def _RopeFactory(id, class_, title=''):
    ob = class_()
    keySupport = IKeyIdSubobjectSupport(ob)
    if not keySupport.isSubobject(id):
        raise ValueError("wrong id")
    ob.id = id
    ob.title = str(title)
    return ob
Example #2
0
def manage_addRopeSimpleItem(dispatcher, id, title='', REQUEST=None):
    """Adds a new RopeSimple object with id *id*,
    connected with database .
    """
    class_ = dispatcher.getMapperClass()
    ob = class_()
    keySupport = IKeyIdSubobjectSupport(ob)
    if not keySupport.isSubobject(id):
        raise ValueError("wrong id")
    ob.id = id
    ob.title = str(title)
    dispatcher._setObject(id, ob)
    ob = ob.__of__(dispatcher)
    if REQUEST is not None:
        return dispatcher.manage_main(dispatcher, REQUEST, update_menu=1)