Access to Rhodecode config from a Hg Python hook

Issue #558 resolved
Vincent Caron created an issue

I'm currently writing a Hg python hook to drive Redmine tickets.

I discovered that some context is passed from RhodeCode to the Hg server via ui.config('rhodecode_extras....') dict, and the 'username' from the auth context was exactly what I needed. But I'm missing access to Rhodecode's config() where I need to fetch a few custom configuration params.

A plain 'from pylons import config' does not work, I get an empty one.

Maybe it's not a good or safe idea to pass the whole app config up to the hook, in this case woud it be possible to at least copy a well-known section from the app config to Hg's ui.config ?

Thanks for your help and your great application ! It's fun to hack on it.

Comments (3)

  1. Vincent Caron reporter

    That definitively helps, thanks.

    I think I need only some part of your trick, but for the simplehg middleware : I only need to pass on the config filename down to the hook 'extras' params. From there I don't need to rebootstrap Pylons, only to reparse the config file and I'd be happy.

    I have a working 2-lines patches for this, I'm about to push this on my Rhodecode fork.

  2. Log in to comment