Mercurial > kallithea
annotate pylons_app/lib/utils.py @ 110:ad2500720b02
added images updated htl added tags,branches display
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Mon, 26 Apr 2010 22:32:27 +0200 |
parents | f24b9a2934cf |
children | cc5cf1a93902 |
rev | line source |
---|---|
82
670713507d03
Moved summary to seperate controller,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff
changeset
|
1 |
670713507d03
Moved summary to seperate controller,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff
changeset
|
2 def get_repo_slug(request): |
670713507d03
Moved summary to seperate controller,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff
changeset
|
3 path_info = request.environ.get('PATH_INFO') |
96
f24b9a2934cf
added is mercurial method in utils,
Marcin Kuzminski <marcin@python-works.com>
parents:
93
diff
changeset
|
4 uri_lst = path_info.split('/') |
93
aec4c0071cb3
added empty controllers for branches tags files graph, routing and test for them
Marcin Kuzminski <marcin@python-works.com>
parents:
82
diff
changeset
|
5 repo_name = uri_lst[1] |
82
670713507d03
Moved summary to seperate controller,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff
changeset
|
6 return repo_name |
96
f24b9a2934cf
added is mercurial method in utils,
Marcin Kuzminski <marcin@python-works.com>
parents:
93
diff
changeset
|
7 |
f24b9a2934cf
added is mercurial method in utils,
Marcin Kuzminski <marcin@python-works.com>
parents:
93
diff
changeset
|
8 def is_mercurial(environ): |
f24b9a2934cf
added is mercurial method in utils,
Marcin Kuzminski <marcin@python-works.com>
parents:
93
diff
changeset
|
9 """ |
f24b9a2934cf
added is mercurial method in utils,
Marcin Kuzminski <marcin@python-works.com>
parents:
93
diff
changeset
|
10 Returns True if request's target is mercurial server - header |
f24b9a2934cf
added is mercurial method in utils,
Marcin Kuzminski <marcin@python-works.com>
parents:
93
diff
changeset
|
11 ``HTTP_ACCEPT`` of such request would start with ``application/mercurial``. |
f24b9a2934cf
added is mercurial method in utils,
Marcin Kuzminski <marcin@python-works.com>
parents:
93
diff
changeset
|
12 """ |
f24b9a2934cf
added is mercurial method in utils,
Marcin Kuzminski <marcin@python-works.com>
parents:
93
diff
changeset
|
13 http_accept = environ.get('HTTP_ACCEPT') |
f24b9a2934cf
added is mercurial method in utils,
Marcin Kuzminski <marcin@python-works.com>
parents:
93
diff
changeset
|
14 if http_accept and http_accept.startswith('application/mercurial'): |
f24b9a2934cf
added is mercurial method in utils,
Marcin Kuzminski <marcin@python-works.com>
parents:
93
diff
changeset
|
15 return True |
f24b9a2934cf
added is mercurial method in utils,
Marcin Kuzminski <marcin@python-works.com>
parents:
93
diff
changeset
|
16 return False |