On Thu, Jan 06, 2011 at 11:26:55PM -0800, pan pan wrote:
> I need to send out information of port and ssl information through
> pylons controller.

Why?  To generate a fully-qualified URL?  Use something like

  url('/', _qualified=True)

> These information can easily be found in
> [server:main] section in the config file. However, it seems that by
> default a pylons controller can only access [app:main] section. Is
> there any way that I can get around it?

There's good reason why you can't easily access it.  What if I start
your application using a different server section with

  paster serve your.ini --server-name=somethingelse

?  What if I use some other WSGI server -- say, Apache + mod_wsgi --
instead of paste and therefore configure the port/ssl elsewhere?

If, despite all those warnings, you still want access to the
[server:main] section, you can do that by parsing the config file again.
The filename is in config[__file__].  There are also some tricks that
Paste does with a custom ConfigParser subclass to support nicer
interpolation; hopefully you won't need that.

Marius Gedminas
-- 
Voodoo Programming:  Things programmers do that they know shouldn't work but
they try anyway, and which sometimes actually work, such as recompiling
everything.
-- Karl Lehenbauer

Attachment: signature.asc
Description: Digital signature

Reply via email to