On Thu, May 21, 2009 at 7:45 AM, durumdara <[email protected]> wrote:
> If possible, I wanna get informations from the Pylons. Do you know
> about a property, function, etc. that can provide me the Pylons
> directory info?

If you're looking for the standard location of controllers, templates,
etc, they're in the pylons.config object.

$ paster shell development.ini
>>> import pprint
>>> pprint.pprint(sorted(config.keys()))
['__file__',
 'app_conf',
 'beaker.cache.data_dir',
 'beaker.session.data_dir',
 'beaker.session.key',
 'beaker.session.secret',
 'buffet.template_engines',
 'buffet.template_options',
 'cache.dir',
 'debug',
 'error_email_from',
 'global_conf',
 'here',
 'package',
 'pylons.app_globals',
 'pylons.c_attach_args',
 'pylons.cache_dir',
 'pylons.db_engines',
 'pylons.environ_config',
 'pylons.errorware',
 'pylons.g',
 'pylons.h',
 'pylons.package',
 'pylons.paths',
 'pylons.request_options',
 'pylons.response_options',
 'pylons.strict_c',
 'routes.map',
 'smtp_server',
 'sqlalchemy.url']
>>> pprint.pprint(config["pylons.paths"])
{'controllers': '/home/sluggo/exp/tmpapp/tmpapp/controllers',
 'root': '/home/sluggo/exp/tmpapp/tmpapp',
 'static_files': '/home/sluggo/exp/tmpapp/tmpapp/public',
 'templates': ['/home/sluggo/exp/tmpapp/tmpapp/templates']}

You can use the definitions in myapp/config/environment.py to help
guess where a certain piece of information is located.  The keys are a
merger of those defined there, those in the [app:main] section of the
INI file, those in the [DEFAULT] section of the INI file, and the
special values '__file__' and 'here' defined by PasteDeploy.
('__file__' the path to the INI file; 'here' is its directory.)

-- 
Mike Orr <[email protected]>

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to