Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Correct way of detecting application package in third party package
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  3 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
askel  
View profile  
 More options Sep 18 2012, 9:57 am
From: askel <homo.programme...@gmail.com>
Date: Tue, 18 Sep 2012 06:57:16 -0700 (PDT)
Local: Tues, Sep 18 2012 9:57 am
Subject: Correct way of detecting application package in third party package
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 must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Chris McDonough  
View profile  
 More options Sep 18 2012, 12:21 pm
From: Chris McDonough <chr...@plope.com>
Date: Tue, 18 Sep 2012 12:21:35 -0400
Local: Tues, Sep 18 2012 12:21 pm
Subject: Re: Correct way of detecting application package in third party package

You probably want to use
http://docs.pylonsproject.org/projects/pyramid/en/1.4-branch/api/conf...

- C


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
askel  
View profile  
 More options Sep 18 2012, 2:09 pm
From: askel <homo.programme...@gmail.com>
Date: Tue, 18 Sep 2012 11:09:00 -0700 (PDT)
Subject: Re: Correct way of detecting application package in third party package

Hi Chris,

Thanks for your reply. The question is not how to convert relative asset
spec to absolute one but how to get package_name attribute of the topmost
configurator given configurator passed to includeme(config) of third party
library.

- Alex K


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »