Forum OpenACS Development: Re: Missing package_ids in acs_objects: get via context_id ?

That will fail, I think, if you reach an object with context_id null, as happens when permissions inheritance is turned off for an object.

So you probably want to guard against that ...

I stumbled upon both of the problems, that is why we have the check against the object_type in the code as well as the check if object_id is "null". As we set the object_id to the context_id, if context_id is null it will not further execute.

Either way, it is, as Gustaf pointed out, only a migration issue and maybe someone finds this helpful once they stumble upon the same problem.

If they are content items you can also check up the content item hierarchy for a package_id. Ie: check parent_id, until you get to the root. You can also check if the parent_id is a folder and if cr_folders.package_id is set.