Forum OpenACS Q&A: Response to Problems with Enhanced-News package

Collapse
Posted by Esti Alvarez on
Yes, this backslash works. The backslash didn't appear in your posting. For those who are wondering where it is:

proc_doc db_with_3x_wrapper { code } {
    executes $code in uplevel, after allocating a db handle named $db
} {
    uplevel "
        db_release_unused_handles
        set db [ns_db gethandle]
        $code
        ns_db releasehandle $db
    "
}

I'm still trying to make it work on if statements inside some procedures. For example:

proc news_is_admin_p { user_id news_group_id} {
    db_with_3x_wrapper {
      if [ad_administrator_p $db $user_id] {
        return 1
      }
    }

    ...
}

leaves the handle open since the return goes before the releasehandle.

To your question of what I meant when I said I tried with different polls, I mean that instead of set db [ns_db gethandle] y tried set db [ns_db gethandle subquery] or even new one I set up in nsd.tcl. That's what you meant yesterday when you said I should allocate my handles in another pool, isn't it?