Hello everyone,

Although it is quite rare, when one changes the SITE_NAME from inveniocfg and then tries to run for example WebSearchadmin, he gets an exception saying:

2012-10-27 21:36:21 -> IntegrityError: (1062, "Duplicate entry 'XXXXX' for key 
'name'") (connections.py:36:defaulterrorhandler)

Indeed, websearchadminlib.py gets executed and tries to 'rebuild' the root collection:

    if CFG_SITE_NAME != run_sql("SELECT name from collection WHERE id=1")[0][0]:

        res = run_sql("update collection set name=%s where id=1", 
(CFG_SITE_NAME, ))


But the update fails because 'name' is unique and the requested name already exists as in a collection/subcollection. So admin gets an exception.

Ideally, one should either check the proposed name upon inveniocfg --reset-sitename (and give an error that the name already exists in another collection, and so it can't be used), or at least give a proper error message in websearchadminlib.py, or better, BOTH! :) If i find some time tomorrow, I'll propose a patch (it should be a matter of just 4-5 lines of code).

Best regards,
Theodoros

Reply via email to