Package turbofeeds :: Module util
[hide private]

Module util

source code

TurboFeed utility functions.
Functions [hide private]
 
get_server_name()
Return name of the server this application runs on.
source code
 
absolute_url(tgpath='/', params=None, **kw)
Return absolute URL (including schema and host to this server).
 
xml_stylesheet(href, type='text/css', engine='text')
Returns an xml-stylesheet processing instruction element for given URL.
source code
Variables [hide private]
  GenshiPI = 'PI'
Function Details [hide private]

absolute_url(tgpath='/', params=None, **kw)

 
Return absolute URL (including schema and host to this server).

Tries to account for 'Host' header and reverse proxying
('X-Forwarded-Host').

The host name is determined this way:

* If the config setting 'tg.url_domain' is set and non-null, use this value.
* Else, if the 'base_url_filter.use_x_forwarded_host' config setting is
  True, use the value from the 'Host' or 'X-Forwarded-Host' request header.
* Else, if config setting 'base_url_filter.on' is True and
  'base_url_filter.base_url' is non-null, use its value for the host AND
  scheme part of the URL.
* As a last fallback, use the value of 'server.socket_host' and
  'server.socket_port' config settings (defaults to 'localhost:8080').

The URL scheme ('http' or 'http') used is determined in the following way:

* If 'base_url_filter.base_url' is used, use the scheme from this URL.
* If there is a 'X-Use-SSL' request header, use 'https'.
* Else, if the config setting 'tg.url_scheme' is set, use its value.
* Else, use the value of 'cherrypy.request.scheme'.

xml_stylesheet(href, type='text/css', engine='text')

source code 

Returns an xml-stylesheet processing instruction element for given URL.

href can be a string with the URL to the stylesheet or a dict with members href and type (see below) or a callable returning either.

type specifies the value of the "type" atribute of the PI. The default type is 'text/css'.

engine specifies the template engine used. Can be one of "kid", "genshi", or "text". Defaults to "text".