Show More
@@ -1,9 +1,10 b'' | |||||
1 | # -*- coding: utf-8 -*- |
|
1 | # -*- coding: utf-8 -*- | |
2 | """ |
|
2 | """ | |
3 |
|
|
3 | rhodecode.controllers.admin.ldap_settings | |
4 | ~~~~~~~~~~~~~~ |
|
4 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
5 |
|
5 | |||
6 | ldap controller for RhodeCode |
|
6 | ldap controller for RhodeCode | |
|
7 | ||||
7 | :created_on: Nov 26, 2010 |
|
8 | :created_on: Nov 26, 2010 | |
8 | :author: marcink |
|
9 | :author: marcink | |
9 | :copyright: (C) 2009-2010 Marcin Kuzminski <marcin@python-works.com> |
|
10 | :copyright: (C) 2009-2010 Marcin Kuzminski <marcin@python-works.com> |
@@ -1,8 +1,15 b'' | |||||
1 | #!/usr/bin/env python |
|
1 | # -*- coding: utf-8 -*- | |
2 | # encoding: utf-8 |
|
2 | """ | |
3 | # branches controller for pylons |
|
3 | rhodecode.controllers.branches | |
4 | # Copyright (C) 2009-2010 Marcin Kuzminski <marcin@python-works.com> |
|
4 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
5 | # |
|
5 | ||
|
6 | branches controller for rhodecode | |||
|
7 | ||||
|
8 | :created_on: Apr 21, 2010 | |||
|
9 | :author: marcink | |||
|
10 | :copyright: (C) 2009-2010 Marcin Kuzminski <marcin@python-works.com> | |||
|
11 | :license: GPLv3, see COPYING for more details. | |||
|
12 | """ | |||
6 | # This program is free software; you can redistribute it and/or |
|
13 | # This program is free software; you can redistribute it and/or | |
7 | # modify it under the terms of the GNU General Public License |
|
14 | # modify it under the terms of the GNU General Public License | |
8 | # as published by the Free Software Foundation; version 2 |
|
15 | # as published by the Free Software Foundation; version 2 | |
@@ -17,31 +24,31 b'' | |||||
17 | # along with this program; if not, write to the Free Software |
|
24 | # along with this program; if not, write to the Free Software | |
18 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
25 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, | |
19 | # MA 02110-1301, USA. |
|
26 | # MA 02110-1301, USA. | |
20 | """ |
|
27 | ||
21 | Created on April 21, 2010 |
|
28 | import logging | |
22 | branches controller for pylons |
|
29 | ||
23 | @author: marcink |
|
|||
24 | """ |
|
|||
25 | from pylons import tmpl_context as c |
|
30 | from pylons import tmpl_context as c | |
|
31 | ||||
26 | from rhodecode.lib.auth import LoginRequired, HasRepoPermissionAnyDecorator |
|
32 | from rhodecode.lib.auth import LoginRequired, HasRepoPermissionAnyDecorator | |
27 | from rhodecode.lib.base import BaseController, render |
|
33 | from rhodecode.lib.base import BaseController, render | |
28 | from rhodecode.lib.utils import OrderedDict |
|
34 | from rhodecode.lib.utils import OrderedDict | |
29 | from rhodecode.model.scm import ScmModel |
|
35 | from rhodecode.model.scm import ScmModel | |
30 | import logging |
|
36 | ||
31 | log = logging.getLogger(__name__) |
|
37 | log = logging.getLogger(__name__) | |
32 |
|
38 | |||
33 | class BranchesController(BaseController): |
|
39 | class BranchesController(BaseController): | |
34 |
|
40 | |||
35 | @LoginRequired() |
|
41 | @LoginRequired() | |
36 |
@HasRepoPermissionAnyDecorator('repository.read', 'repository.write', |
|
42 | @HasRepoPermissionAnyDecorator('repository.read', 'repository.write', | |
|
43 | 'repository.admin') | |||
37 | def __before__(self): |
|
44 | def __before__(self): | |
38 | super(BranchesController, self).__before__() |
|
45 | super(BranchesController, self).__before__() | |
39 |
|
46 | |||
40 | def index(self): |
|
47 | def index(self): | |
41 | hg_model = ScmModel() |
|
48 | hg_model = ScmModel() | |
42 | c.repo_info = hg_model.get_repo(c.repo_name) |
|
49 | c.repo_info = hg_model.get_repo(c.repo_name) | |
43 | c.repo_branches = OrderedDict() |
|
50 | c.repo_branches = OrderedDict() | |
44 | for name, hash_ in c.repo_info.branches.items(): |
|
51 | for name, hash_ in c.repo_info.branches.items(): | |
45 | c.repo_branches[name] = c.repo_info.get_changeset(hash_) |
|
52 | c.repo_branches[name] = c.repo_info.get_changeset(hash_) | |
46 |
|
53 | |||
47 | return render('branches/branches.html') |
|
54 | return render('branches/branches.html') |
@@ -1,8 +1,15 b'' | |||||
1 | #!/usr/bin/env python |
|
1 | # -*- coding: utf-8 -*- | |
2 | # encoding: utf-8 |
|
2 | """ | |
3 | # changelog controller for pylons |
|
3 | rhodecode.controllers.changelog | |
4 | # Copyright (C) 2009-2010 Marcin Kuzminski <marcin@python-works.com> |
|
4 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
5 | # |
|
5 | ||
|
6 | changelog controller for rhodecode | |||
|
7 | ||||
|
8 | :created_on: Apr 21, 2010 | |||
|
9 | :author: marcink | |||
|
10 | :copyright: (C) 2009-2010 Marcin Kuzminski <marcin@python-works.com> | |||
|
11 | :license: GPLv3, see COPYING for more details. | |||
|
12 | """ | |||
6 | # This program is free software; you can redistribute it and/or |
|
13 | # This program is free software; you can redistribute it and/or | |
7 | # modify it under the terms of the GNU General Public License |
|
14 | # modify it under the terms of the GNU General Public License | |
8 | # as published by the Free Software Foundation; version 2 |
|
15 | # as published by the Free Software Foundation; version 2 | |
@@ -17,24 +24,24 b'' | |||||
17 | # along with this program; if not, write to the Free Software |
|
24 | # along with this program; if not, write to the Free Software | |
18 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
25 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, | |
19 | # MA 02110-1301, USA. |
|
26 | # MA 02110-1301, USA. | |
20 | """ |
|
27 | ||
21 | Created on April 21, 2010 |
|
28 | import logging | |
22 | changelog controller for pylons |
|
|||
23 | @author: marcink |
|
|||
24 | """ |
|
|||
25 |
|
29 | |||
26 | try: |
|
30 | try: | |
27 | import json |
|
31 | import json | |
28 | except ImportError: |
|
32 | except ImportError: | |
29 | #python 2.5 compatibility |
|
33 | #python 2.5 compatibility | |
30 | import simplejson as json |
|
34 | import simplejson as json | |
|
35 | ||||
31 | from mercurial.graphmod import colored, CHANGESET, revisions as graph_rev |
|
36 | from mercurial.graphmod import colored, CHANGESET, revisions as graph_rev | |
32 | from pylons import request, session, tmpl_context as c |
|
37 | from pylons import request, session, tmpl_context as c | |
|
38 | ||||
33 | from rhodecode.lib.auth import LoginRequired, HasRepoPermissionAnyDecorator |
|
39 | from rhodecode.lib.auth import LoginRequired, HasRepoPermissionAnyDecorator | |
34 | from rhodecode.lib.base import BaseController, render |
|
40 | from rhodecode.lib.base import BaseController, render | |
35 | from rhodecode.model.scm import ScmModel |
|
41 | from rhodecode.model.scm import ScmModel | |
|
42 | ||||
36 | from webhelpers.paginate import Page |
|
43 | from webhelpers.paginate import Page | |
37 | import logging |
|
44 | ||
38 | log = logging.getLogger(__name__) |
|
45 | log = logging.getLogger(__name__) | |
39 |
|
46 | |||
40 | class ChangelogController(BaseController): |
|
47 | class ChangelogController(BaseController): |
@@ -1,8 +1,15 b'' | |||||
1 | #!/usr/bin/env python |
|
1 | # -*- coding: utf-8 -*- | |
2 | # encoding: utf-8 |
|
2 | """ | |
3 | # feed controller for pylons |
|
3 | rhodecode.controllers.feed | |
4 | # Copyright (C) 2009-2010 Marcin Kuzminski <marcin@python-works.com> |
|
4 | ~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
5 |
|
5 | |||
|
6 | Feed controller for rhodecode | |||
|
7 | ||||
|
8 | :created_on: Apr 23, 2010 | |||
|
9 | :author: marcink | |||
|
10 | :copyright: (C) 2009-2010 Marcin Kuzminski <marcin@python-works.com> | |||
|
11 | :license: GPLv3, see COPYING for more details. | |||
|
12 | """ | |||
6 | # This program is free software; you can redistribute it and/or |
|
13 | # This program is free software; you can redistribute it and/or | |
7 | # modify it under the terms of the GNU General Public License |
|
14 | # modify it under the terms of the GNU General Public License | |
8 | # as published by the Free Software Foundation; version 2 |
|
15 | # as published by the Free Software Foundation; version 2 | |
@@ -17,20 +24,19 b'' | |||||
17 | # along with this program; if not, write to the Free Software |
|
24 | # along with this program; if not, write to the Free Software | |
18 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
25 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, | |
19 | # MA 02110-1301, USA. |
|
26 | # MA 02110-1301, USA. | |
20 | """ |
|
27 | ||
21 | Created on April 23, 2010 |
|
28 | ||
22 | feed controller for pylons |
|
29 | import logging | |
23 | @author: marcink |
|
30 | ||
24 | """ |
|
31 | from pylons import url, response | |
25 | from pylons import tmpl_context as c, url, response |
|
32 | from rhodecode.lib.base import BaseController | |
26 | from rhodecode.lib.base import BaseController, render |
|
|||
27 | from rhodecode.model.scm import ScmModel |
|
33 | from rhodecode.model.scm import ScmModel | |
28 | from webhelpers.feedgenerator import Atom1Feed, Rss201rev2Feed |
|
34 | from webhelpers.feedgenerator import Atom1Feed, Rss201rev2Feed | |
29 | import logging |
|
35 | ||
30 | log = logging.getLogger(__name__) |
|
36 | log = logging.getLogger(__name__) | |
31 |
|
37 | |||
32 | class FeedController(BaseController): |
|
38 | class FeedController(BaseController): | |
33 |
|
39 | |||
34 | #secure it or not ? |
|
40 | #secure it or not ? | |
35 | def __before__(self): |
|
41 | def __before__(self): | |
36 | super(FeedController, self).__before__() |
|
42 | super(FeedController, self).__before__() | |
@@ -48,7 +54,7 b' class FeedController(BaseController):' | |||||
48 | description=self.description % repo_name, |
|
54 | description=self.description % repo_name, | |
49 | language=self.language, |
|
55 | language=self.language, | |
50 | ttl=self.ttl) |
|
56 | ttl=self.ttl) | |
51 |
|
57 | |||
52 | changesets = ScmModel().get_repo(repo_name) |
|
58 | changesets = ScmModel().get_repo(repo_name) | |
53 |
|
59 | |||
54 | for cs in changesets[:self.feed_nr]: |
|
60 | for cs in changesets[:self.feed_nr]: | |
@@ -56,11 +62,11 b' class FeedController(BaseController):' | |||||
56 | link=url('changeset_home', repo_name=repo_name, |
|
62 | link=url('changeset_home', repo_name=repo_name, | |
57 | revision=cs.raw_id, qualified=True), |
|
63 | revision=cs.raw_id, qualified=True), | |
58 | description=str(cs.date)) |
|
64 | description=str(cs.date)) | |
59 |
|
65 | |||
60 | response.content_type = feed.mime_type |
|
66 | response.content_type = feed.mime_type | |
61 | return feed.writeString('utf-8') |
|
67 | return feed.writeString('utf-8') | |
62 |
|
68 | |||
63 |
|
69 | |||
64 | def rss(self, repo_name): |
|
70 | def rss(self, repo_name): | |
65 | """Produce an rss2 feed via feedgenerator module""" |
|
71 | """Produce an rss2 feed via feedgenerator module""" | |
66 | feed = Rss201rev2Feed(title=self.title % repo_name, |
|
72 | feed = Rss201rev2Feed(title=self.title % repo_name, | |
@@ -68,13 +74,13 b' class FeedController(BaseController):' | |||||
68 | description=self.description % repo_name, |
|
74 | description=self.description % repo_name, | |
69 | language=self.language, |
|
75 | language=self.language, | |
70 | ttl=self.ttl) |
|
76 | ttl=self.ttl) | |
71 |
|
77 | |||
72 | changesets = ScmModel().get_repo(repo_name) |
|
78 | changesets = ScmModel().get_repo(repo_name) | |
73 | for cs in changesets[:self.feed_nr]: |
|
79 | for cs in changesets[:self.feed_nr]: | |
74 | feed.add_item(title=cs.message, |
|
80 | feed.add_item(title=cs.message, | |
75 | link=url('changeset_home', repo_name=repo_name, |
|
81 | link=url('changeset_home', repo_name=repo_name, | |
76 | revision=cs.raw_id, qualified=True), |
|
82 | revision=cs.raw_id, qualified=True), | |
77 | description=str(cs.date)) |
|
83 | description=str(cs.date)) | |
78 |
|
84 | |||
79 | response.content_type = feed.mime_type |
|
85 | response.content_type = feed.mime_type | |
80 | return feed.writeString('utf-8') |
|
86 | return feed.writeString('utf-8') |
@@ -1,8 +1,15 b'' | |||||
1 | #!/usr/bin/env python |
|
1 | # -*- coding: utf-8 -*- | |
2 | # encoding: utf-8 |
|
2 | """ | |
3 | # hg controller for pylons |
|
3 | rhodecode.controllers.home | |
4 | # Copyright (C) 2009-2010 Marcin Kuzminski <marcin@python-works.com> |
|
4 | ~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
5 | # |
|
5 | ||
|
6 | Home controller for Rhodecode | |||
|
7 | ||||
|
8 | :created_on: Feb 18, 2010 | |||
|
9 | :author: marcink | |||
|
10 | :copyright: (C) 2009-2010 Marcin Kuzminski <marcin@python-works.com> | |||
|
11 | :license: GPLv3, see COPYING for more details. | |||
|
12 | """ | |||
6 | # This program is free software; you can redistribute it and/or |
|
13 | # This program is free software; you can redistribute it and/or | |
7 | # modify it under the terms of the GNU General Public License |
|
14 | # modify it under the terms of the GNU General Public License | |
8 | # as published by the Free Software Foundation; version 2 |
|
15 | # as published by the Free Software Foundation; version 2 | |
@@ -17,17 +24,16 b'' | |||||
17 | # along with this program; if not, write to the Free Software |
|
24 | # along with this program; if not, write to the Free Software | |
18 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
25 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, | |
19 | # MA 02110-1301, USA. |
|
26 | # MA 02110-1301, USA. | |
20 | """ |
|
27 | ||
21 | Created on February 18, 2010 |
|
28 | import logging | |
22 | hg controller for pylons |
|
|||
23 | @author: marcink |
|
|||
24 | """ |
|
|||
25 | from operator import itemgetter |
|
29 | from operator import itemgetter | |
|
30 | ||||
26 | from pylons import tmpl_context as c, request |
|
31 | from pylons import tmpl_context as c, request | |
|
32 | ||||
27 | from rhodecode.lib.auth import LoginRequired |
|
33 | from rhodecode.lib.auth import LoginRequired | |
28 | from rhodecode.lib.base import BaseController, render |
|
34 | from rhodecode.lib.base import BaseController, render | |
29 | from rhodecode.model.scm import ScmModel |
|
35 | from rhodecode.model.scm import ScmModel | |
30 | import logging |
|
36 | ||
31 | log = logging.getLogger(__name__) |
|
37 | log = logging.getLogger(__name__) | |
32 |
|
38 | |||
33 | class HomeController(BaseController): |
|
39 | class HomeController(BaseController): | |
@@ -51,8 +57,10 b' class HomeController(BaseController):' | |||||
51 |
|
57 | |||
52 | sort_key = current_sort_slug + '_sort' |
|
58 | sort_key = current_sort_slug + '_sort' | |
53 | if c.sort_by.startswith('-'): |
|
59 | if c.sort_by.startswith('-'): | |
54 |
c.repos_list = sorted(cached_repo_list, key=itemgetter(sort_key), |
|
60 | c.repos_list = sorted(cached_repo_list, key=itemgetter(sort_key), | |
|
61 | reverse=True) | |||
55 | else: |
|
62 | else: | |
56 |
c.repos_list = sorted(cached_repo_list, key=itemgetter(sort_key), |
|
63 | c.repos_list = sorted(cached_repo_list, key=itemgetter(sort_key), | |
|
64 | reverse=False) | |||
57 |
|
65 | |||
58 | return render('/index.html') |
|
66 | return render('/index.html') |
@@ -1,8 +1,15 b'' | |||||
1 | #!/usr/bin/env python |
|
1 | # -*- coding: utf-8 -*- | |
2 | # encoding: utf-8 |
|
2 | """ | |
3 | # journal controller for pylons |
|
3 | rhodecode.controllers.journal | |
4 | # Copyright (C) 2009-2010 Marcin Kuzminski <marcin@python-works.com> |
|
4 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
5 | # |
|
5 | ||
|
6 | Journal controller for pylons | |||
|
7 | ||||
|
8 | :created_on: Nov 21, 2010 | |||
|
9 | :author: marcink | |||
|
10 | :copyright: (C) 2009-2010 Marcin Kuzminski <marcin@python-works.com> | |||
|
11 | :license: GPLv3, see COPYING for more details. | |||
|
12 | """ | |||
6 | # This program is free software; you can redistribute it and/or |
|
13 | # This program is free software; you can redistribute it and/or | |
7 | # modify it under the terms of the GNU General Public License |
|
14 | # modify it under the terms of the GNU General Public License | |
8 | # as published by the Free Software Foundation; version 2 |
|
15 | # as published by the Free Software Foundation; version 2 | |
@@ -17,22 +24,19 b'' | |||||
17 | # along with this program; if not, write to the Free Software |
|
24 | # along with this program; if not, write to the Free Software | |
18 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
25 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, | |
19 | # MA 02110-1301, USA. |
|
26 | # MA 02110-1301, USA. | |
20 | """ |
|
27 | ||
21 | Created on November 21, 2010 |
|
28 | import logging | |
22 | journal controller for pylons |
|
29 | from sqlalchemy import or_ | |
23 | @author: marcink |
|
|||
24 | """ |
|
|||
25 |
|
30 | |||
26 | from pylons import request, response, session, tmpl_context as c, url |
|
31 | from pylons import request, response, session, tmpl_context as c, url | |
27 | from pylons.controllers.util import abort, redirect |
|
32 | ||
28 | from rhodecode.lib.auth import LoginRequired, NotAnonymous |
|
33 | from rhodecode.lib.auth import LoginRequired, NotAnonymous | |
29 | from rhodecode.lib.base import BaseController, render |
|
34 | from rhodecode.lib.base import BaseController, render | |
30 | from rhodecode.lib.helpers import get_token |
|
35 | from rhodecode.lib.helpers import get_token | |
31 | from rhodecode.model.db import UserLog, UserFollowing |
|
36 | from rhodecode.model.db import UserLog, UserFollowing | |
32 | from rhodecode.model.scm import ScmModel |
|
37 | from rhodecode.model.scm import ScmModel | |
33 | from sqlalchemy import or_ |
|
38 | ||
34 | import logging |
|
39 | from paste.httpexceptions import HTTPInternalServerError | |
35 | from paste.httpexceptions import HTTPInternalServerError, HTTPNotFound |
|
|||
36 |
|
40 | |||
37 | log = logging.getLogger(__name__) |
|
41 | log = logging.getLogger(__name__) | |
38 |
|
42 |
@@ -1,8 +1,15 b'' | |||||
1 | #!/usr/bin/env python |
|
1 | # -*- coding: utf-8 -*- | |
2 | # encoding: utf-8 |
|
2 | """ | |
3 | # login controller for pylons |
|
3 | rhodecode.controllers.login | |
4 | # Copyright (C) 2009-2010 Marcin Kuzminski <marcin@python-works.com> |
|
4 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
5 | # |
|
5 | ||
|
6 | Login controller for rhodeocode | |||
|
7 | ||||
|
8 | :created_on: Apr 22, 2010 | |||
|
9 | :author: marcink | |||
|
10 | :copyright: (C) 2009-2010 Marcin Kuzminski <marcin@python-works.com> | |||
|
11 | :license: GPLv3, see COPYING for more details. | |||
|
12 | """ | |||
6 | # This program is free software; you can redistribute it and/or |
|
13 | # This program is free software; you can redistribute it and/or | |
7 | # modify it under the terms of the GNU General Public License |
|
14 | # modify it under the terms of the GNU General Public License | |
8 | # as published by the Free Software Foundation; version 2 |
|
15 | # as published by the Free Software Foundation; version 2 | |
@@ -18,22 +25,21 b'' | |||||
18 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
25 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, | |
19 | # MA 02110-1301, USA. |
|
26 | # MA 02110-1301, USA. | |
20 |
|
27 | |||
21 | """ |
|
28 | import logging | |
22 | Created on April 22, 2010 |
|
29 | import formencode | |
23 | login controller for pylons |
|
30 | ||
24 | @author: marcink |
|
|||
25 | """ |
|
|||
26 | from formencode import htmlfill |
|
31 | from formencode import htmlfill | |
|
32 | ||||
|
33 | from pylons.i18n.translation import _ | |||
|
34 | from pylons.controllers.util import abort, redirect | |||
27 | from pylons import request, response, session, tmpl_context as c, url |
|
35 | from pylons import request, response, session, tmpl_context as c, url | |
28 | from pylons.controllers.util import abort, redirect |
|
36 | ||
|
37 | import rhodecode.lib.helpers as h | |||
29 | from rhodecode.lib.auth import AuthUser, HasPermissionAnyDecorator |
|
38 | from rhodecode.lib.auth import AuthUser, HasPermissionAnyDecorator | |
30 | from rhodecode.lib.base import BaseController, render |
|
39 | from rhodecode.lib.base import BaseController, render | |
31 | import rhodecode.lib.helpers as h |
|
|||
32 | from pylons.i18n.translation import _ |
|
|||
33 | from rhodecode.model.forms import LoginForm, RegisterForm, PasswordResetForm |
|
40 | from rhodecode.model.forms import LoginForm, RegisterForm, PasswordResetForm | |
34 | from rhodecode.model.user import UserModel |
|
41 | from rhodecode.model.user import UserModel | |
35 | import formencode |
|
42 | ||
36 | import logging |
|
|||
37 |
|
43 | |||
38 | log = logging.getLogger(__name__) |
|
44 | log = logging.getLogger(__name__) | |
39 |
|
45 |
@@ -1,8 +1,15 b'' | |||||
1 | #!/usr/bin/env python |
|
1 | # -*- coding: utf-8 -*- | |
2 | # encoding: utf-8 |
|
2 | """ | |
3 | # search controller for pylons |
|
3 | rhodecode.controllers.search | |
4 | # Copyright (C) 2009-2010 Marcin Kuzminski <marcin@python-works.com> |
|
4 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
5 | # |
|
5 | ||
|
6 | Search controller for rhodecode | |||
|
7 | ||||
|
8 | :created_on: Aug 7, 2010 | |||
|
9 | :author: marcink | |||
|
10 | :copyright: (C) 2009-2010 Marcin Kuzminski <marcin@python-works.com> | |||
|
11 | :license: GPLv3, see COPYING for more details. | |||
|
12 | """ | |||
6 | # This program is free software; you can redistribute it and/or |
|
13 | # This program is free software; you can redistribute it and/or | |
7 | # modify it under the terms of the GNU General Public License |
|
14 | # modify it under the terms of the GNU General Public License | |
8 | # as published by the Free Software Foundation; version 2 |
|
15 | # as published by the Free Software Foundation; version 2 | |
@@ -17,24 +24,23 b'' | |||||
17 | # along with this program; if not, write to the Free Software |
|
24 | # along with this program; if not, write to the Free Software | |
18 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
25 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, | |
19 | # MA 02110-1301, USA. |
|
26 | # MA 02110-1301, USA. | |
20 | """ |
|
27 | import logging | |
21 | Created on Aug 7, 2010 |
|
28 | import traceback | |
22 | search controller for pylons |
|
29 | ||
23 | @author: marcink |
|
30 | from pylons.i18n.translation import _ | |
24 | """ |
|
|||
25 | from pylons import request, response, config, session, tmpl_context as c, url |
|
31 | from pylons import request, response, config, session, tmpl_context as c, url | |
26 | from pylons.controllers.util import abort, redirect |
|
32 | from pylons.controllers.util import abort, redirect | |
|
33 | ||||
27 | from rhodecode.lib.auth import LoginRequired |
|
34 | from rhodecode.lib.auth import LoginRequired | |
28 | from rhodecode.lib.base import BaseController, render |
|
35 | from rhodecode.lib.base import BaseController, render | |
29 | from rhodecode.lib.indexers import SCHEMA, IDX_NAME, ResultWrapper |
|
36 | from rhodecode.lib.indexers import SCHEMA, IDX_NAME, ResultWrapper | |
|
37 | ||||
30 | from webhelpers.paginate import Page |
|
38 | from webhelpers.paginate import Page | |
31 | from webhelpers.util import update_params |
|
39 | from webhelpers.util import update_params | |
32 | from pylons.i18n.translation import _ |
|
40 | ||
33 | from whoosh.index import open_dir, EmptyIndexError |
|
41 | from whoosh.index import open_dir, EmptyIndexError | |
34 | from whoosh.qparser import QueryParser, QueryParserError |
|
42 | from whoosh.qparser import QueryParser, QueryParserError | |
35 | from whoosh.query import Phrase |
|
43 | from whoosh.query import Phrase | |
36 | import logging |
|
|||
37 | import traceback |
|
|||
38 |
|
44 | |||
39 | log = logging.getLogger(__name__) |
|
45 | log = logging.getLogger(__name__) | |
40 |
|
46 | |||
@@ -107,7 +113,8 b' class SearchController(BaseController):' | |||||
107 | except (EmptyIndexError, IOError): |
|
113 | except (EmptyIndexError, IOError): | |
108 | log.error(traceback.format_exc()) |
|
114 | log.error(traceback.format_exc()) | |
109 | log.error('Empty Index data') |
|
115 | log.error('Empty Index data') | |
110 |
c.runtime = _('There is no index to search in. |
|
116 | c.runtime = _('There is no index to search in. ' | |
|
117 | 'Please run whoosh indexer') | |||
111 |
|
118 | |||
112 | # Return a rendered template |
|
119 | # Return a rendered template | |
113 | return render('/search/search.html') |
|
120 | return render('/search/search.html') |
@@ -1,8 +1,15 b'' | |||||
1 | #!/usr/bin/env python |
|
1 | # -*- coding: utf-8 -*- | |
2 | # encoding: utf-8 |
|
2 | """ | |
3 | # settings controller for pylons |
|
3 | rhodecode.controllers.settings | |
4 | # Copyright (C) 2009-2010 Marcin Kuzminski <marcin@python-works.com> |
|
4 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
5 | # |
|
5 | ||
|
6 | Settings controller for rhodecode | |||
|
7 | ||||
|
8 | :created_on: Jun 30, 2010 | |||
|
9 | :author: marcink | |||
|
10 | :copyright: (C) 2009-2010 Marcin Kuzminski <marcin@python-works.com> | |||
|
11 | :license: GPLv3, see COPYING for more details. | |||
|
12 | """ | |||
6 | # This program is free software; you can redistribute it and/or |
|
13 | # This program is free software; you can redistribute it and/or | |
7 | # modify it under the terms of the GNU General Public License |
|
14 | # modify it under the terms of the GNU General Public License | |
8 | # as published by the Free Software Foundation; version 2 |
|
15 | # as published by the Free Software Foundation; version 2 | |
@@ -17,24 +24,23 b'' | |||||
17 | # along with this program; if not, write to the Free Software |
|
24 | # along with this program; if not, write to the Free Software | |
18 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
25 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, | |
19 | # MA 02110-1301, USA. |
|
26 | # MA 02110-1301, USA. | |
20 | """ |
|
27 | ||
21 | Created on June 30, 2010 |
|
28 | import logging | |
22 | settings controller for pylons |
|
29 | import traceback | |
23 | @author: marcink |
|
30 | ||
24 | """ |
|
31 | import formencode | |
25 | from formencode import htmlfill |
|
32 | from formencode import htmlfill | |
|
33 | ||||
26 | from pylons import tmpl_context as c, request, url |
|
34 | from pylons import tmpl_context as c, request, url | |
27 | from pylons.controllers.util import redirect |
|
35 | from pylons.controllers.util import redirect | |
28 | from pylons.i18n.translation import _ |
|
36 | from pylons.i18n.translation import _ | |
|
37 | ||||
|
38 | import rhodecode.lib.helpers as h | |||
29 | from rhodecode.lib.auth import LoginRequired, HasRepoPermissionAllDecorator |
|
39 | from rhodecode.lib.auth import LoginRequired, HasRepoPermissionAllDecorator | |
30 | from rhodecode.lib.base import BaseController, render |
|
40 | from rhodecode.lib.base import BaseController, render | |
31 | from rhodecode.lib.utils import invalidate_cache, action_logger |
|
41 | from rhodecode.lib.utils import invalidate_cache, action_logger | |
32 | from rhodecode.model.forms import RepoSettingsForm, RepoForkForm |
|
42 | from rhodecode.model.forms import RepoSettingsForm, RepoForkForm | |
33 | from rhodecode.model.repo import RepoModel |
|
43 | from rhodecode.model.repo import RepoModel | |
34 | import formencode |
|
|||
35 | import logging |
|
|||
36 | import rhodecode.lib.helpers as h |
|
|||
37 | import traceback |
|
|||
38 |
|
44 | |||
39 | log = logging.getLogger(__name__) |
|
45 | log = logging.getLogger(__name__) | |
40 |
|
46 |
@@ -1,8 +1,15 b'' | |||||
1 | #!/usr/bin/env python |
|
1 | # -*- coding: utf-8 -*- | |
2 | # encoding: utf-8 |
|
2 | """ | |
3 | # shortlog controller for pylons |
|
3 | rhodecode.controllers.shortlog | |
4 | # Copyright (C) 2009-2010 Marcin Kuzminski <marcin@python-works.com> |
|
4 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
5 |
|
5 | |||
|
6 | Shortlog controller for rhodecode | |||
|
7 | ||||
|
8 | :created_on: Apr 18, 2010 | |||
|
9 | :author: marcink | |||
|
10 | :copyright: (C) 2009-2010 Marcin Kuzminski <marcin@python-works.com> | |||
|
11 | :license: GPLv3, see COPYING for more details. | |||
|
12 | """ | |||
6 | # This program is free software; you can redistribute it and/or |
|
13 | # This program is free software; you can redistribute it and/or | |
7 | # modify it under the terms of the GNU General Public License |
|
14 | # modify it under the terms of the GNU General Public License | |
8 | # as published by the Free Software Foundation; version 2 |
|
15 | # as published by the Free Software Foundation; version 2 | |
@@ -17,27 +24,27 b'' | |||||
17 | # along with this program; if not, write to the Free Software |
|
24 | # along with this program; if not, write to the Free Software | |
18 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
25 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, | |
19 | # MA 02110-1301, USA. |
|
26 | # MA 02110-1301, USA. | |
20 | """ |
|
27 | ||
21 | Created on April 18, 2010 |
|
28 | import logging | |
22 | shortlog controller for pylons |
|
29 | ||
23 | @author: marcink |
|
|||
24 | """ |
|
|||
25 | from pylons import tmpl_context as c, request |
|
30 | from pylons import tmpl_context as c, request | |
|
31 | ||||
|
32 | from webhelpers.paginate import Page | |||
|
33 | ||||
26 | from rhodecode.lib.auth import LoginRequired, HasRepoPermissionAnyDecorator |
|
34 | from rhodecode.lib.auth import LoginRequired, HasRepoPermissionAnyDecorator | |
27 | from rhodecode.lib.base import BaseController, render |
|
35 | from rhodecode.lib.base import BaseController, render | |
28 | from rhodecode.model.scm import ScmModel |
|
36 | from rhodecode.model.scm import ScmModel | |
29 | from webhelpers.paginate import Page |
|
37 | ||
30 | import logging |
|
|||
31 | log = logging.getLogger(__name__) |
|
38 | log = logging.getLogger(__name__) | |
32 |
|
39 | |||
33 | class ShortlogController(BaseController): |
|
40 | class ShortlogController(BaseController): | |
34 |
|
41 | |||
35 | @LoginRequired() |
|
42 | @LoginRequired() | |
36 | @HasRepoPermissionAnyDecorator('repository.read', 'repository.write', |
|
43 | @HasRepoPermissionAnyDecorator('repository.read', 'repository.write', | |
37 |
'repository.admin') |
|
44 | 'repository.admin') | |
38 | def __before__(self): |
|
45 | def __before__(self): | |
39 | super(ShortlogController, self).__before__() |
|
46 | super(ShortlogController, self).__before__() | |
40 |
|
47 | |||
41 | def index(self): |
|
48 | def index(self): | |
42 | p = int(request.params.get('page', 1)) |
|
49 | p = int(request.params.get('page', 1)) | |
43 | repo = ScmModel().get_repo(c.repo_name) |
|
50 | repo = ScmModel().get_repo(c.repo_name) |
@@ -1,8 +1,15 b'' | |||||
1 | #!/usr/bin/env python |
|
1 | # -*- coding: utf-8 -*- | |
2 | # encoding: utf-8 |
|
2 | """ | |
3 | # tags controller for pylons |
|
3 | rhodecode.controllers.tags | |
4 | # Copyright (C) 2009-2010 Marcin Kuzminski <marcin@python-works.com> |
|
4 | ~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
5 | # |
|
5 | ||
|
6 | Tags controller for rhodecode | |||
|
7 | ||||
|
8 | :created_on: Apr 21, 2010 | |||
|
9 | :author: marcink | |||
|
10 | :copyright: (C) 2009-2010 Marcin Kuzminski <marcin@python-works.com> | |||
|
11 | :license: GPLv3, see COPYING for more details. | |||
|
12 | """ | |||
6 | # This program is free software; you can redistribute it and/or |
|
13 | # This program is free software; you can redistribute it and/or | |
7 | # modify it under the terms of the GNU General Public License |
|
14 | # modify it under the terms of the GNU General Public License | |
8 | # as published by the Free Software Foundation; version 2 |
|
15 | # as published by the Free Software Foundation; version 2 | |
@@ -17,31 +24,30 b'' | |||||
17 | # along with this program; if not, write to the Free Software |
|
24 | # along with this program; if not, write to the Free Software | |
18 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
25 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, | |
19 | # MA 02110-1301, USA. |
|
26 | # MA 02110-1301, USA. | |
20 | """ |
|
27 | import logging | |
21 | Created on April 21, 2010 |
|
28 | ||
22 | tags controller for pylons |
|
|||
23 | @author: marcink |
|
|||
24 | """ |
|
|||
25 | from pylons import tmpl_context as c |
|
29 | from pylons import tmpl_context as c | |
|
30 | ||||
26 | from rhodecode.lib.auth import LoginRequired, HasRepoPermissionAnyDecorator |
|
31 | from rhodecode.lib.auth import LoginRequired, HasRepoPermissionAnyDecorator | |
27 | from rhodecode.lib.base import BaseController, render |
|
32 | from rhodecode.lib.base import BaseController, render | |
28 | from rhodecode.lib.utils import OrderedDict |
|
33 | from rhodecode.lib.utils import OrderedDict | |
29 | from rhodecode.model.scm import ScmModel |
|
34 | from rhodecode.model.scm import ScmModel | |
30 | import logging |
|
35 | ||
31 | log = logging.getLogger(__name__) |
|
36 | log = logging.getLogger(__name__) | |
32 |
|
37 | |||
33 | class TagsController(BaseController): |
|
38 | class TagsController(BaseController): | |
34 |
|
39 | |||
35 | @LoginRequired() |
|
40 | @LoginRequired() | |
36 |
@HasRepoPermissionAnyDecorator('repository.read', 'repository.write', |
|
41 | @HasRepoPermissionAnyDecorator('repository.read', 'repository.write', | |
|
42 | 'repository.admin') | |||
37 | def __before__(self): |
|
43 | def __before__(self): | |
38 | super(TagsController, self).__before__() |
|
44 | super(TagsController, self).__before__() | |
39 |
|
45 | |||
40 | def index(self): |
|
46 | def index(self): | |
41 | hg_model = ScmModel() |
|
47 | hg_model = ScmModel() | |
42 | c.repo_info = hg_model.get_repo(c.repo_name) |
|
48 | c.repo_info = hg_model.get_repo(c.repo_name) | |
43 | c.repo_tags = OrderedDict() |
|
49 | c.repo_tags = OrderedDict() | |
44 | for name, hash_ in c.repo_info.tags.items(): |
|
50 | for name, hash_ in c.repo_info.tags.items(): | |
45 | c.repo_tags[name] = c.repo_info.get_changeset(hash_) |
|
51 | c.repo_tags[name] = c.repo_info.get_changeset(hash_) | |
46 |
|
52 | |||
47 | return render('tags/tags.html') |
|
53 | return render('tags/tags.html') |
General Comments 0
You need to be logged in to leave comments.
Login now