On Tue, 2012-09-18 at 06:57 -0700, askel wrote:
> I'm developing renderer library for Pyramid framework. It's just kind
> of adapter to use existing template engine in Pyramid applications.
> The library is using asset specs for template names. And I'd like it
> to use application package name in case asset spec is missing package
> part. Originally, I used caller_package
>
> from pyramid.path import caller_package, AssetResolver
>
> def includeme(config):
> package = caller_package(3)
> resolver = AssetResolver(package)
>
> While that worked for "imperative" configuration method (by calling
> config.include('my.library.package')), it did not work for
> "declarative" one (via pyramid.includes in INI file).
>
> I changed it to the following:
>
> def includeme(config):
> package = config.registry.__name__
> resolver = AssetResolver(package)
>
> And this way it works for both configuration methods. But I'm afraid
> that I'm using undocumented implementation details and that could stop
> working in the future.
>
> Is there any "official" way to determine application package name?
You probably want to use
http://docs.pylonsproject.org/projects/pyramid/en/1.4-branch/api/config.html#pyramid.config.Configurator.absolute_asset_spec
- C
--
You received this message because you are subscribed to the Google Groups
"pylons-discuss" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/pylons-discuss?hl=en.