Hi Alex,
I noticed this, and was a bit confused at first, because I had inspected
config.package in a different function where config was passed in. So I
ended up not using the "includeme" mechanism, which is not a big deal,
because I'm only using imperative configuration anyway.
best
robert


On Tue, Jul 23, 2013 at 4:44 PM, askel <[email protected]> wrote:

> Robert,
>
> Package and package_name of configurator passed to includeme reference
> includeme's package and not the application package.
>
> - Alex K
>
>
> On Tuesday, July 23, 2013 4:30:53 AM UTC-4, Robert Forkel wrote:
>>
>> Hi all,
>> I just came across the same problem as OP: How do I determine the
>> "application" package from an includeme function. I found the two
>> attributes "package" and "package_name" of the Configurator object and
>> think this is what I want. But since these are not documented as public
>> API, is it safe to access them? Or may this change with any new pyramid
>> version?
>> best
>> robert
>>
>> On Tuesday, September 18, 2012 3:57:21 PM UTC+2, 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?
>>>
>>> - Alex K
>>>
>>  --
> You received this message because you are subscribed to the Google Groups
> "pylons-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/pylons-discuss.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/pylons-discuss.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to