Here are the examples of the python api request.environ taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
1 Examples
0
Example 1
Project: picoblog Source File: blog.py
def render_articles(self,
articles,
request,
recent,
template_name='show-articles.html'):
"""
Render a list of articles.
:Parameters:
articles : list
list of ``Article`` objects to render
request : HttpRequest
the GAE HTTP request object
recent : list
list of recent ``Article`` objects. May be empty.
template_name : str
name of template to use
:rtype: str
:return: the rendered articles
"""
url_prefix = 'http://' + request.environ['SERVER_NAME']
port = request.environ['SERVER_PORT']
if port:
url_prefix += ':%s' % port
self.augment_articles(articles, url_prefix)
self.augment_articles(recent, url_prefix, html=False)
last_updated = datetime.datetime.now()
if articles:
last_updated = articles[0].published_when
blog_url = url_prefix
tag_path = '/' + defs.TAG_URL_PATH
tag_url = url_prefix + tag_path
date_path = '/' + defs.DATE_URL_PATH
date_url = url_prefix + date_path
media_path = '/' + defs.MEDIA_URL_PATH
media_url = url_prefix + media_path
template_variables = {'blog_name' : defs.BLOG_NAME,
'blog_owner' : defs.BLOG_OWNER,
'articles' : articles,
'tag_list' : self.get_tag_counts(),
'date_list' : self.get_month_counts(),
'version' : '0.3',
'last_updated' : last_updated,
'blog_path' : '/',
'blog_url' : blog_url,
'archive_path' : '/' + defs.ARCHIVE_URL_PATH,
'tag_path' : tag_path,
'tag_url' : tag_url,
'date_path' : date_path,
'date_url' : date_url,
'rss2_path' : '/' + defs.RSS2_URL_PATH,
'recent' : recent}
return self.render_template(template_name, template_variables)