Forum OpenACS Development: Re: Error in site_node_apm_integration::get_child_package_id

Posted by Gustaf Neumann on

if i see correctly, this is not a problem of the "current implementation", but the interface was designed that way. The documentation speaks clearly about a singular package_id, and there are at least 8 places in the sources of the packages in the oacs-5-8 tree, where a variable package_id (singular) is assigned and where the code assumes at most one value.

So, this change is not a simple fix (i.e. for the oacs-5-8 branch), but a function extension, that should be probably tipped, and should go into head. Most probably the best way for such a feature integration is to
- create a new function returning potentially a list of package_ids,
- mark the existing function as deprecated
- use the plural version in the packages where the old one was used so far and add some sane semantics for multiple results.

Thanks for your quick reply. May we should not invest too much time, because my scenario is quite specific. I call the function "calendar::item::edit" from my own package (outside the calender package) to edit existing appointments in the personal calendar. Additionally to that, my package instance is mounted on three different site nodes. Altogether results in the described error.

Calling stack:

  => calendar::do_notifications
      => calendar::item::get
        => calendar::attachments_enabled_p
            => site_node_apm_integration::child_package_exists_p
              => site_node_apm_integration::get_child_package_id (subquery will fail, db_transaction in calendar::item::edit will rollback)

An ugly hack would be to call "ad_conn -set package_id" with a different package_id prior call of calendar::item::edit. That would work, but I tried to avoid that.

Many thanks