Show More
@@ -92,7 +92,7 b' def use_setuptools(' | |||||
92 | try: |
|
92 | try: | |
93 | import pkg_resources |
|
93 | import pkg_resources | |
94 | except ImportError: |
|
94 | except ImportError: | |
95 |
return do_download() |
|
95 | return do_download() | |
96 | try: |
|
96 | try: | |
97 | pkg_resources.require("setuptools>="+version); return |
|
97 | pkg_resources.require("setuptools>="+version); return | |
98 | except pkg_resources.VersionConflict, e: |
|
98 | except pkg_resources.VersionConflict, e: | |
@@ -268,9 +268,3 b" if __name__=='__main__':" | |||||
268 | update_md5(sys.argv[2:]) |
|
268 | update_md5(sys.argv[2:]) | |
269 | else: |
|
269 | else: | |
270 | main(sys.argv[1:]) |
|
270 | main(sys.argv[1:]) | |
271 |
|
||||
272 |
|
||||
273 |
|
||||
274 |
|
||||
275 |
|
||||
276 |
|
@@ -8,19 +8,19 b'' | |||||
8 |
|
8 | |||
9 | :created_on: Apr 9, 2010 |
|
9 | :created_on: Apr 9, 2010 | |
10 | :author: marcink |
|
10 | :author: marcink | |
11 |
:copyright: (C) 2009-2011 Marcin Kuzminski <marcin@python-works.com> |
|
11 | :copyright: (C) 2009-2011 Marcin Kuzminski <marcin@python-works.com> | |
12 | :license: GPLv3, see COPYING for more details. |
|
12 | :license: GPLv3, see COPYING for more details. | |
13 | """ |
|
13 | """ | |
14 | # This program is free software; you can redistribute it and/or |
|
14 | # This program is free software; you can redistribute it and/or | |
15 | # modify it under the terms of the GNU General Public License |
|
15 | # modify it under the terms of the GNU General Public License | |
16 | # as published by the Free Software Foundation; version 2 |
|
16 | # as published by the Free Software Foundation; version 2 | |
17 | # of the License or (at your opinion) any later version of the license. |
|
17 | # of the License or (at your opinion) any later version of the license. | |
18 |
# |
|
18 | # | |
19 | # This program is distributed in the hope that it will be useful, |
|
19 | # This program is distributed in the hope that it will be useful, | |
20 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
20 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
21 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
21 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
22 | # GNU General Public License for more details. |
|
22 | # GNU General Public License for more details. | |
23 |
# |
|
23 | # | |
24 | # You should have received a copy of the GNU General Public License |
|
24 | # You should have received a copy of the GNU General Public License | |
25 | # along with this program; if not, write to the Free Software |
|
25 | # along with this program; if not, write to the Free Software | |
26 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
26 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
@@ -76,4 +76,3 b' def make_app(global_conf, full_stack=Tru' | |||||
76 | app.config = config |
|
76 | app.config = config | |
77 |
|
77 | |||
78 | return app |
|
78 | return app | |
79 |
|
@@ -19,7 +19,7 b' def make_map(config):' | |||||
19 | def check_repo(environ, match_dict): |
|
19 | def check_repo(environ, match_dict): | |
20 | """ |
|
20 | """ | |
21 | check for valid repository for proper 404 handling |
|
21 | check for valid repository for proper 404 handling | |
22 |
|
22 | |||
23 | :param environ: |
|
23 | :param environ: | |
24 | :param match_dict: |
|
24 | :param match_dict: | |
25 | """ |
|
25 | """ |
@@ -4,22 +4,22 b'' | |||||
4 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|
4 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
5 |
|
5 | |||
6 | Controller for Admin panel of Rhodecode |
|
6 | Controller for Admin panel of Rhodecode | |
7 |
|
7 | |||
8 | :created_on: Apr 7, 2010 |
|
8 | :created_on: Apr 7, 2010 | |
9 | :author: marcink |
|
9 | :author: marcink | |
10 |
:copyright: (C) 2009-2011 Marcin Kuzminski <marcin@python-works.com> |
|
10 | :copyright: (C) 2009-2011 Marcin Kuzminski <marcin@python-works.com> | |
11 | :license: GPLv3, see COPYING for more details. |
|
11 | :license: GPLv3, see COPYING for more details. | |
12 | """ |
|
12 | """ | |
13 | # This program is free software; you can redistribute it and/or |
|
13 | # This program is free software; you can redistribute it and/or | |
14 | # modify it under the terms of the GNU General Public License |
|
14 | # modify it under the terms of the GNU General Public License | |
15 | # as published by the Free Software Foundation; version 2 |
|
15 | # as published by the Free Software Foundation; version 2 | |
16 | # of the License or (at your opinion) any later version of the license. |
|
16 | # of the License or (at your opinion) any later version of the license. | |
17 |
# |
|
17 | # | |
18 | # This program is distributed in the hope that it will be useful, |
|
18 | # This program is distributed in the hope that it will be useful, | |
19 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
19 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
20 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
20 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
21 | # GNU General Public License for more details. |
|
21 | # GNU General Public License for more details. | |
22 |
# |
|
22 | # | |
23 | # You should have received a copy of the GNU General Public License |
|
23 | # You should have received a copy of the GNU General Public License | |
24 | # along with this program; if not, write to the Free Software |
|
24 | # along with this program; if not, write to the Free Software | |
25 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
25 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, | |
@@ -57,4 +57,3 b' class AdminController(BaseController):' | |||||
57 | if request.params.get('partial'): |
|
57 | if request.params.get('partial'): | |
58 | return c.log_data |
|
58 | return c.log_data | |
59 | return render('admin/admin.html') |
|
59 | return render('admin/admin.html') | |
60 |
|
@@ -4,22 +4,22 b'' | |||||
4 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|
4 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
5 |
|
5 | |||
6 | ldap controller for RhodeCode |
|
6 | ldap controller for RhodeCode | |
7 |
|
7 | |||
8 | :created_on: Nov 26, 2010 |
|
8 | :created_on: Nov 26, 2010 | |
9 | :author: marcink |
|
9 | :author: marcink | |
10 |
:copyright: (C) 2009-2011 Marcin Kuzminski <marcin@python-works.com> |
|
10 | :copyright: (C) 2009-2011 Marcin Kuzminski <marcin@python-works.com> | |
11 | :license: GPLv3, see COPYING for more details. |
|
11 | :license: GPLv3, see COPYING for more details. | |
12 | """ |
|
12 | """ | |
13 | # This program is free software; you can redistribute it and/or |
|
13 | # This program is free software; you can redistribute it and/or | |
14 | # modify it under the terms of the GNU General Public License |
|
14 | # modify it under the terms of the GNU General Public License | |
15 | # as published by the Free Software Foundation; version 2 |
|
15 | # as published by the Free Software Foundation; version 2 | |
16 | # of the License or (at your opinion) any later version of the license. |
|
16 | # of the License or (at your opinion) any later version of the license. | |
17 |
# |
|
17 | # | |
18 | # This program is distributed in the hope that it will be useful, |
|
18 | # This program is distributed in the hope that it will be useful, | |
19 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
19 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
20 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
20 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
21 | # GNU General Public License for more details. |
|
21 | # GNU General Public License for more details. | |
22 |
# |
|
22 | # | |
23 | # You should have received a copy of the GNU General Public License |
|
23 | # You should have received a copy of the GNU General Public License | |
24 | # along with this program; if not, write to the Free Software |
|
24 | # along with this program; if not, write to the Free Software | |
25 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
25 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
@@ -2,24 +2,24 b'' | |||||
2 | """ |
|
2 | """ | |
3 | rhodecode.controllers.admin.permissions |
|
3 | rhodecode.controllers.admin.permissions | |
4 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|
4 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
5 |
|
5 | |||
6 | permissions controller for Rhodecode |
|
6 | permissions controller for Rhodecode | |
7 |
|
7 | |||
8 | :created_on: Apr 27, 2010 |
|
8 | :created_on: Apr 27, 2010 | |
9 | :author: marcink |
|
9 | :author: marcink | |
10 |
:copyright: (C) 2009-2011 Marcin Kuzminski <marcin@python-works.com> |
|
10 | :copyright: (C) 2009-2011 Marcin Kuzminski <marcin@python-works.com> | |
11 | :license: GPLv3, see COPYING for more details. |
|
11 | :license: GPLv3, see COPYING for more details. | |
12 | """ |
|
12 | """ | |
13 | # This program is free software; you can redistribute it and/or |
|
13 | # This program is free software; you can redistribute it and/or | |
14 | # modify it under the terms of the GNU General Public License |
|
14 | # modify it under the terms of the GNU General Public License | |
15 | # as published by the Free Software Foundation; version 2 |
|
15 | # as published by the Free Software Foundation; version 2 | |
16 | # of the License or (at your opinion) any later version of the license. |
|
16 | # of the License or (at your opinion) any later version of the license. | |
17 |
# |
|
17 | # | |
18 | # This program is distributed in the hope that it will be useful, |
|
18 | # This program is distributed in the hope that it will be useful, | |
19 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
19 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
20 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
20 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
21 | # GNU General Public License for more details. |
|
21 | # GNU General Public License for more details. | |
22 |
# |
|
22 | # | |
23 | # You should have received a copy of the GNU General Public License |
|
23 | # You should have received a copy of the GNU General Public License | |
24 | # along with this program; if not, write to the Free Software |
|
24 | # along with this program; if not, write to the Free Software | |
25 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
25 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
@@ -2,24 +2,24 b'' | |||||
2 | """ |
|
2 | """ | |
3 | rhodecode.controllers.admin.repos |
|
3 | rhodecode.controllers.admin.repos | |
4 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|
4 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
5 |
|
5 | |||
6 | Admin controller for RhodeCode |
|
6 | Admin controller for RhodeCode | |
7 |
|
7 | |||
8 | :created_on: Apr 7, 2010 |
|
8 | :created_on: Apr 7, 2010 | |
9 | :author: marcink |
|
9 | :author: marcink | |
10 |
:copyright: (C) 2009-2011 Marcin Kuzminski <marcin@python-works.com> |
|
10 | :copyright: (C) 2009-2011 Marcin Kuzminski <marcin@python-works.com> | |
11 | :license: GPLv3, see COPYING for more details. |
|
11 | :license: GPLv3, see COPYING for more details. | |
12 | """ |
|
12 | """ | |
13 | # This program is free software; you can redistribute it and/or |
|
13 | # This program is free software; you can redistribute it and/or | |
14 | # modify it under the terms of the GNU General Public License |
|
14 | # modify it under the terms of the GNU General Public License | |
15 | # as published by the Free Software Foundation; version 2 |
|
15 | # as published by the Free Software Foundation; version 2 | |
16 | # of the License or (at your opinion) any later version of the license. |
|
16 | # of the License or (at your opinion) any later version of the license. | |
17 |
# |
|
17 | # | |
18 | # This program is distributed in the hope that it will be useful, |
|
18 | # This program is distributed in the hope that it will be useful, | |
19 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
19 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
20 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
20 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
21 | # GNU General Public License for more details. |
|
21 | # GNU General Public License for more details. | |
22 |
# |
|
22 | # | |
23 | # You should have received a copy of the GNU General Public License |
|
23 | # You should have received a copy of the GNU General Public License | |
24 | # along with this program; if not, write to the Free Software |
|
24 | # along with this program; if not, write to the Free Software | |
25 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
25 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, | |
@@ -82,7 +82,7 b' class ReposController(BaseController):' | |||||
82 | def __load_data(self, repo_name=None): |
|
82 | def __load_data(self, repo_name=None): | |
83 | """ |
|
83 | """ | |
84 | Load defaults settings for edit, and update |
|
84 | Load defaults settings for edit, and update | |
85 |
|
85 | |||
86 | :param repo_name: |
|
86 | :param repo_name: | |
87 | """ |
|
87 | """ | |
88 | self.__load_defaults() |
|
88 | self.__load_defaults() | |
@@ -301,7 +301,7 b' class ReposController(BaseController):' | |||||
301 | def delete_perm_user(self, repo_name): |
|
301 | def delete_perm_user(self, repo_name): | |
302 | """ |
|
302 | """ | |
303 | DELETE an existing repository permission user |
|
303 | DELETE an existing repository permission user | |
304 |
|
304 | |||
305 | :param repo_name: |
|
305 | :param repo_name: | |
306 | """ |
|
306 | """ | |
307 |
|
307 | |||
@@ -317,7 +317,7 b' class ReposController(BaseController):' | |||||
317 | def delete_perm_users_group(self, repo_name): |
|
317 | def delete_perm_users_group(self, repo_name): | |
318 | """ |
|
318 | """ | |
319 | DELETE an existing repository permission users group |
|
319 | DELETE an existing repository permission users group | |
320 |
|
320 | |||
321 | :param repo_name: |
|
321 | :param repo_name: | |
322 | """ |
|
322 | """ | |
323 | try: |
|
323 | try: | |
@@ -333,7 +333,7 b' class ReposController(BaseController):' | |||||
333 | def repo_stats(self, repo_name): |
|
333 | def repo_stats(self, repo_name): | |
334 | """ |
|
334 | """ | |
335 | DELETE an existing repository statistics |
|
335 | DELETE an existing repository statistics | |
336 |
|
336 | |||
337 | :param repo_name: |
|
337 | :param repo_name: | |
338 | """ |
|
338 | """ | |
339 |
|
339 | |||
@@ -349,7 +349,7 b' class ReposController(BaseController):' | |||||
349 | def repo_cache(self, repo_name): |
|
349 | def repo_cache(self, repo_name): | |
350 | """ |
|
350 | """ | |
351 | INVALIDATE existing repository cache |
|
351 | INVALIDATE existing repository cache | |
352 |
|
352 | |||
353 | :param repo_name: |
|
353 | :param repo_name: | |
354 | """ |
|
354 | """ | |
355 |
|
355 | |||
@@ -365,7 +365,7 b' class ReposController(BaseController):' | |||||
365 | """ |
|
365 | """ | |
366 | Set's this repository to be visible in public journal, |
|
366 | Set's this repository to be visible in public journal, | |
367 | in other words assing default user to follow this repo |
|
367 | in other words assing default user to follow this repo | |
368 |
|
368 | |||
369 | :param repo_name: |
|
369 | :param repo_name: | |
370 | """ |
|
370 | """ | |
371 |
|
371 | |||
@@ -392,7 +392,7 b' class ReposController(BaseController):' | |||||
392 | """ |
|
392 | """ | |
393 | Runs task to update given repository with remote changes, |
|
393 | Runs task to update given repository with remote changes, | |
394 | ie. make pull on remote location |
|
394 | ie. make pull on remote location | |
395 |
|
395 | |||
396 | :param repo_name: |
|
396 | :param repo_name: | |
397 | """ |
|
397 | """ | |
398 | try: |
|
398 | try: |
@@ -2,24 +2,24 b'' | |||||
2 | """ |
|
2 | """ | |
3 | rhodecode.controllers.admin.settings |
|
3 | rhodecode.controllers.admin.settings | |
4 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|
4 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
5 |
|
5 | |||
6 | settings controller for rhodecode admin |
|
6 | settings controller for rhodecode admin | |
7 |
|
7 | |||
8 | :created_on: Jul 14, 2010 |
|
8 | :created_on: Jul 14, 2010 | |
9 | :author: marcink |
|
9 | :author: marcink | |
10 |
:copyright: (C) 2009-2011 Marcin Kuzminski <marcin@python-works.com> |
|
10 | :copyright: (C) 2009-2011 Marcin Kuzminski <marcin@python-works.com> | |
11 | :license: GPLv3, see COPYING for more details. |
|
11 | :license: GPLv3, see COPYING for more details. | |
12 | """ |
|
12 | """ | |
13 | # This program is free software; you can redistribute it and/or |
|
13 | # This program is free software; you can redistribute it and/or | |
14 | # modify it under the terms of the GNU General Public License |
|
14 | # modify it under the terms of the GNU General Public License | |
15 | # as published by the Free Software Foundation; version 2 |
|
15 | # as published by the Free Software Foundation; version 2 | |
16 | # of the License or (at your opinion) any later version of the license. |
|
16 | # of the License or (at your opinion) any later version of the license. | |
17 |
# |
|
17 | # | |
18 | # This program is distributed in the hope that it will be useful, |
|
18 | # This program is distributed in the hope that it will be useful, | |
19 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
19 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
20 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
20 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
21 | # GNU General Public License for more details. |
|
21 | # GNU General Public License for more details. | |
22 |
# |
|
22 | # | |
23 | # You should have received a copy of the GNU General Public License |
|
23 | # You should have received a copy of the GNU General Public License | |
24 | # along with this program; if not, write to the Free Software |
|
24 | # along with this program; if not, write to the Free Software | |
25 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
25 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, | |
@@ -56,7 +56,7 b' class SettingsController(BaseController)' | |||||
56 | """REST Controller styled on the Atom Publishing Protocol""" |
|
56 | """REST Controller styled on the Atom Publishing Protocol""" | |
57 | # To properly map this controller, ensure your config/routing.py |
|
57 | # To properly map this controller, ensure your config/routing.py | |
58 | # file has a resource setup: |
|
58 | # file has a resource setup: | |
59 |
# map.resource('setting', 'settings', controller='admin/settings', |
|
59 | # map.resource('setting', 'settings', controller='admin/settings', | |
60 | # path_prefix='/admin', name_prefix='admin_') |
|
60 | # path_prefix='/admin', name_prefix='admin_') | |
61 |
|
61 | |||
62 |
|
62 | |||
@@ -251,7 +251,7 b' class SettingsController(BaseController)' | |||||
251 | @NotAnonymous() |
|
251 | @NotAnonymous() | |
252 | def my_account(self): |
|
252 | def my_account(self): | |
253 | """ |
|
253 | """ | |
254 |
GET /_admin/my_account Displays info about my account |
|
254 | GET /_admin/my_account Displays info about my account | |
255 | """ |
|
255 | """ | |
256 | # url('admin_settings_my_account') |
|
256 | # url('admin_settings_my_account') | |
257 |
|
257 |
@@ -4,22 +4,22 b'' | |||||
4 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|
4 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
5 |
|
5 | |||
6 | Users crud controller for pylons |
|
6 | Users crud controller for pylons | |
7 |
|
7 | |||
8 | :created_on: Apr 4, 2010 |
|
8 | :created_on: Apr 4, 2010 | |
9 | :author: marcink |
|
9 | :author: marcink | |
10 |
:copyright: (C) 2009-2011 Marcin Kuzminski <marcin@python-works.com> |
|
10 | :copyright: (C) 2009-2011 Marcin Kuzminski <marcin@python-works.com> | |
11 | :license: GPLv3, see COPYING for more details. |
|
11 | :license: GPLv3, see COPYING for more details. | |
12 | """ |
|
12 | """ | |
13 | # This program is free software; you can redistribute it and/or |
|
13 | # This program is free software; you can redistribute it and/or | |
14 | # modify it under the terms of the GNU General Public License |
|
14 | # modify it under the terms of the GNU General Public License | |
15 | # as published by the Free Software Foundation; version 2 |
|
15 | # as published by the Free Software Foundation; version 2 | |
16 | # of the License or (at your opinion) any later version of the license. |
|
16 | # of the License or (at your opinion) any later version of the license. | |
17 |
# |
|
17 | # | |
18 | # This program is distributed in the hope that it will be useful, |
|
18 | # This program is distributed in the hope that it will be useful, | |
19 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
19 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
20 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
20 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
21 | # GNU General Public License for more details. |
|
21 | # GNU General Public License for more details. | |
22 |
# |
|
22 | # | |
23 | # You should have received a copy of the GNU General Public License |
|
23 | # You should have received a copy of the GNU General Public License | |
24 | # along with this program; if not, write to the Free Software |
|
24 | # along with this program; if not, write to the Free Software | |
25 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
25 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
@@ -4,22 +4,22 b'' | |||||
4 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|
4 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
5 |
|
5 | |||
6 | Users Groups crud controller for pylons |
|
6 | Users Groups crud controller for pylons | |
7 |
|
7 | |||
8 | :created_on: Jan 25, 2011 |
|
8 | :created_on: Jan 25, 2011 | |
9 | :author: marcink |
|
9 | :author: marcink | |
10 |
:copyright: (C) 2009-2011 Marcin Kuzminski <marcin@python-works.com> |
|
10 | :copyright: (C) 2009-2011 Marcin Kuzminski <marcin@python-works.com> | |
11 | :license: GPLv3, see COPYING for more details. |
|
11 | :license: GPLv3, see COPYING for more details. | |
12 | """ |
|
12 | """ | |
13 | # This program is free software; you can redistribute it and/or |
|
13 | # This program is free software; you can redistribute it and/or | |
14 | # modify it under the terms of the GNU General Public License |
|
14 | # modify it under the terms of the GNU General Public License | |
15 | # as published by the Free Software Foundation; version 2 |
|
15 | # as published by the Free Software Foundation; version 2 | |
16 | # of the License or (at your opinion) any later version of the license. |
|
16 | # of the License or (at your opinion) any later version of the license. | |
17 |
# |
|
17 | # | |
18 | # This program is distributed in the hope that it will be useful, |
|
18 | # This program is distributed in the hope that it will be useful, | |
19 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
19 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
20 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
20 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
21 | # GNU General Public License for more details. |
|
21 | # GNU General Public License for more details. | |
22 |
# |
|
22 | # | |
23 | # You should have received a copy of the GNU General Public License |
|
23 | # You should have received a copy of the GNU General Public License | |
24 | # along with this program; if not, write to the Free Software |
|
24 | # along with this program; if not, write to the Free Software | |
25 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
25 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
@@ -4,22 +4,22 b'' | |||||
4 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|
4 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
5 |
|
5 | |||
6 | branches controller for rhodecode |
|
6 | branches controller for rhodecode | |
7 |
|
7 | |||
8 | :created_on: Apr 21, 2010 |
|
8 | :created_on: Apr 21, 2010 | |
9 | :author: marcink |
|
9 | :author: marcink | |
10 |
:copyright: (C) 2009-2011 Marcin Kuzminski <marcin@python-works.com> |
|
10 | :copyright: (C) 2009-2011 Marcin Kuzminski <marcin@python-works.com> | |
11 | :license: GPLv3, see COPYING for more details. |
|
11 | :license: GPLv3, see COPYING for more details. | |
12 | """ |
|
12 | """ | |
13 | # This program is free software; you can redistribute it and/or |
|
13 | # This program is free software; you can redistribute it and/or | |
14 | # modify it under the terms of the GNU General Public License |
|
14 | # modify it under the terms of the GNU General Public License | |
15 | # as published by the Free Software Foundation; version 2 |
|
15 | # as published by the Free Software Foundation; version 2 | |
16 | # of the License or (at your opinion) any later version of the license. |
|
16 | # of the License or (at your opinion) any later version of the license. | |
17 |
# |
|
17 | # | |
18 | # This program is distributed in the hope that it will be useful, |
|
18 | # This program is distributed in the hope that it will be useful, | |
19 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
19 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
20 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
20 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
21 | # GNU General Public License for more details. |
|
21 | # GNU General Public License for more details. | |
22 |
# |
|
22 | # | |
23 | # You should have received a copy of the GNU General Public License |
|
23 | # You should have received a copy of the GNU General Public License | |
24 | # along with this program; if not, write to the Free Software |
|
24 | # along with this program; if not, write to the Free Software | |
25 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
25 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
@@ -7,19 +7,19 b'' | |||||
7 |
|
7 | |||
8 | :created_on: Apr 21, 2010 |
|
8 | :created_on: Apr 21, 2010 | |
9 | :author: marcink |
|
9 | :author: marcink | |
10 |
:copyright: (C) 2009-2011 Marcin Kuzminski <marcin@python-works.com> |
|
10 | :copyright: (C) 2009-2011 Marcin Kuzminski <marcin@python-works.com> | |
11 | :license: GPLv3, see COPYING for more details. |
|
11 | :license: GPLv3, see COPYING for more details. | |
12 | """ |
|
12 | """ | |
13 | # This program is free software; you can redistribute it and/or |
|
13 | # This program is free software; you can redistribute it and/or | |
14 | # modify it under the terms of the GNU General Public License |
|
14 | # modify it under the terms of the GNU General Public License | |
15 | # as published by the Free Software Foundation; version 2 |
|
15 | # as published by the Free Software Foundation; version 2 | |
16 | # of the License or (at your opinion) any later version of the license. |
|
16 | # of the License or (at your opinion) any later version of the license. | |
17 |
# |
|
17 | # | |
18 | # This program is distributed in the hope that it will be useful, |
|
18 | # This program is distributed in the hope that it will be useful, | |
19 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
19 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
20 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
20 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
21 | # GNU General Public License for more details. |
|
21 | # GNU General Public License for more details. | |
22 |
# |
|
22 | # | |
23 | # You should have received a copy of the GNU General Public License |
|
23 | # You should have received a copy of the GNU General Public License | |
24 | # along with this program; if not, write to the Free Software |
|
24 | # along with this program; if not, write to the Free Software | |
25 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
25 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, | |
@@ -80,7 +80,7 b' class ChangelogController(BaseRepoContro' | |||||
80 | def _graph(self, repo, repo_size, size, p): |
|
80 | def _graph(self, repo, repo_size, size, p): | |
81 | """ |
|
81 | """ | |
82 | Generates a DAG graph for mercurial |
|
82 | Generates a DAG graph for mercurial | |
83 |
|
83 | |||
84 | :param repo: repo instance |
|
84 | :param repo: repo instance | |
85 | :param size: number of commits to show |
|
85 | :param size: number of commits to show | |
86 | :param p: page number |
|
86 | :param p: page number | |
@@ -103,4 +103,3 b' class ChangelogController(BaseRepoContro' | |||||
103 | data.append(('', vtx, edges)) |
|
103 | data.append(('', vtx, edges)) | |
104 |
|
104 | |||
105 | c.jsdata = json.dumps(data) |
|
105 | c.jsdata = json.dumps(data) | |
106 |
|
@@ -3,24 +3,24 b'' | |||||
3 | rhodecode.controllers.changeset |
|
3 | rhodecode.controllers.changeset | |
4 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|
4 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
5 |
|
5 | |||
6 |
changeset controller for pylons showoing changes beetween |
|
6 | changeset controller for pylons showoing changes beetween | |
7 | revisions |
|
7 | revisions | |
8 |
|
8 | |||
9 | :created_on: Apr 25, 2010 |
|
9 | :created_on: Apr 25, 2010 | |
10 | :author: marcink |
|
10 | :author: marcink | |
11 |
:copyright: (C) 2009-2011 Marcin Kuzminski <marcin@python-works.com> |
|
11 | :copyright: (C) 2009-2011 Marcin Kuzminski <marcin@python-works.com> | |
12 | :license: GPLv3, see COPYING for more details. |
|
12 | :license: GPLv3, see COPYING for more details. | |
13 | """ |
|
13 | """ | |
14 | # This program is free software; you can redistribute it and/or |
|
14 | # This program is free software; you can redistribute it and/or | |
15 | # modify it under the terms of the GNU General Public License |
|
15 | # modify it under the terms of the GNU General Public License | |
16 | # as published by the Free Software Foundation; version 2 |
|
16 | # as published by the Free Software Foundation; version 2 | |
17 | # of the License or (at your opinion) any later version of the license. |
|
17 | # of the License or (at your opinion) any later version of the license. | |
18 |
# |
|
18 | # | |
19 | # This program is distributed in the hope that it will be useful, |
|
19 | # This program is distributed in the hope that it will be useful, | |
20 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
20 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
21 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
21 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
22 | # GNU General Public License for more details. |
|
22 | # GNU General Public License for more details. | |
23 |
# |
|
23 | # | |
24 | # You should have received a copy of the GNU General Public License |
|
24 | # You should have received a copy of the GNU General Public License | |
25 | # along with this program; if not, write to the Free Software |
|
25 | # along with this program; if not, write to the Free Software | |
26 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
26 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, | |
@@ -150,7 +150,7 b' class ChangesetController(BaseRepoContro' | |||||
150 | c.changes[changeset.raw_id].append(('changed', node, diff, cs1, cs2)) |
|
150 | c.changes[changeset.raw_id].append(('changed', node, diff, cs1, cs2)) | |
151 |
|
151 | |||
152 | #================================================================== |
|
152 | #================================================================== | |
153 |
# REMOVED FILES |
|
153 | # REMOVED FILES | |
154 | #================================================================== |
|
154 | #================================================================== | |
155 | if not c.cut_off: |
|
155 | if not c.cut_off: | |
156 | for node in changeset.removed: |
|
156 | for node in changeset.removed: |
@@ -4,22 +4,22 b'' | |||||
4 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|
4 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
5 |
|
5 | |||
6 | RhodeCode error controller |
|
6 | RhodeCode error controller | |
7 |
|
7 | |||
8 | :created_on: Dec 8, 2010 |
|
8 | :created_on: Dec 8, 2010 | |
9 | :author: marcink |
|
9 | :author: marcink | |
10 |
:copyright: (C) 2009-2011 Marcin Kuzminski <marcin@python-works.com> |
|
10 | :copyright: (C) 2009-2011 Marcin Kuzminski <marcin@python-works.com> | |
11 | :license: GPLv3, see COPYING for more details. |
|
11 | :license: GPLv3, see COPYING for more details. | |
12 | """ |
|
12 | """ | |
13 | # This program is free software; you can redistribute it and/or |
|
13 | # This program is free software; you can redistribute it and/or | |
14 | # modify it under the terms of the GNU General Public License |
|
14 | # modify it under the terms of the GNU General Public License | |
15 | # as published by the Free Software Foundation; version 2 |
|
15 | # as published by the Free Software Foundation; version 2 | |
16 | # of the License or (at your opinion) any later version of the license. |
|
16 | # of the License or (at your opinion) any later version of the license. | |
17 |
# |
|
17 | # | |
18 | # This program is distributed in the hope that it will be useful, |
|
18 | # This program is distributed in the hope that it will be useful, | |
19 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
19 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
20 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
20 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
21 | # GNU General Public License for more details. |
|
21 | # GNU General Public License for more details. | |
22 |
# |
|
22 | # | |
23 | # You should have received a copy of the GNU General Public License |
|
23 | # You should have received a copy of the GNU General Public License | |
24 | # along with this program; if not, write to the Free Software |
|
24 | # along with this program; if not, write to the Free Software | |
25 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
25 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, | |
@@ -107,5 +107,3 b' class ErrorController(BaseController):' | |||||
107 | return _('The resource could not be found') |
|
107 | return _('The resource could not be found') | |
108 | if code == 500: |
|
108 | if code == 500: | |
109 | return _('The server encountered an unexpected condition which prevented it from fulfilling the request.') |
|
109 | return _('The server encountered an unexpected condition which prevented it from fulfilling the request.') | |
110 |
|
||||
111 |
|
@@ -4,22 +4,22 b'' | |||||
4 | ~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|
4 | ~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
5 |
|
5 | |||
6 | Feed controller for rhodecode |
|
6 | Feed controller for rhodecode | |
7 |
|
7 | |||
8 | :created_on: Apr 23, 2010 |
|
8 | :created_on: Apr 23, 2010 | |
9 | :author: marcink |
|
9 | :author: marcink | |
10 |
:copyright: (C) 2009-2011 Marcin Kuzminski <marcin@python-works.com> |
|
10 | :copyright: (C) 2009-2011 Marcin Kuzminski <marcin@python-works.com> | |
11 | :license: GPLv3, see COPYING for more details. |
|
11 | :license: GPLv3, see COPYING for more details. | |
12 | """ |
|
12 | """ | |
13 | # This program is free software; you can redistribute it and/or |
|
13 | # This program is free software; you can redistribute it and/or | |
14 | # modify it under the terms of the GNU General Public License |
|
14 | # modify it under the terms of the GNU General Public License | |
15 | # as published by the Free Software Foundation; version 2 |
|
15 | # as published by the Free Software Foundation; version 2 | |
16 | # of the License or (at your opinion) any later version of the license. |
|
16 | # of the License or (at your opinion) any later version of the license. | |
17 |
# |
|
17 | # | |
18 | # This program is distributed in the hope that it will be useful, |
|
18 | # This program is distributed in the hope that it will be useful, | |
19 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
19 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
20 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
20 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
21 | # GNU General Public License for more details. |
|
21 | # GNU General Public License for more details. | |
22 |
# |
|
22 | # | |
23 | # You should have received a copy of the GNU General Public License |
|
23 | # You should have received a copy of the GNU General Public License | |
24 | # along with this program; if not, write to the Free Software |
|
24 | # along with this program; if not, write to the Free Software | |
25 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
25 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
@@ -4,22 +4,22 b'' | |||||
4 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|
4 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
5 |
|
5 | |||
6 | Files controller for RhodeCode |
|
6 | Files controller for RhodeCode | |
7 |
|
7 | |||
8 | :created_on: Apr 21, 2010 |
|
8 | :created_on: Apr 21, 2010 | |
9 | :author: marcink |
|
9 | :author: marcink | |
10 |
:copyright: (C) 2009-2011 Marcin Kuzminski <marcin@python-works.com> |
|
10 | :copyright: (C) 2009-2011 Marcin Kuzminski <marcin@python-works.com> | |
11 | :license: GPLv3, see COPYING for more details. |
|
11 | :license: GPLv3, see COPYING for more details. | |
12 | """ |
|
12 | """ | |
13 | # This program is free software; you can redistribute it and/or |
|
13 | # This program is free software; you can redistribute it and/or | |
14 | # modify it under the terms of the GNU General Public License |
|
14 | # modify it under the terms of the GNU General Public License | |
15 | # as published by the Free Software Foundation; version 2 |
|
15 | # as published by the Free Software Foundation; version 2 | |
16 | # of the License or (at your opinion) any later version of the license. |
|
16 | # of the License or (at your opinion) any later version of the license. | |
17 |
# |
|
17 | # | |
18 | # This program is distributed in the hope that it will be useful, |
|
18 | # This program is distributed in the hope that it will be useful, | |
19 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
19 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
20 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
20 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
21 | # GNU General Public License for more details. |
|
21 | # GNU General Public License for more details. | |
22 |
# |
|
22 | # | |
23 | # You should have received a copy of the GNU General Public License |
|
23 | # You should have received a copy of the GNU General Public License | |
24 | # along with this program; if not, write to the Free Software |
|
24 | # along with this program; if not, write to the Free Software | |
25 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
25 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, | |
@@ -60,7 +60,7 b' class FilesController(BaseRepoController' | |||||
60 | """ |
|
60 | """ | |
61 | Safe way to get changeset if error occur it redirects to tip with |
|
61 | Safe way to get changeset if error occur it redirects to tip with | |
62 | proper message |
|
62 | proper message | |
63 |
|
63 | |||
64 | :param rev: revision to fetch |
|
64 | :param rev: revision to fetch | |
65 | :param repo_name: repo name to redirect after |
|
65 | :param repo_name: repo name to redirect after | |
66 | """ |
|
66 | """ | |
@@ -80,7 +80,7 b' class FilesController(BaseRepoController' | |||||
80 | """ |
|
80 | """ | |
81 | Returns file_node, if error occurs or given path is directory, |
|
81 | Returns file_node, if error occurs or given path is directory, | |
82 | it'll redirect to top level path |
|
82 | it'll redirect to top level path | |
83 |
|
83 | |||
84 | :param repo_name: repo_name |
|
84 | :param repo_name: repo_name | |
85 | :param cs: given changeset |
|
85 | :param cs: given changeset | |
86 | :param path: path to lookup |
|
86 | :param path: path to lookup | |
@@ -301,4 +301,3 b' class FilesController(BaseRepoController' | |||||
301 | hist_l.append(tags_group) |
|
301 | hist_l.append(tags_group) | |
302 |
|
302 | |||
303 | return hist_l |
|
303 | return hist_l | |
304 |
|
@@ -4,22 +4,22 b'' | |||||
4 | ~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|
4 | ~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
5 |
|
5 | |||
6 | Home controller for Rhodecode |
|
6 | Home controller for Rhodecode | |
7 |
|
7 | |||
8 | :created_on: Feb 18, 2010 |
|
8 | :created_on: Feb 18, 2010 | |
9 | :author: marcink |
|
9 | :author: marcink | |
10 |
:copyright: (C) 2009-2011 Marcin Kuzminski <marcin@python-works.com> |
|
10 | :copyright: (C) 2009-2011 Marcin Kuzminski <marcin@python-works.com> | |
11 | :license: GPLv3, see COPYING for more details. |
|
11 | :license: GPLv3, see COPYING for more details. | |
12 | """ |
|
12 | """ | |
13 | # This program is free software; you can redistribute it and/or |
|
13 | # This program is free software; you can redistribute it and/or | |
14 | # modify it under the terms of the GNU General Public License |
|
14 | # modify it under the terms of the GNU General Public License | |
15 | # as published by the Free Software Foundation; version 2 |
|
15 | # as published by the Free Software Foundation; version 2 | |
16 | # of the License or (at your opinion) any later version of the license. |
|
16 | # of the License or (at your opinion) any later version of the license. | |
17 |
# |
|
17 | # | |
18 | # This program is distributed in the hope that it will be useful, |
|
18 | # This program is distributed in the hope that it will be useful, | |
19 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
19 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
20 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
20 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
21 | # GNU General Public License for more details. |
|
21 | # GNU General Public License for more details. | |
22 |
# |
|
22 | # | |
23 | # You should have received a copy of the GNU General Public License |
|
23 | # You should have received a copy of the GNU General Public License | |
24 | # along with this program; if not, write to the Free Software |
|
24 | # along with this program; if not, write to the Free Software | |
25 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
25 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
@@ -4,22 +4,22 b'' | |||||
4 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|
4 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
5 |
|
5 | |||
6 | Journal controller for pylons |
|
6 | Journal controller for pylons | |
7 |
|
7 | |||
8 | :created_on: Nov 21, 2010 |
|
8 | :created_on: Nov 21, 2010 | |
9 | :author: marcink |
|
9 | :author: marcink | |
10 |
:copyright: (C) 2009-2011 Marcin Kuzminski <marcin@python-works.com> |
|
10 | :copyright: (C) 2009-2011 Marcin Kuzminski <marcin@python-works.com> | |
11 | :license: GPLv3, see COPYING for more details. |
|
11 | :license: GPLv3, see COPYING for more details. | |
12 | """ |
|
12 | """ | |
13 | # This program is free software; you can redistribute it and/or |
|
13 | # This program is free software; you can redistribute it and/or | |
14 | # modify it under the terms of the GNU General Public License |
|
14 | # modify it under the terms of the GNU General Public License | |
15 | # as published by the Free Software Foundation; version 2 |
|
15 | # as published by the Free Software Foundation; version 2 | |
16 | # of the License or (at your opinion) any later version of the license. |
|
16 | # of the License or (at your opinion) any later version of the license. | |
17 |
# |
|
17 | # | |
18 | # This program is distributed in the hope that it will be useful, |
|
18 | # This program is distributed in the hope that it will be useful, | |
19 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
19 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
20 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
20 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
21 | # GNU General Public License for more details. |
|
21 | # GNU General Public License for more details. | |
22 |
# |
|
22 | # | |
23 | # You should have received a copy of the GNU General Public License |
|
23 | # You should have received a copy of the GNU General Public License | |
24 | # along with this program; if not, write to the Free Software |
|
24 | # along with this program; if not, write to the Free Software | |
25 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
25 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, | |
@@ -238,11 +238,3 b' class JournalController(BaseController):' | |||||
238 |
|
238 | |||
239 | response.content_type = feed.mime_type |
|
239 | response.content_type = feed.mime_type | |
240 | return feed.writeString('utf-8') |
|
240 | return feed.writeString('utf-8') | |
241 |
|
||||
242 |
|
||||
243 |
|
||||
244 |
|
||||
245 |
|
||||
246 |
|
||||
247 |
|
||||
248 |
|
@@ -4,22 +4,22 b'' | |||||
4 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|
4 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
5 |
|
5 | |||
6 | Login controller for rhodeocode |
|
6 | Login controller for rhodeocode | |
7 |
|
7 | |||
8 | :created_on: Apr 22, 2010 |
|
8 | :created_on: Apr 22, 2010 | |
9 | :author: marcink |
|
9 | :author: marcink | |
10 |
:copyright: (C) 2009-2011 Marcin Kuzminski <marcin@python-works.com> |
|
10 | :copyright: (C) 2009-2011 Marcin Kuzminski <marcin@python-works.com> | |
11 | :license: GPLv3, see COPYING for more details. |
|
11 | :license: GPLv3, see COPYING for more details. | |
12 | """ |
|
12 | """ | |
13 | # This program is free software; you can redistribute it and/or |
|
13 | # This program is free software; you can redistribute it and/or | |
14 | # modify it under the terms of the GNU General Public License |
|
14 | # modify it under the terms of the GNU General Public License | |
15 | # as published by the Free Software Foundation; version 2 |
|
15 | # as published by the Free Software Foundation; version 2 | |
16 | # of the License or (at your opinion) any later version of the license. |
|
16 | # of the License or (at your opinion) any later version of the license. | |
17 |
# |
|
17 | # | |
18 | # This program is distributed in the hope that it will be useful, |
|
18 | # This program is distributed in the hope that it will be useful, | |
19 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
19 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
20 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
20 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
21 | # GNU General Public License for more details. |
|
21 | # GNU General Public License for more details. | |
22 |
# |
|
22 | # | |
23 | # You should have received a copy of the GNU General Public License |
|
23 | # You should have received a copy of the GNU General Public License | |
24 | # along with this program; if not, write to the Free Software |
|
24 | # along with this program; if not, write to the Free Software | |
25 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
25 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
@@ -4,22 +4,22 b'' | |||||
4 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|
4 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
5 |
|
5 | |||
6 | Search controller for rhodecode |
|
6 | Search controller for rhodecode | |
7 |
|
7 | |||
8 | :created_on: Aug 7, 2010 |
|
8 | :created_on: Aug 7, 2010 | |
9 | :author: marcink |
|
9 | :author: marcink | |
10 |
:copyright: (C) 2009-2011 Marcin Kuzminski <marcin@python-works.com> |
|
10 | :copyright: (C) 2009-2011 Marcin Kuzminski <marcin@python-works.com> | |
11 | :license: GPLv3, see COPYING for more details. |
|
11 | :license: GPLv3, see COPYING for more details. | |
12 | """ |
|
12 | """ | |
13 | # This program is free software; you can redistribute it and/or |
|
13 | # This program is free software; you can redistribute it and/or | |
14 | # modify it under the terms of the GNU General Public License |
|
14 | # modify it under the terms of the GNU General Public License | |
15 | # as published by the Free Software Foundation; version 2 |
|
15 | # as published by the Free Software Foundation; version 2 | |
16 | # of the License or (at your opinion) any later version of the license. |
|
16 | # of the License or (at your opinion) any later version of the license. | |
17 |
# |
|
17 | # | |
18 | # This program is distributed in the hope that it will be useful, |
|
18 | # This program is distributed in the hope that it will be useful, | |
19 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
19 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
20 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
20 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
21 | # GNU General Public License for more details. |
|
21 | # GNU General Public License for more details. | |
22 |
# |
|
22 | # | |
23 | # You should have received a copy of the GNU General Public License |
|
23 | # You should have received a copy of the GNU General Public License | |
24 | # along with this program; if not, write to the Free Software |
|
24 | # along with this program; if not, write to the Free Software | |
25 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
25 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
@@ -4,22 +4,22 b'' | |||||
4 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|
4 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
5 |
|
5 | |||
6 | Settings controller for rhodecode |
|
6 | Settings controller for rhodecode | |
7 |
|
7 | |||
8 | :created_on: Jun 30, 2010 |
|
8 | :created_on: Jun 30, 2010 | |
9 | :author: marcink |
|
9 | :author: marcink | |
10 |
:copyright: (C) 2009-2011 Marcin Kuzminski <marcin@python-works.com> |
|
10 | :copyright: (C) 2009-2011 Marcin Kuzminski <marcin@python-works.com> | |
11 | :license: GPLv3, see COPYING for more details. |
|
11 | :license: GPLv3, see COPYING for more details. | |
12 | """ |
|
12 | """ | |
13 | # This program is free software; you can redistribute it and/or |
|
13 | # This program is free software; you can redistribute it and/or | |
14 | # modify it under the terms of the GNU General Public License |
|
14 | # modify it under the terms of the GNU General Public License | |
15 | # as published by the Free Software Foundation; version 2 |
|
15 | # as published by the Free Software Foundation; version 2 | |
16 | # of the License or (at your opinion) any later version of the license. |
|
16 | # of the License or (at your opinion) any later version of the license. | |
17 |
# |
|
17 | # | |
18 | # This program is distributed in the hope that it will be useful, |
|
18 | # This program is distributed in the hope that it will be useful, | |
19 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
19 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
20 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
20 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
21 | # GNU General Public License for more details. |
|
21 | # GNU General Public License for more details. | |
22 |
# |
|
22 | # | |
23 | # You should have received a copy of the GNU General Public License |
|
23 | # You should have received a copy of the GNU General Public License | |
24 | # along with this program; if not, write to the Free Software |
|
24 | # along with this program; if not, write to the Free Software | |
25 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
25 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
@@ -4,22 +4,22 b'' | |||||
4 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|
4 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
5 |
|
5 | |||
6 | Shortlog controller for rhodecode |
|
6 | Shortlog controller for rhodecode | |
7 |
|
7 | |||
8 | :created_on: Apr 18, 2010 |
|
8 | :created_on: Apr 18, 2010 | |
9 | :author: marcink |
|
9 | :author: marcink | |
10 |
:copyright: (C) 2009-2011 Marcin Kuzminski <marcin@python-works.com> |
|
10 | :copyright: (C) 2009-2011 Marcin Kuzminski <marcin@python-works.com> | |
11 | :license: GPLv3, see COPYING for more details. |
|
11 | :license: GPLv3, see COPYING for more details. | |
12 | """ |
|
12 | """ | |
13 | # This program is free software; you can redistribute it and/or |
|
13 | # This program is free software; you can redistribute it and/or | |
14 | # modify it under the terms of the GNU General Public License |
|
14 | # modify it under the terms of the GNU General Public License | |
15 | # as published by the Free Software Foundation; version 2 |
|
15 | # as published by the Free Software Foundation; version 2 | |
16 | # of the License or (at your opinion) any later version of the license. |
|
16 | # of the License or (at your opinion) any later version of the license. | |
17 |
# |
|
17 | # | |
18 | # This program is distributed in the hope that it will be useful, |
|
18 | # This program is distributed in the hope that it will be useful, | |
19 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
19 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
20 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
20 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
21 | # GNU General Public License for more details. |
|
21 | # GNU General Public License for more details. | |
22 |
# |
|
22 | # | |
23 | # You should have received a copy of the GNU General Public License |
|
23 | # You should have received a copy of the GNU General Public License | |
24 | # along with this program; if not, write to the Free Software |
|
24 | # along with this program; if not, write to the Free Software | |
25 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
25 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
@@ -4,22 +4,22 b'' | |||||
4 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|
4 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
5 |
|
5 | |||
6 | Summary controller for Rhodecode |
|
6 | Summary controller for Rhodecode | |
7 |
|
7 | |||
8 | :created_on: Apr 18, 2010 |
|
8 | :created_on: Apr 18, 2010 | |
9 | :author: marcink |
|
9 | :author: marcink | |
10 |
:copyright: (C) 2009-2011 Marcin Kuzminski <marcin@python-works.com> |
|
10 | :copyright: (C) 2009-2011 Marcin Kuzminski <marcin@python-works.com> | |
11 | :license: GPLv3, see COPYING for more details. |
|
11 | :license: GPLv3, see COPYING for more details. | |
12 | """ |
|
12 | """ | |
13 | # This program is free software; you can redistribute it and/or |
|
13 | # This program is free software; you can redistribute it and/or | |
14 | # modify it under the terms of the GNU General Public License |
|
14 | # modify it under the terms of the GNU General Public License | |
15 | # as published by the Free Software Foundation; version 2 |
|
15 | # as published by the Free Software Foundation; version 2 | |
16 | # of the License or (at your opinion) any later version of the license. |
|
16 | # of the License or (at your opinion) any later version of the license. | |
17 |
# |
|
17 | # | |
18 | # This program is distributed in the hope that it will be useful, |
|
18 | # This program is distributed in the hope that it will be useful, | |
19 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
19 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
20 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
20 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
21 | # GNU General Public License for more details. |
|
21 | # GNU General Public License for more details. | |
22 |
# |
|
22 | # | |
23 | # You should have received a copy of the GNU General Public License |
|
23 | # You should have received a copy of the GNU General Public License | |
24 | # along with this program; if not, write to the Free Software |
|
24 | # along with this program; if not, write to the Free Software | |
25 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
25 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
@@ -4,22 +4,22 b'' | |||||
4 | ~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|
4 | ~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
5 |
|
5 | |||
6 | Tags controller for rhodecode |
|
6 | Tags controller for rhodecode | |
7 |
|
7 | |||
8 | :created_on: Apr 21, 2010 |
|
8 | :created_on: Apr 21, 2010 | |
9 | :author: marcink |
|
9 | :author: marcink | |
10 |
:copyright: (C) 2009-2011 Marcin Kuzminski <marcin@python-works.com> |
|
10 | :copyright: (C) 2009-2011 Marcin Kuzminski <marcin@python-works.com> | |
11 | :license: GPLv3, see COPYING for more details. |
|
11 | :license: GPLv3, see COPYING for more details. | |
12 | """ |
|
12 | """ | |
13 | # This program is free software; you can redistribute it and/or |
|
13 | # This program is free software; you can redistribute it and/or | |
14 | # modify it under the terms of the GNU General Public License |
|
14 | # modify it under the terms of the GNU General Public License | |
15 | # as published by the Free Software Foundation; version 2 |
|
15 | # as published by the Free Software Foundation; version 2 | |
16 | # of the License or (at your opinion) any later version of the license. |
|
16 | # of the License or (at your opinion) any later version of the license. | |
17 |
# |
|
17 | # | |
18 | # This program is distributed in the hope that it will be useful, |
|
18 | # This program is distributed in the hope that it will be useful, | |
19 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
19 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
20 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
20 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
21 | # GNU General Public License for more details. |
|
21 | # GNU General Public License for more details. | |
22 |
# |
|
22 | # | |
23 | # You should have received a copy of the GNU General Public License |
|
23 | # You should have received a copy of the GNU General Public License | |
24 | # along with this program; if not, write to the Free Software |
|
24 | # along with this program; if not, write to the Free Software | |
25 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
25 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
@@ -4,22 +4,22 b'' | |||||
4 | ~~~~~~~~~~~~~~~~~~~~~~~ |
|
4 | ~~~~~~~~~~~~~~~~~~~~~~~ | |
5 |
|
5 | |||
6 | Some simple helper functions |
|
6 | Some simple helper functions | |
7 |
|
7 | |||
8 | :created_on: Jan 5, 2011 |
|
8 | :created_on: Jan 5, 2011 | |
9 | :author: marcink |
|
9 | :author: marcink | |
10 |
:copyright: (C) 2009-2010 Marcin Kuzminski <marcin@python-works.com> |
|
10 | :copyright: (C) 2009-2010 Marcin Kuzminski <marcin@python-works.com> | |
11 | :license: GPLv3, see COPYING for more details. |
|
11 | :license: GPLv3, see COPYING for more details. | |
12 | """ |
|
12 | """ | |
13 | # This program is free software; you can redistribute it and/or |
|
13 | # This program is free software; you can redistribute it and/or | |
14 | # modify it under the terms of the GNU General Public License |
|
14 | # modify it under the terms of the GNU General Public License | |
15 | # as published by the Free Software Foundation; version 2 |
|
15 | # as published by the Free Software Foundation; version 2 | |
16 | # of the License or (at your opinion) any later version of the license. |
|
16 | # of the License or (at your opinion) any later version of the license. | |
17 |
# |
|
17 | # | |
18 | # This program is distributed in the hope that it will be useful, |
|
18 | # This program is distributed in the hope that it will be useful, | |
19 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
19 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
20 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
20 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
21 | # GNU General Public License for more details. |
|
21 | # GNU General Public License for more details. | |
22 |
# |
|
22 | # | |
23 | # You should have received a copy of the GNU General Public License |
|
23 | # You should have received a copy of the GNU General Public License | |
24 | # along with this program; if not, write to the Free Software |
|
24 | # along with this program; if not, write to the Free Software | |
25 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
25 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, | |
@@ -36,7 +36,7 b' def str2bool(s):' | |||||
36 | def generate_api_key(username, salt=None): |
|
36 | def generate_api_key(username, salt=None): | |
37 | """ |
|
37 | """ | |
38 | Generates uniq API key for given username |
|
38 | Generates uniq API key for given username | |
39 |
|
39 | |||
40 | :param username: username as string |
|
40 | :param username: username as string | |
41 | :param salt: salt to hash generate KEY |
|
41 | :param salt: salt to hash generate KEY | |
42 | """ |
|
42 | """ | |
@@ -51,8 +51,8 b' def generate_api_key(username, salt=None' | |||||
51 | def safe_unicode(_str): |
|
51 | def safe_unicode(_str): | |
52 | """ |
|
52 | """ | |
53 | safe unicode function. In case of UnicodeDecode error we try to return |
|
53 | safe unicode function. In case of UnicodeDecode error we try to return | |
54 |
unicode with errors replace, if this fails we return unicode with |
|
54 | unicode with errors replace, if this fails we return unicode with | |
55 |
string_escape decoding |
|
55 | string_escape decoding | |
56 | """ |
|
56 | """ | |
57 |
|
57 | |||
58 | if isinstance(_str, unicode): |
|
58 | if isinstance(_str, unicode): |
@@ -2,9 +2,9 b'' | |||||
2 | """ |
|
2 | """ | |
3 | rhodecode.lib.auth |
|
3 | rhodecode.lib.auth | |
4 | ~~~~~~~~~~~~~~~~~~ |
|
4 | ~~~~~~~~~~~~~~~~~~ | |
5 |
|
5 | |||
6 | authentication and permission libraries |
|
6 | authentication and permission libraries | |
7 |
|
7 | |||
8 | :created_on: Apr 4, 2010 |
|
8 | :created_on: Apr 4, 2010 | |
9 | :copyright: (c) 2010 by marcink. |
|
9 | :copyright: (c) 2010 by marcink. | |
10 | :license: LICENSE_NAME, see LICENSE_FILE for more details. |
|
10 | :license: LICENSE_NAME, see LICENSE_FILE for more details. | |
@@ -13,12 +13,12 b'' | |||||
13 | # modify it under the terms of the GNU General Public License |
|
13 | # modify it under the terms of the GNU General Public License | |
14 | # as published by the Free Software Foundation; version 2 |
|
14 | # as published by the Free Software Foundation; version 2 | |
15 | # of the License or (at your opinion) any later version of the license. |
|
15 | # of the License or (at your opinion) any later version of the license. | |
16 |
# |
|
16 | # | |
17 | # This program is distributed in the hope that it will be useful, |
|
17 | # This program is distributed in the hope that it will be useful, | |
18 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
18 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
19 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
19 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
20 | # GNU General Public License for more details. |
|
20 | # GNU General Public License for more details. | |
21 |
# |
|
21 | # | |
22 | # You should have received a copy of the GNU General Public License |
|
22 | # You should have received a copy of the GNU General Public License | |
23 | # along with this program; if not, write to the Free Software |
|
23 | # along with this program; if not, write to the Free Software | |
24 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
24 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, | |
@@ -61,7 +61,7 b' class PasswordGenerator(object):' | |||||
61 | usage: |
|
61 | usage: | |
62 | passwd_gen = PasswordGenerator() |
|
62 | passwd_gen = PasswordGenerator() | |
63 | #print 8-letter password containing only big and small letters of alphabet |
|
63 | #print 8-letter password containing only big and small letters of alphabet | |
64 |
print passwd_gen.gen_password(8, passwd_gen.ALPHABETS_BIG_SMALL) |
|
64 | print passwd_gen.gen_password(8, passwd_gen.ALPHABETS_BIG_SMALL) | |
65 | """ |
|
65 | """ | |
66 | ALPHABETS_NUM = r'''1234567890'''#[0] |
|
66 | ALPHABETS_NUM = r'''1234567890'''#[0] | |
67 | ALPHABETS_SMALL = r'''qwertyuiopasdfghjklzxcvbnm'''#[1] |
|
67 | ALPHABETS_SMALL = r'''qwertyuiopasdfghjklzxcvbnm'''#[1] | |
@@ -87,7 +87,7 b' class RhodeCodeCrypto(object):' | |||||
87 | """ |
|
87 | """ | |
88 | Cryptographic function used for password hashing based on pybcrypt |
|
88 | Cryptographic function used for password hashing based on pybcrypt | |
89 | or pycrypto in windows |
|
89 | or pycrypto in windows | |
90 |
|
90 | |||
91 | :param password: password to hash |
|
91 | :param password: password to hash | |
92 | """ |
|
92 | """ | |
93 | if __platform__ in PLATFORM_WIN: |
|
93 | if __platform__ in PLATFORM_WIN: | |
@@ -102,7 +102,7 b' class RhodeCodeCrypto(object):' | |||||
102 | """ |
|
102 | """ | |
103 | Checks matching password with it's hashed value, runs different |
|
103 | Checks matching password with it's hashed value, runs different | |
104 | implementation based on platform it runs on |
|
104 | implementation based on platform it runs on | |
105 |
|
105 | |||
106 | :param password: password |
|
106 | :param password: password | |
107 | :param hashed: password in hashed form |
|
107 | :param hashed: password in hashed form | |
108 | """ |
|
108 | """ | |
@@ -129,7 +129,7 b' def generate_api_key(username, salt=None' | |||||
129 |
|
129 | |||
130 | def authfunc(environ, username, password): |
|
130 | def authfunc(environ, username, password): | |
131 | """Dummy authentication function used in Mercurial/Git/ and access control, |
|
131 | """Dummy authentication function used in Mercurial/Git/ and access control, | |
132 |
|
132 | |||
133 | :param environ: needed only for using in Basic auth |
|
133 | :param environ: needed only for using in Basic auth | |
134 | """ |
|
134 | """ | |
135 | return authenticate(username, password) |
|
135 | return authenticate(username, password) | |
@@ -139,7 +139,7 b' def authenticate(username, password):' | |||||
139 | """Authentication function used for access control, |
|
139 | """Authentication function used for access control, | |
140 | firstly checks for db authentication then if ldap is enabled for ldap |
|
140 | firstly checks for db authentication then if ldap is enabled for ldap | |
141 | authentication, also creates ldap user if not in database |
|
141 | authentication, also creates ldap user if not in database | |
142 |
|
142 | |||
143 | :param username: username |
|
143 | :param username: username | |
144 | :param password: password |
|
144 | :param password: password | |
145 | """ |
|
145 | """ | |
@@ -174,7 +174,7 b' def authenticate(username, password):' | |||||
174 | ldap_settings = SettingsModel().get_ldap_settings() |
|
174 | ldap_settings = SettingsModel().get_ldap_settings() | |
175 |
|
175 | |||
176 | #====================================================================== |
|
176 | #====================================================================== | |
177 |
# FALLBACK TO LDAP AUTH IF ENABLE |
|
177 | # FALLBACK TO LDAP AUTH IF ENABLE | |
178 | #====================================================================== |
|
178 | #====================================================================== | |
179 | if str2bool(ldap_settings.get('ldap_active')): |
|
179 | if str2bool(ldap_settings.get('ldap_active')): | |
180 | log.debug("Authenticating user using ldap") |
|
180 | log.debug("Authenticating user using ldap") | |
@@ -217,9 +217,9 b' def authenticate(username, password):' | |||||
217 | class AuthUser(object): |
|
217 | class AuthUser(object): | |
218 | """ |
|
218 | """ | |
219 | A simple object that handles all attributes of user in RhodeCode |
|
219 | A simple object that handles all attributes of user in RhodeCode | |
220 |
|
220 | |||
221 | It does lookup based on API key,given user, or user present in session |
|
221 | It does lookup based on API key,given user, or user present in session | |
222 |
Then it fills all required information for such user. It also checks if |
|
222 | Then it fills all required information for such user. It also checks if | |
223 | anonymous access is enabled and if so, it returns default user as logged |
|
223 | anonymous access is enabled and if so, it returns default user as logged | |
224 | in |
|
224 | in | |
225 | """ |
|
225 | """ | |
@@ -278,12 +278,12 b' class AuthUser(object):' | |||||
278 |
|
278 | |||
279 | def set_available_permissions(config): |
|
279 | def set_available_permissions(config): | |
280 | """This function will propagate pylons globals with all available defined |
|
280 | """This function will propagate pylons globals with all available defined | |
281 |
permission given in db. We don't want to check each time from db for new |
|
281 | permission given in db. We don't want to check each time from db for new | |
282 | permissions since adding a new permission also requires application restart |
|
282 | permissions since adding a new permission also requires application restart | |
283 | ie. to decorate new views with the newly created permission |
|
283 | ie. to decorate new views with the newly created permission | |
284 |
|
284 | |||
285 | :param config: current pylons config instance |
|
285 | :param config: current pylons config instance | |
286 |
|
286 | |||
287 | """ |
|
287 | """ | |
288 | log.info('getting information about all available permissions') |
|
288 | log.info('getting information about all available permissions') | |
289 | try: |
|
289 | try: | |
@@ -301,9 +301,9 b' def set_available_permissions(config):' | |||||
301 | #=============================================================================== |
|
301 | #=============================================================================== | |
302 | class LoginRequired(object): |
|
302 | class LoginRequired(object): | |
303 | """ |
|
303 | """ | |
304 |
Must be logged in to execute this function else |
|
304 | Must be logged in to execute this function else | |
305 | redirect to login page |
|
305 | redirect to login page | |
306 |
|
306 | |||
307 | :param api_access: if enabled this checks only for valid auth token |
|
307 | :param api_access: if enabled this checks only for valid auth token | |
308 | and grants access based on valid token |
|
308 | and grants access based on valid token | |
309 | """ |
|
309 | """ | |
@@ -345,7 +345,7 b' class LoginRequired(object):' | |||||
345 | return redirect(url('login_home', came_from=p)) |
|
345 | return redirect(url('login_home', came_from=p)) | |
346 |
|
346 | |||
347 | class NotAnonymous(object): |
|
347 | class NotAnonymous(object): | |
348 |
"""Must be logged in to execute this function else |
|
348 | """Must be logged in to execute this function else | |
349 | redirect to login page""" |
|
349 | redirect to login page""" | |
350 |
|
350 | |||
351 | def __call__(self, func): |
|
351 | def __call__(self, func): | |
@@ -414,7 +414,7 b' class PermsDecorator(object):' | |||||
414 | raise Exception('You have to write this function in child class') |
|
414 | raise Exception('You have to write this function in child class') | |
415 |
|
415 | |||
416 | class HasPermissionAllDecorator(PermsDecorator): |
|
416 | class HasPermissionAllDecorator(PermsDecorator): | |
417 |
"""Checks for access permission for all given predicates. All of them |
|
417 | """Checks for access permission for all given predicates. All of them | |
418 | have to be meet in order to fulfill the request |
|
418 | have to be meet in order to fulfill the request | |
419 | """ |
|
419 | """ | |
420 |
|
420 | |||
@@ -425,7 +425,7 b' class HasPermissionAllDecorator(PermsDec' | |||||
425 |
|
425 | |||
426 |
|
426 | |||
427 | class HasPermissionAnyDecorator(PermsDecorator): |
|
427 | class HasPermissionAnyDecorator(PermsDecorator): | |
428 |
"""Checks for access permission for any of given predicates. In order to |
|
428 | """Checks for access permission for any of given predicates. In order to | |
429 | fulfill the request any of predicates must be meet |
|
429 | fulfill the request any of predicates must be meet | |
430 | """ |
|
430 | """ | |
431 |
|
431 | |||
@@ -435,7 +435,7 b' class HasPermissionAnyDecorator(PermsDec' | |||||
435 | return False |
|
435 | return False | |
436 |
|
436 | |||
437 | class HasRepoPermissionAllDecorator(PermsDecorator): |
|
437 | class HasRepoPermissionAllDecorator(PermsDecorator): | |
438 |
"""Checks for access permission for all given predicates for specific |
|
438 | """Checks for access permission for all given predicates for specific | |
439 | repository. All of them have to be meet in order to fulfill the request |
|
439 | repository. All of them have to be meet in order to fulfill the request | |
440 | """ |
|
440 | """ | |
441 |
|
441 | |||
@@ -451,7 +451,7 b' class HasRepoPermissionAllDecorator(Perm' | |||||
451 |
|
451 | |||
452 |
|
452 | |||
453 | class HasRepoPermissionAnyDecorator(PermsDecorator): |
|
453 | class HasRepoPermissionAnyDecorator(PermsDecorator): | |
454 |
"""Checks for access permission for any of given predicates for specific |
|
454 | """Checks for access permission for any of given predicates for specific | |
455 | repository. In order to fulfill the request any of predicates must be meet |
|
455 | repository. In order to fulfill the request any of predicates must be meet | |
456 | """ |
|
456 | """ | |
457 |
|
457 |
@@ -7,12 +7,12 b'' | |||||
7 | # modify it under the terms of the GNU General Public License |
|
7 | # modify it under the terms of the GNU General Public License | |
8 | # as published by the Free Software Foundation; version 2 |
|
8 | # as published by the Free Software Foundation; version 2 | |
9 | # of the License or (at your opinion) any later version of the license. |
|
9 | # of the License or (at your opinion) any later version of the license. | |
10 |
# |
|
10 | # | |
11 | # This program is distributed in the hope that it will be useful, |
|
11 | # This program is distributed in the hope that it will be useful, | |
12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 | # GNU General Public License for more details. |
|
14 | # GNU General Public License for more details. | |
15 |
# |
|
15 | # | |
16 | # You should have received a copy of the GNU General Public License |
|
16 | # You should have received a copy of the GNU General Public License | |
17 | # along with this program; if not, write to the Free Software |
|
17 | # along with this program; if not, write to the Free Software | |
18 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
18 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, | |
@@ -66,10 +66,10 b' class AuthLdap(object):' | |||||
66 |
|
66 | |||
67 | def authenticate_ldap(self, username, password): |
|
67 | def authenticate_ldap(self, username, password): | |
68 | """Authenticate a user via LDAP and return his/her LDAP properties. |
|
68 | """Authenticate a user via LDAP and return his/her LDAP properties. | |
69 |
|
69 | |||
70 | Raises AuthenticationError if the credentials are rejected, or |
|
70 | Raises AuthenticationError if the credentials are rejected, or | |
71 | EnvironmentError if the LDAP server can't be reached. |
|
71 | EnvironmentError if the LDAP server can't be reached. | |
72 |
|
72 | |||
73 | :param username: username |
|
73 | :param username: username | |
74 | :param password: password |
|
74 | :param password: password | |
75 | """ |
|
75 | """ |
@@ -2,17 +2,17 b'' | |||||
2 | # encoding: utf-8 |
|
2 | # encoding: utf-8 | |
3 | # mercurial repository backup manager |
|
3 | # mercurial repository backup manager | |
4 | # Copyright (C) 2009-2011 Marcin Kuzminski <marcin@python-works.com> |
|
4 | # Copyright (C) 2009-2011 Marcin Kuzminski <marcin@python-works.com> | |
5 |
|
5 | |||
6 | # This program is free software; you can redistribute it and/or |
|
6 | # This program is free software; you can redistribute it and/or | |
7 | # modify it under the terms of the GNU General Public License |
|
7 | # modify it under the terms of the GNU General Public License | |
8 | # as published by the Free Software Foundation; version 2 |
|
8 | # as published by the Free Software Foundation; version 2 | |
9 | # of the License or (at your opinion) any later version of the license. |
|
9 | # of the License or (at your opinion) any later version of the license. | |
10 |
# |
|
10 | # | |
11 | # This program is distributed in the hope that it will be useful, |
|
11 | # This program is distributed in the hope that it will be useful, | |
12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 | # GNU General Public License for more details. |
|
14 | # GNU General Public License for more details. | |
15 |
# |
|
15 | # | |
16 | # You should have received a copy of the GNU General Public License |
|
16 | # You should have received a copy of the GNU General Public License | |
17 | # along with this program; if not, write to the Free Software |
|
17 | # along with this program; if not, write to the Free Software | |
18 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
18 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, | |
@@ -38,7 +38,7 b' class BackupManager(object):' | |||||
38 | def __init__(self, repos_location, rsa_key, backup_server): |
|
38 | def __init__(self, repos_location, rsa_key, backup_server): | |
39 | today = datetime.datetime.now().weekday() + 1 |
|
39 | today = datetime.datetime.now().weekday() + 1 | |
40 | self.backup_file_name = "mercurial_repos.%s.tar.gz" % today |
|
40 | self.backup_file_name = "mercurial_repos.%s.tar.gz" % today | |
41 |
|
41 | |||
42 | self.id_rsa_path = self.get_id_rsa(rsa_key) |
|
42 | self.id_rsa_path = self.get_id_rsa(rsa_key) | |
43 | self.repos_path = self.get_repos_path(repos_location) |
|
43 | self.repos_path = self.get_repos_path(repos_location) | |
44 | self.backup_server = backup_server |
|
44 | self.backup_server = backup_server | |
@@ -54,7 +54,7 b' class BackupManager(object):' | |||||
54 | logging.error('Could not load id_rsa key file in %s', rsa_key) |
|
54 | logging.error('Could not load id_rsa key file in %s', rsa_key) | |
55 | sys.exit() |
|
55 | sys.exit() | |
56 | return rsa_key |
|
56 | return rsa_key | |
57 |
|
57 | |||
58 | def get_repos_path(self, path): |
|
58 | def get_repos_path(self, path): | |
59 | if not os.path.isdir(path): |
|
59 | if not os.path.isdir(path): | |
60 | logging.error('Wrong location for repositories in %s', path) |
|
60 | logging.error('Wrong location for repositories in %s', path) | |
@@ -86,23 +86,21 b' class BackupManager(object):' | |||||
86 |
|
86 | |||
87 | subprocess.call(cmd) |
|
87 | subprocess.call(cmd) | |
88 | logging.info('Transfered file %s to %s', self.backup_file_name, cmd[4]) |
|
88 | logging.info('Transfered file %s to %s', self.backup_file_name, cmd[4]) | |
89 |
|
89 | |||
90 |
|
90 | |||
91 | def rm_file(self): |
|
91 | def rm_file(self): | |
92 | logging.info('Removing file %s', self.backup_file_name) |
|
92 | logging.info('Removing file %s', self.backup_file_name) | |
93 | os.remove(os.path.join(self.backup_file_path, self.backup_file_name)) |
|
93 | os.remove(os.path.join(self.backup_file_path, self.backup_file_name)) | |
94 |
|
94 | |||
95 |
|
95 | |||
96 |
|
96 | |||
97 | if __name__ == "__main__": |
|
97 | if __name__ == "__main__": | |
98 |
|
98 | |||
99 | repo_location = '/home/repo_path' |
|
99 | repo_location = '/home/repo_path' | |
100 | backup_server = 'root@192.168.1.100:/backups/mercurial' |
|
100 | backup_server = 'root@192.168.1.100:/backups/mercurial' | |
101 | rsa_key = '/home/id_rsa' |
|
101 | rsa_key = '/home/id_rsa' | |
102 |
|
102 | |||
103 | B_MANAGER = BackupManager(repo_location, rsa_key, backup_server) |
|
103 | B_MANAGER = BackupManager(repo_location, rsa_key, backup_server) | |
104 | B_MANAGER.backup_repos() |
|
104 | B_MANAGER.backup_repos() | |
105 | B_MANAGER.transfer_files() |
|
105 | B_MANAGER.transfer_files() | |
106 | B_MANAGER.rm_file() |
|
106 | B_MANAGER.rm_file() | |
107 |
|
||||
108 |
|
@@ -51,9 +51,9 b' class BaseRepoController(BaseController)' | |||||
51 | """ |
|
51 | """ | |
52 | Base class for controllers responsible for loading all needed data |
|
52 | Base class for controllers responsible for loading all needed data | |
53 | for those controllers, loaded items are |
|
53 | for those controllers, loaded items are | |
54 |
|
54 | |||
55 | c.rhodecode_repo: instance of scm repository (taken from cache) |
|
55 | c.rhodecode_repo: instance of scm repository (taken from cache) | |
56 |
|
56 | |||
57 | """ |
|
57 | """ | |
58 |
|
58 | |||
59 | def __before__(self): |
|
59 | def __before__(self): |
@@ -4,22 +4,22 b'' | |||||
4 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|
4 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
5 |
|
5 | |||
6 | celery libs for RhodeCode |
|
6 | celery libs for RhodeCode | |
7 |
|
7 | |||
8 | :created_on: Nov 27, 2010 |
|
8 | :created_on: Nov 27, 2010 | |
9 | :author: marcink |
|
9 | :author: marcink | |
10 |
:copyright: (C) 2009-2011 Marcin Kuzminski <marcin@python-works.com> |
|
10 | :copyright: (C) 2009-2011 Marcin Kuzminski <marcin@python-works.com> | |
11 | :license: GPLv3, see COPYING for more details. |
|
11 | :license: GPLv3, see COPYING for more details. | |
12 | """ |
|
12 | """ | |
13 | # This program is free software; you can redistribute it and/or |
|
13 | # This program is free software; you can redistribute it and/or | |
14 | # modify it under the terms of the GNU General Public License |
|
14 | # modify it under the terms of the GNU General Public License | |
15 | # as published by the Free Software Foundation; version 2 |
|
15 | # as published by the Free Software Foundation; version 2 | |
16 | # of the License or (at your opinion) any later version of the license. |
|
16 | # of the License or (at your opinion) any later version of the license. | |
17 |
# |
|
17 | # | |
18 | # This program is distributed in the hope that it will be useful, |
|
18 | # This program is distributed in the hope that it will be useful, | |
19 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
19 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
20 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
20 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
21 | # GNU General Public License for more details. |
|
21 | # GNU General Public License for more details. | |
22 |
# |
|
22 | # | |
23 | # You should have received a copy of the GNU General Public License |
|
23 | # You should have received a copy of the GNU General Public License | |
24 | # along with this program; if not, write to the Free Software |
|
24 | # along with this program; if not, write to the Free Software | |
25 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
25 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, | |
@@ -97,11 +97,3 b' def locked_task(func):' | |||||
97 | return 'Task with key %s already running' % lockkey |
|
97 | return 'Task with key %s already running' % lockkey | |
98 |
|
98 | |||
99 | return decorator(__wrapper, func) |
|
99 | return decorator(__wrapper, func) | |
100 |
|
||||
101 |
|
||||
102 |
|
||||
103 |
|
||||
104 |
|
||||
105 |
|
||||
106 |
|
||||
107 |
|
@@ -5,22 +5,22 b'' | |||||
5 |
|
5 | |||
6 | RhodeCode task modules, containing all task that suppose to be run |
|
6 | RhodeCode task modules, containing all task that suppose to be run | |
7 | by celery daemon |
|
7 | by celery daemon | |
8 |
|
8 | |||
9 | :created_on: Oct 6, 2010 |
|
9 | :created_on: Oct 6, 2010 | |
10 | :author: marcink |
|
10 | :author: marcink | |
11 |
:copyright: (C) 2009-2011 Marcin Kuzminski <marcin@python-works.com> |
|
11 | :copyright: (C) 2009-2011 Marcin Kuzminski <marcin@python-works.com> | |
12 | :license: GPLv3, see COPYING for more details. |
|
12 | :license: GPLv3, see COPYING for more details. | |
13 | """ |
|
13 | """ | |
14 | # This program is free software; you can redistribute it and/or |
|
14 | # This program is free software; you can redistribute it and/or | |
15 | # modify it under the terms of the GNU General Public License |
|
15 | # modify it under the terms of the GNU General Public License | |
16 | # as published by the Free Software Foundation; version 2 |
|
16 | # as published by the Free Software Foundation; version 2 | |
17 | # of the License or (at your opinion) any later version of the license. |
|
17 | # of the License or (at your opinion) any later version of the license. | |
18 |
# |
|
18 | # | |
19 | # This program is distributed in the hope that it will be useful, |
|
19 | # This program is distributed in the hope that it will be useful, | |
20 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
20 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
21 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
21 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
22 | # GNU General Public License for more details. |
|
22 | # GNU General Public License for more details. | |
23 |
# |
|
23 | # | |
24 | # You should have received a copy of the GNU General Public License |
|
24 | # You should have received a copy of the GNU General Public License | |
25 | # along with this program; if not, write to the Free Software |
|
25 | # along with this program; if not, write to the Free Software | |
26 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
26 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, | |
@@ -124,7 +124,7 b' def get_commits_stats(repo_name, ts_min_' | |||||
124 | return True |
|
124 | return True | |
125 |
|
125 | |||
126 | if last_rev == repo.get_changeset().revision and len(repo.revisions) > 1: |
|
126 | if last_rev == repo.get_changeset().revision and len(repo.revisions) > 1: | |
127 |
#pass silently without any work if we're not on first revision or |
|
127 | #pass silently without any work if we're not on first revision or | |
128 | #current state of parsing revision(from db marker) is the last revision |
|
128 | #current state of parsing revision(from db marker) is the last revision | |
129 | return True |
|
129 | return True | |
130 |
|
130 | |||
@@ -272,8 +272,8 b' def reset_user_password(user_email):' | |||||
272 | def send_email(recipients, subject, body): |
|
272 | def send_email(recipients, subject, body): | |
273 | """ |
|
273 | """ | |
274 | Sends an email with defined parameters from the .ini files. |
|
274 | Sends an email with defined parameters from the .ini files. | |
275 |
|
275 | |||
276 |
|
276 | |||
277 | :param recipients: list of recipients, it this is empty the defined email |
|
277 | :param recipients: list of recipients, it this is empty the defined email | |
278 | address from field 'email_to' is used instead |
|
278 | address from field 'email_to' is used instead | |
279 | :param subject: subject of the mail |
|
279 | :param subject: subject of the mail | |
@@ -404,7 +404,3 b' def __get_codes_stats(repo_name):' | |||||
404 | map(aggregate, tip.walk('/')) |
|
404 | map(aggregate, tip.walk('/')) | |
405 |
|
405 | |||
406 | return code_stats or {} |
|
406 | return code_stats or {} | |
407 |
|
||||
408 |
|
||||
409 |
|
||||
410 |
|
@@ -3,7 +3,7 b' import logging' | |||||
3 |
|
3 | |||
4 | BLACK, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN, WHITE = xrange(30, 38) |
|
4 | BLACK, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN, WHITE = xrange(30, 38) | |
5 |
|
5 | |||
6 |
# Sequences |
|
6 | # Sequences | |
7 | RESET_SEQ = "\033[0m" |
|
7 | RESET_SEQ = "\033[0m" | |
8 | COLOR_SEQ = "\033[1;%dm" |
|
8 | COLOR_SEQ = "\033[1;%dm" | |
9 | BOLD_SEQ = "\033[1m" |
|
9 | BOLD_SEQ = "\033[1m" | |
@@ -80,4 +80,3 b' class ColorFormatterSql(logging.Formatte' | |||||
80 |
|
80 | |||
81 | colored_record = start + def_record + end |
|
81 | colored_record = start + def_record + end | |
82 | return colored_record |
|
82 | return colored_record | |
83 |
|
@@ -5,22 +5,22 b'' | |||||
5 |
|
5 | |||
6 | Database creation, and setup module for RhodeCode. Used for creation |
|
6 | Database creation, and setup module for RhodeCode. Used for creation | |
7 | of database as well as for migration operations |
|
7 | of database as well as for migration operations | |
8 |
|
8 | |||
9 | :created_on: Apr 10, 2010 |
|
9 | :created_on: Apr 10, 2010 | |
10 | :author: marcink |
|
10 | :author: marcink | |
11 |
:copyright: (C) 2009-2011 Marcin Kuzminski <marcin@python-works.com> |
|
11 | :copyright: (C) 2009-2011 Marcin Kuzminski <marcin@python-works.com> | |
12 | :license: GPLv3, see COPYING for more details. |
|
12 | :license: GPLv3, see COPYING for more details. | |
13 | """ |
|
13 | """ | |
14 | # This program is free software; you can redistribute it and/or |
|
14 | # This program is free software; you can redistribute it and/or | |
15 | # modify it under the terms of the GNU General Public License |
|
15 | # modify it under the terms of the GNU General Public License | |
16 | # as published by the Free Software Foundation; version 2 |
|
16 | # as published by the Free Software Foundation; version 2 | |
17 | # of the License or (at your opinion) any later version of the license. |
|
17 | # of the License or (at your opinion) any later version of the license. | |
18 |
# |
|
18 | # | |
19 | # This program is distributed in the hope that it will be useful, |
|
19 | # This program is distributed in the hope that it will be useful, | |
20 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
20 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
21 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
21 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
22 | # GNU General Public License for more details. |
|
22 | # GNU General Public License for more details. | |
23 |
# |
|
23 | # | |
24 | # You should have received a copy of the GNU General Public License |
|
24 | # You should have received a copy of the GNU General Public License | |
25 | # along with this program; if not, write to the Free Software |
|
25 | # along with this program; if not, write to the Free Software | |
26 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
26 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, | |
@@ -95,9 +95,9 b' class DbManage(object):' | |||||
95 |
|
95 | |||
96 |
|
96 | |||
97 | def upgrade(self): |
|
97 | def upgrade(self): | |
98 |
"""Upgrades given database schema to given revision following |
|
98 | """Upgrades given database schema to given revision following | |
99 | all needed steps, to perform the upgrade |
|
99 | all needed steps, to perform the upgrade | |
100 |
|
100 | |||
101 | """ |
|
101 | """ | |
102 |
|
102 | |||
103 | from rhodecode.lib.dbmigrate.migrate.versioning import api |
|
103 | from rhodecode.lib.dbmigrate.migrate.versioning import api | |
@@ -134,7 +134,7 b' class DbManage(object):' | |||||
134 | # UPGRADE STEPS |
|
134 | # UPGRADE STEPS | |
135 | #====================================================================== |
|
135 | #====================================================================== | |
136 | class UpgradeSteps(object): |
|
136 | class UpgradeSteps(object): | |
137 |
"""Those steps follow schema versions so for example schema |
|
137 | """Those steps follow schema versions so for example schema | |
138 | for example schema with seq 002 == step_2 and so on. |
|
138 | for example schema with seq 002 == step_2 and so on. | |
139 | """ |
|
139 | """ | |
140 |
|
140 | |||
@@ -261,7 +261,7 b' class DbManage(object):' | |||||
261 | def create_ui_settings(self): |
|
261 | def create_ui_settings(self): | |
262 | """Creates ui settings, fills out hooks |
|
262 | """Creates ui settings, fills out hooks | |
263 | and disables dotencode |
|
263 | and disables dotencode | |
264 |
|
264 | |||
265 | """ |
|
265 | """ | |
266 | #HOOKS |
|
266 | #HOOKS | |
267 | hooks1_key = 'changegroup.update' |
|
267 | hooks1_key = 'changegroup.update' | |
@@ -516,4 +516,3 b' class DbManage(object):' | |||||
516 | except: |
|
516 | except: | |
517 | self.sa.rollback() |
|
517 | self.sa.rollback() | |
518 | raise |
|
518 | raise | |
519 |
|
@@ -2,24 +2,24 b'' | |||||
2 | """ |
|
2 | """ | |
3 | rhodecode.lib.dbmigrate.__init__ |
|
3 | rhodecode.lib.dbmigrate.__init__ | |
4 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|
4 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
5 |
|
5 | |||
6 | Database migration modules |
|
6 | Database migration modules | |
7 |
|
7 | |||
8 | :created_on: Dec 11, 2010 |
|
8 | :created_on: Dec 11, 2010 | |
9 | :author: marcink |
|
9 | :author: marcink | |
10 |
:copyright: (C) 2009-2011 Marcin Kuzminski <marcin@python-works.com> |
|
10 | :copyright: (C) 2009-2011 Marcin Kuzminski <marcin@python-works.com> | |
11 | :license: GPLv3, see COPYING for more details. |
|
11 | :license: GPLv3, see COPYING for more details. | |
12 | """ |
|
12 | """ | |
13 | # This program is free software; you can redistribute it and/or |
|
13 | # This program is free software; you can redistribute it and/or | |
14 | # modify it under the terms of the GNU General Public License |
|
14 | # modify it under the terms of the GNU General Public License | |
15 | # as published by the Free Software Foundation; version 2 |
|
15 | # as published by the Free Software Foundation; version 2 | |
16 | # of the License or (at your opinion) any later version of the license. |
|
16 | # of the License or (at your opinion) any later version of the license. | |
17 |
# |
|
17 | # | |
18 | # This program is distributed in the hope that it will be useful, |
|
18 | # This program is distributed in the hope that it will be useful, | |
19 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
19 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
20 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
20 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
21 | # GNU General Public License for more details. |
|
21 | # GNU General Public License for more details. | |
22 |
# |
|
22 | # | |
23 | # You should have received a copy of the GNU General Public License |
|
23 | # You should have received a copy of the GNU General Public License | |
24 | # along with this program; if not, write to the Free Software |
|
24 | # along with this program; if not, write to the Free Software | |
25 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
25 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
@@ -59,7 +59,7 b' class AlterTableVisitor(SchemaVisitor):' | |||||
59 | # adapt to 0.6 which uses a string-returning |
|
59 | # adapt to 0.6 which uses a string-returning | |
60 | # object |
|
60 | # object | |
61 | self.append(" %s" % ret) |
|
61 | self.append(" %s" % ret) | |
62 |
|
62 | |||
63 | def _to_table(self, param): |
|
63 | def _to_table(self, param): | |
64 | """Returns the table object for the given param object.""" |
|
64 | """Returns the table object for the given param object.""" | |
65 | if isinstance(param, (sa.Column, sa.Index, sa.schema.Constraint)): |
|
65 | if isinstance(param, (sa.Column, sa.Index, sa.schema.Constraint)): | |
@@ -297,10 +297,10 b' else:' | |||||
297 |
|
297 | |||
298 | def get_constraint_specification(self, cons, **kwargs): |
|
298 | def get_constraint_specification(self, cons, **kwargs): | |
299 | """Constaint SQL generators. |
|
299 | """Constaint SQL generators. | |
300 |
|
300 | |||
301 | We cannot use SA visitors because they append comma. |
|
301 | We cannot use SA visitors because they append comma. | |
302 | """ |
|
302 | """ | |
303 |
|
303 | |||
304 | if isinstance(cons, PrimaryKeyConstraint): |
|
304 | if isinstance(cons, PrimaryKeyConstraint): | |
305 | if cons.name is not None: |
|
305 | if cons.name is not None: | |
306 | self.append("CONSTRAINT %s " % self.preparer.format_constraint(cons)) |
|
306 | self.append("CONSTRAINT %s " % self.preparer.format_constraint(cons)) | |
@@ -327,13 +327,13 b' else:' | |||||
327 | raise exceptions.InvalidConstraintError(cons) |
|
327 | raise exceptions.InvalidConstraintError(cons) | |
328 |
|
328 | |||
329 | def _visit_constraint(self, constraint): |
|
329 | def _visit_constraint(self, constraint): | |
330 |
|
330 | |||
331 | table = self.start_alter_table(constraint) |
|
331 | table = self.start_alter_table(constraint) | |
332 | constraint.name = self.get_constraint_name(constraint) |
|
332 | constraint.name = self.get_constraint_name(constraint) | |
333 | self.append("ADD ") |
|
333 | self.append("ADD ") | |
334 | self.get_constraint_specification(constraint) |
|
334 | self.get_constraint_specification(constraint) | |
335 | self.execute() |
|
335 | self.execute() | |
336 |
|
336 | |||
337 |
|
337 | |||
338 | class ANSIConstraintDropper(ANSIConstraintCommon, SchemaDropper): |
|
338 | class ANSIConstraintDropper(ANSIConstraintCommon, SchemaDropper): | |
339 |
|
339 |
@@ -34,7 +34,7 b' class FBColumnDropper(ansisql.ANSIColumn' | |||||
34 | if column.name in [col.name for col in index.columns]: |
|
34 | if column.name in [col.name for col in index.columns]: | |
35 | index.drop() |
|
35 | index.drop() | |
36 | # TODO: recreate index if it references more than this column |
|
36 | # TODO: recreate index if it references more than this column | |
37 |
|
37 | |||
38 | for cons in column.table.constraints: |
|
38 | for cons in column.table.constraints: | |
39 | if isinstance(cons,PrimaryKeyConstraint): |
|
39 | if isinstance(cons,PrimaryKeyConstraint): | |
40 | # will be deleted only when the column its on |
|
40 | # will be deleted only when the column its on |
@@ -44,7 +44,7 b' class SQLiteHelper(SQLiteCommon):' | |||||
44 | self.execute() |
|
44 | self.execute() | |
45 | self.append('DROP TABLE migration_tmp') |
|
45 | self.append('DROP TABLE migration_tmp') | |
46 | self.execute() |
|
46 | self.execute() | |
47 |
|
47 | |||
48 | def visit_column(self, delta): |
|
48 | def visit_column(self, delta): | |
49 | if isinstance(delta, DictMixin): |
|
49 | if isinstance(delta, DictMixin): | |
50 | column = delta.result_column |
|
50 | column = delta.result_column | |
@@ -54,7 +54,7 b' class SQLiteHelper(SQLiteCommon):' | |||||
54 | table = self._to_table(column.table) |
|
54 | table = self._to_table(column.table) | |
55 | self.recreate_table(table,column,delta) |
|
55 | self.recreate_table(table,column,delta) | |
56 |
|
56 | |||
57 |
class SQLiteColumnGenerator(SQLiteSchemaGenerator, |
|
57 | class SQLiteColumnGenerator(SQLiteSchemaGenerator, | |
58 | ansisql.ANSIColumnGenerator, |
|
58 | ansisql.ANSIColumnGenerator, | |
59 | # at the end so we get the normal |
|
59 | # at the end so we get the normal | |
60 | # visit_column by default |
|
60 | # visit_column by default | |
@@ -80,7 +80,7 b' class SQLiteColumnDropper(SQLiteHelper, ' | |||||
80 | """SQLite ColumnDropper""" |
|
80 | """SQLite ColumnDropper""" | |
81 |
|
81 | |||
82 | def _modify_table(self, table, column, delta): |
|
82 | def _modify_table(self, table, column, delta): | |
83 |
|
83 | |||
84 | columns = ' ,'.join(map(self.preparer.format_column, table.columns)) |
|
84 | columns = ' ,'.join(map(self.preparer.format_column, table.columns)) | |
85 | return 'INSERT INTO %(table_name)s SELECT ' + columns + \ |
|
85 | return 'INSERT INTO %(table_name)s SELECT ' + columns + \ | |
86 | ' from migration_tmp' |
|
86 | ' from migration_tmp' |
@@ -31,7 +31,7 b' from rhodecode.lib.dbmigrate.migrate.cha' | |||||
31 |
|
31 | |||
32 | def create_column(column, table=None, *p, **kw): |
|
32 | def create_column(column, table=None, *p, **kw): | |
33 | """Create a column, given the table. |
|
33 | """Create a column, given the table. | |
34 |
|
34 | |||
35 | API to :meth:`ChangesetColumn.create`. |
|
35 | API to :meth:`ChangesetColumn.create`. | |
36 | """ |
|
36 | """ | |
37 | if table is not None: |
|
37 | if table is not None: | |
@@ -41,7 +41,7 b' def create_column(column, table=None, *p' | |||||
41 |
|
41 | |||
42 | def drop_column(column, table=None, *p, **kw): |
|
42 | def drop_column(column, table=None, *p, **kw): | |
43 | """Drop a column, given the table. |
|
43 | """Drop a column, given the table. | |
44 |
|
44 | |||
45 | API to :meth:`ChangesetColumn.drop`. |
|
45 | API to :meth:`ChangesetColumn.drop`. | |
46 | """ |
|
46 | """ | |
47 | if table is not None: |
|
47 | if table is not None: | |
@@ -105,12 +105,12 b' def alter_column(*p, **k):' | |||||
105 | :param engine: |
|
105 | :param engine: | |
106 | The :class:`~sqlalchemy.engine.base.Engine` to use for table |
|
106 | The :class:`~sqlalchemy.engine.base.Engine` to use for table | |
107 | reflection and schema alterations. |
|
107 | reflection and schema alterations. | |
108 |
|
108 | |||
109 | :returns: A :class:`ColumnDelta` instance representing the change. |
|
109 | :returns: A :class:`ColumnDelta` instance representing the change. | |
110 |
|
110 | |||
111 |
|
111 | |||
112 | """ |
|
112 | """ | |
113 |
|
113 | |||
114 | if 'table' not in k and isinstance(p[0], sqlalchemy.Column): |
|
114 | if 'table' not in k and isinstance(p[0], sqlalchemy.Column): | |
115 | k['table'] = p[0].table |
|
115 | k['table'] = p[0].table | |
116 | if 'engine' not in k: |
|
116 | if 'engine' not in k: | |
@@ -129,7 +129,7 b' def alter_column(*p, **k):' | |||||
129 | # that this crutch has to be left in until they can be sorted |
|
129 | # that this crutch has to be left in until they can be sorted | |
130 | # out |
|
130 | # out | |
131 | k['alter_metadata']=True |
|
131 | k['alter_metadata']=True | |
132 |
|
132 | |||
133 | delta = ColumnDelta(*p, **k) |
|
133 | delta = ColumnDelta(*p, **k) | |
134 |
|
134 | |||
135 | visitorcallable = get_engine_visitor(engine, 'schemachanger') |
|
135 | visitorcallable = get_engine_visitor(engine, 'schemachanger') | |
@@ -183,10 +183,10 b' class ColumnDelta(DictMixin, sqlalchemy.' | |||||
183 | :param table: Table at which current Column should be bound to.\ |
|
183 | :param table: Table at which current Column should be bound to.\ | |
184 | If table name is given, reflection will be used. |
|
184 | If table name is given, reflection will be used. | |
185 | :type table: string or Table instance |
|
185 | :type table: string or Table instance | |
186 |
|
186 | |||
187 | :param metadata: A :class:`MetaData` instance to store |
|
187 | :param metadata: A :class:`MetaData` instance to store | |
188 | reflected table names |
|
188 | reflected table names | |
189 |
|
189 | |||
190 | :param engine: When reflecting tables, either engine or metadata must \ |
|
190 | :param engine: When reflecting tables, either engine or metadata must \ | |
191 | be specified to acquire engine object. |
|
191 | be specified to acquire engine object. | |
192 | :type engine: :class:`Engine` instance |
|
192 | :type engine: :class:`Engine` instance | |
@@ -211,7 +211,7 b' class ColumnDelta(DictMixin, sqlalchemy.' | |||||
211 | # as a crutch until the tests that fail when 'alter_metadata' |
|
211 | # as a crutch until the tests that fail when 'alter_metadata' | |
212 | # behaviour always happens can be sorted out |
|
212 | # behaviour always happens can be sorted out | |
213 | self.alter_metadata = kw.pop("alter_metadata", False) |
|
213 | self.alter_metadata = kw.pop("alter_metadata", False) | |
214 |
|
214 | |||
215 | self.meta = kw.pop("metadata", None) |
|
215 | self.meta = kw.pop("metadata", None) | |
216 | self.engine = kw.pop("engine", None) |
|
216 | self.engine = kw.pop("engine", None) | |
217 |
|
217 | |||
@@ -239,7 +239,7 b' class ColumnDelta(DictMixin, sqlalchemy.' | |||||
239 | self.alter_metadata, |
|
239 | self.alter_metadata, | |
240 | super(ColumnDelta, self).__repr__() |
|
240 | super(ColumnDelta, self).__repr__() | |
241 | ) |
|
241 | ) | |
242 |
|
242 | |||
243 | def __getitem__(self, key): |
|
243 | def __getitem__(self, key): | |
244 | if key not in self.keys(): |
|
244 | if key not in self.keys(): | |
245 | raise KeyError("No such diff key, available: %s" % self.diffs ) |
|
245 | raise KeyError("No such diff key, available: %s" % self.diffs ) | |
@@ -278,7 +278,7 b' class ColumnDelta(DictMixin, sqlalchemy.' | |||||
278 | """Compares two Column objects""" |
|
278 | """Compares two Column objects""" | |
279 | self.process_column(new_col) |
|
279 | self.process_column(new_col) | |
280 | self.table = k.pop('table', None) |
|
280 | self.table = k.pop('table', None) | |
281 |
# we cannot use bool() on table in SA06 |
|
281 | # we cannot use bool() on table in SA06 | |
282 | if self.table is None: |
|
282 | if self.table is None: | |
283 | self.table = old_col.table |
|
283 | self.table = old_col.table | |
284 | if self.table is None: |
|
284 | if self.table is None: | |
@@ -367,7 +367,7 b' class ColumnDelta(DictMixin, sqlalchemy.' | |||||
367 | for_update=True)) |
|
367 | for_update=True)) | |
368 | if toinit: |
|
368 | if toinit: | |
369 | column._init_items(*toinit) |
|
369 | column._init_items(*toinit) | |
370 |
|
370 | |||
371 | if not SQLA_06: |
|
371 | if not SQLA_06: | |
372 | column.args = [] |
|
372 | column.args = [] | |
373 |
|
373 | |||
@@ -484,7 +484,7 b' class ChangesetColumn(object):' | |||||
484 |
|
484 | |||
485 | def alter(self, *p, **k): |
|
485 | def alter(self, *p, **k): | |
486 | """Makes a call to :func:`alter_column` for the column this |
|
486 | """Makes a call to :func:`alter_column` for the column this | |
487 |
method is called on. |
|
487 | method is called on. | |
488 | """ |
|
488 | """ | |
489 | if 'table' not in k: |
|
489 | if 'table' not in k: | |
490 | k['table'] = self.table |
|
490 | k['table'] = self.table | |
@@ -559,12 +559,12 b' populated with defaults' | |||||
559 |
|
559 | |||
560 | def _col_name_in_constraint(self,cons,name): |
|
560 | def _col_name_in_constraint(self,cons,name): | |
561 | return False |
|
561 | return False | |
562 |
|
562 | |||
563 | def remove_from_table(self, table, unset_table=True): |
|
563 | def remove_from_table(self, table, unset_table=True): | |
564 | # TODO: remove primary keys, constraints, etc |
|
564 | # TODO: remove primary keys, constraints, etc | |
565 | if unset_table: |
|
565 | if unset_table: | |
566 | self.table = None |
|
566 | self.table = None | |
567 |
|
567 | |||
568 | to_drop = set() |
|
568 | to_drop = set() | |
569 | for index in table.indexes: |
|
569 | for index in table.indexes: | |
570 | columns = [] |
|
570 | columns = [] | |
@@ -576,7 +576,7 b' populated with defaults' | |||||
576 | else: |
|
576 | else: | |
577 | to_drop.add(index) |
|
577 | to_drop.add(index) | |
578 | table.indexes = table.indexes - to_drop |
|
578 | table.indexes = table.indexes - to_drop | |
579 |
|
579 | |||
580 | to_drop = set() |
|
580 | to_drop = set() | |
581 | for cons in table.constraints: |
|
581 | for cons in table.constraints: | |
582 | # TODO: deal with other types of constraint |
|
582 | # TODO: deal with other types of constraint | |
@@ -588,7 +588,7 b' populated with defaults' | |||||
588 | if self.name==col_name: |
|
588 | if self.name==col_name: | |
589 | to_drop.add(cons) |
|
589 | to_drop.add(cons) | |
590 | table.constraints = table.constraints - to_drop |
|
590 | table.constraints = table.constraints - to_drop | |
591 |
|
591 | |||
592 | if table.c.contains_column(self): |
|
592 | if table.c.contains_column(self): | |
593 | table.c.remove(self) |
|
593 | table.c.remove(self) | |
594 |
|
594 |
@@ -207,9 +207,9 b' class ModelGenerator(object):' | |||||
207 | dbTable = self.diff.metadataB.tables[tableName] |
|
207 | dbTable = self.diff.metadataB.tables[tableName] | |
208 |
|
208 | |||
209 | td = self.diff.tables_different[tableName] |
|
209 | td = self.diff.tables_different[tableName] | |
210 |
|
210 | |||
211 | if self._db_can_handle_this_change(td): |
|
211 | if self._db_can_handle_this_change(td): | |
212 |
|
212 | |||
213 | for col in td.columns_missing_from_B: |
|
213 | for col in td.columns_missing_from_B: | |
214 | modelTable.columns[col].create() |
|
214 | modelTable.columns[col].create() | |
215 | for col in td.columns_missing_from_A: |
|
215 | for col in td.columns_missing_from_A: |
@@ -218,7 +218,7 b' class Repository(pathed.Pathed):' | |||||
218 | @classmethod |
|
218 | @classmethod | |
219 | def create_manage_file(cls, file_, **opts): |
|
219 | def create_manage_file(cls, file_, **opts): | |
220 | """Create a project management script (manage.py) |
|
220 | """Create a project management script (manage.py) | |
221 |
|
221 | |||
222 | :param file_: Destination file to be written |
|
222 | :param file_: Destination file to be written | |
223 | :param opts: Options that are passed to :func:`migrate.versioning.shell.main` |
|
223 | :param opts: Options that are passed to :func:`migrate.versioning.shell.main` | |
224 | """ |
|
224 | """ |
@@ -64,7 +64,7 b' class ControlledSchema(object):' | |||||
64 |
|
64 | |||
65 | def changeset(self, version=None): |
|
65 | def changeset(self, version=None): | |
66 | """API to Changeset creation. |
|
66 | """API to Changeset creation. | |
67 |
|
67 | |||
68 | Uses self.version for start version and engine.name |
|
68 | Uses self.version for start version and engine.name | |
69 | to get database name. |
|
69 | to get database name. | |
70 | """ |
|
70 | """ |
@@ -39,11 +39,11 b' class ColDiff(object):' | |||||
39 | Container for differences in one :class:`~sqlalchemy.schema.Column` |
|
39 | Container for differences in one :class:`~sqlalchemy.schema.Column` | |
40 | between two :class:`~sqlalchemy.schema.Table` instances, ``A`` |
|
40 | between two :class:`~sqlalchemy.schema.Table` instances, ``A`` | |
41 | and ``B``. |
|
41 | and ``B``. | |
42 |
|
42 | |||
43 | .. attribute:: col_A |
|
43 | .. attribute:: col_A | |
44 |
|
44 | |||
45 | The :class:`~sqlalchemy.schema.Column` object for A. |
|
45 | The :class:`~sqlalchemy.schema.Column` object for A. | |
46 |
|
46 | |||
47 | .. attribute:: col_B |
|
47 | .. attribute:: col_B | |
48 |
|
48 | |||
49 | The :class:`~sqlalchemy.schema.Column` object for B. |
|
49 | The :class:`~sqlalchemy.schema.Column` object for B. | |
@@ -51,15 +51,15 b' class ColDiff(object):' | |||||
51 | .. attribute:: type_A |
|
51 | .. attribute:: type_A | |
52 |
|
52 | |||
53 | The most generic type of the :class:`~sqlalchemy.schema.Column` |
|
53 | The most generic type of the :class:`~sqlalchemy.schema.Column` | |
54 |
object in A. |
|
54 | object in A. | |
55 |
|
55 | |||
56 | .. attribute:: type_B |
|
56 | .. attribute:: type_B | |
57 |
|
57 | |||
58 | The most generic type of the :class:`~sqlalchemy.schema.Column` |
|
58 | The most generic type of the :class:`~sqlalchemy.schema.Column` | |
59 |
object in A. |
|
59 | object in A. | |
60 |
|
60 | |||
61 | """ |
|
61 | """ | |
62 |
|
62 | |||
63 | diff = False |
|
63 | diff = False | |
64 |
|
64 | |||
65 | def __init__(self,col_A,col_B): |
|
65 | def __init__(self,col_A,col_B): | |
@@ -87,10 +87,10 b' class ColDiff(object):' | |||||
87 | if not (A is None or B is None) and A!=B: |
|
87 | if not (A is None or B is None) and A!=B: | |
88 | self.diff=True |
|
88 | self.diff=True | |
89 | return |
|
89 | return | |
90 |
|
90 | |||
91 | def __nonzero__(self): |
|
91 | def __nonzero__(self): | |
92 | return self.diff |
|
92 | return self.diff | |
93 |
|
93 | |||
94 | class TableDiff(object): |
|
94 | class TableDiff(object): | |
95 | """ |
|
95 | """ | |
96 | Container for differences in one :class:`~sqlalchemy.schema.Table` |
|
96 | Container for differences in one :class:`~sqlalchemy.schema.Table` | |
@@ -101,12 +101,12 b' class TableDiff(object):' | |||||
101 |
|
101 | |||
102 | A sequence of column names that were found in B but weren't in |
|
102 | A sequence of column names that were found in B but weren't in | |
103 | A. |
|
103 | A. | |
104 |
|
104 | |||
105 | .. attribute:: columns_missing_from_B |
|
105 | .. attribute:: columns_missing_from_B | |
106 |
|
106 | |||
107 | A sequence of column names that were found in A but weren't in |
|
107 | A sequence of column names that were found in A but weren't in | |
108 | B. |
|
108 | B. | |
109 |
|
109 | |||
110 | .. attribute:: columns_different |
|
110 | .. attribute:: columns_different | |
111 |
|
111 | |||
112 | A dictionary containing information about columns that were |
|
112 | A dictionary containing information about columns that were | |
@@ -126,7 +126,7 b' class TableDiff(object):' | |||||
126 | self.columns_missing_from_B or |
|
126 | self.columns_missing_from_B or | |
127 | self.columns_different |
|
127 | self.columns_different | |
128 | ) |
|
128 | ) | |
129 |
|
129 | |||
130 | class SchemaDiff(object): |
|
130 | class SchemaDiff(object): | |
131 | """ |
|
131 | """ | |
132 | Compute the difference between two :class:`~sqlalchemy.schema.MetaData` |
|
132 | Compute the difference between two :class:`~sqlalchemy.schema.MetaData` | |
@@ -139,34 +139,34 b' class SchemaDiff(object):' | |||||
139 | The length of a :class:`SchemaDiff` will give the number of |
|
139 | The length of a :class:`SchemaDiff` will give the number of | |
140 | changes found, enabling it to be used much like a boolean in |
|
140 | changes found, enabling it to be used much like a boolean in | |
141 | expressions. |
|
141 | expressions. | |
142 |
|
142 | |||
143 | :param metadataA: |
|
143 | :param metadataA: | |
144 | First :class:`~sqlalchemy.schema.MetaData` to compare. |
|
144 | First :class:`~sqlalchemy.schema.MetaData` to compare. | |
145 |
|
145 | |||
146 | :param metadataB: |
|
146 | :param metadataB: | |
147 | Second :class:`~sqlalchemy.schema.MetaData` to compare. |
|
147 | Second :class:`~sqlalchemy.schema.MetaData` to compare. | |
148 |
|
148 | |||
149 | :param labelA: |
|
149 | :param labelA: | |
150 | The label to use in messages about the first |
|
150 | The label to use in messages about the first | |
151 |
:class:`~sqlalchemy.schema.MetaData`. |
|
151 | :class:`~sqlalchemy.schema.MetaData`. | |
152 |
|
152 | |||
153 |
:param labelB: |
|
153 | :param labelB: | |
154 | The label to use in messages about the second |
|
154 | The label to use in messages about the second | |
155 |
:class:`~sqlalchemy.schema.MetaData`. |
|
155 | :class:`~sqlalchemy.schema.MetaData`. | |
156 |
|
156 | |||
157 | :param excludeTables: |
|
157 | :param excludeTables: | |
158 | A sequence of table names to exclude. |
|
158 | A sequence of table names to exclude. | |
159 |
|
159 | |||
160 | .. attribute:: tables_missing_from_A |
|
160 | .. attribute:: tables_missing_from_A | |
161 |
|
161 | |||
162 | A sequence of table names that were found in B but weren't in |
|
162 | A sequence of table names that were found in B but weren't in | |
163 | A. |
|
163 | A. | |
164 |
|
164 | |||
165 | .. attribute:: tables_missing_from_B |
|
165 | .. attribute:: tables_missing_from_B | |
166 |
|
166 | |||
167 | A sequence of table names that were found in A but weren't in |
|
167 | A sequence of table names that were found in A but weren't in | |
168 | B. |
|
168 | B. | |
169 |
|
169 | |||
170 | .. attribute:: tables_different |
|
170 | .. attribute:: tables_different | |
171 |
|
171 | |||
172 | A dictionary containing information about tables that were found |
|
172 | A dictionary containing information about tables that were found | |
@@ -195,26 +195,26 b' class SchemaDiff(object):' | |||||
195 | self.tables_missing_from_B = sorted( |
|
195 | self.tables_missing_from_B = sorted( | |
196 | A_table_names - B_table_names - excludeTables |
|
196 | A_table_names - B_table_names - excludeTables | |
197 | ) |
|
197 | ) | |
198 |
|
198 | |||
199 | self.tables_different = {} |
|
199 | self.tables_different = {} | |
200 | for table_name in A_table_names.intersection(B_table_names): |
|
200 | for table_name in A_table_names.intersection(B_table_names): | |
201 |
|
201 | |||
202 | td = TableDiff() |
|
202 | td = TableDiff() | |
203 |
|
203 | |||
204 | A_table = metadataA.tables[table_name] |
|
204 | A_table = metadataA.tables[table_name] | |
205 | B_table = metadataB.tables[table_name] |
|
205 | B_table = metadataB.tables[table_name] | |
206 |
|
206 | |||
207 | A_column_names = set(A_table.columns.keys()) |
|
207 | A_column_names = set(A_table.columns.keys()) | |
208 | B_column_names = set(B_table.columns.keys()) |
|
208 | B_column_names = set(B_table.columns.keys()) | |
209 |
|
209 | |||
210 | td.columns_missing_from_A = sorted( |
|
210 | td.columns_missing_from_A = sorted( | |
211 | B_column_names - A_column_names |
|
211 | B_column_names - A_column_names | |
212 | ) |
|
212 | ) | |
213 |
|
213 | |||
214 | td.columns_missing_from_B = sorted( |
|
214 | td.columns_missing_from_B = sorted( | |
215 | A_column_names - B_column_names |
|
215 | A_column_names - B_column_names | |
216 | ) |
|
216 | ) | |
217 |
|
217 | |||
218 | td.columns_different = {} |
|
218 | td.columns_different = {} | |
219 |
|
219 | |||
220 | for col_name in A_column_names.intersection(B_column_names): |
|
220 | for col_name in A_column_names.intersection(B_column_names): | |
@@ -226,7 +226,7 b' class SchemaDiff(object):' | |||||
226 |
|
226 | |||
227 | if cd: |
|
227 | if cd: | |
228 | td.columns_different[col_name]=cd |
|
228 | td.columns_different[col_name]=cd | |
229 |
|
229 | |||
230 | # XXX - index and constraint differences should |
|
230 | # XXX - index and constraint differences should | |
231 | # be checked for here |
|
231 | # be checked for here | |
232 |
|
232 | |||
@@ -237,7 +237,7 b' class SchemaDiff(object):' | |||||
237 | ''' Summarize differences. ''' |
|
237 | ''' Summarize differences. ''' | |
238 | out = [] |
|
238 | out = [] | |
239 | column_template =' %%%is: %%r' % self.label_width |
|
239 | column_template =' %%%is: %%r' % self.label_width | |
240 |
|
240 | |||
241 | for names,label in ( |
|
241 | for names,label in ( | |
242 | (self.tables_missing_from_A,self.labelA), |
|
242 | (self.tables_missing_from_A,self.labelA), | |
243 | (self.tables_missing_from_B,self.labelB), |
|
243 | (self.tables_missing_from_B,self.labelB), | |
@@ -248,7 +248,7 b' class SchemaDiff(object):' | |||||
248 | label,', '.join(sorted(names)) |
|
248 | label,', '.join(sorted(names)) | |
249 | ) |
|
249 | ) | |
250 | ) |
|
250 | ) | |
251 |
|
251 | |||
252 | for name,td in sorted(self.tables_different.items()): |
|
252 | for name,td in sorted(self.tables_different.items()): | |
253 | out.append( |
|
253 | out.append( | |
254 | ' table with differences: %s' % name |
|
254 | ' table with differences: %s' % name | |
@@ -267,7 +267,7 b' class SchemaDiff(object):' | |||||
267 | out.append(' column with differences: %s' % name) |
|
267 | out.append(' column with differences: %s' % name) | |
268 | out.append(column_template % (self.labelA,cd.col_A)) |
|
268 | out.append(column_template % (self.labelA,cd.col_A)) | |
269 | out.append(column_template % (self.labelB,cd.col_B)) |
|
269 | out.append(column_template % (self.labelB,cd.col_B)) | |
270 |
|
270 | |||
271 | if out: |
|
271 | if out: | |
272 | out.insert(0, 'Schema diffs:') |
|
272 | out.insert(0, 'Schema diffs:') | |
273 | return '\n'.join(out) |
|
273 | return '\n'.join(out) |
@@ -28,7 +28,7 b' class BaseScript(pathed.Pathed):' | |||||
28 | self.verify(path) |
|
28 | self.verify(path) | |
29 | super(BaseScript, self).__init__(path) |
|
29 | super(BaseScript, self).__init__(path) | |
30 | log.debug('Script %s loaded successfully' % path) |
|
30 | log.debug('Script %s loaded successfully' % path) | |
31 |
|
31 | |||
32 | @classmethod |
|
32 | @classmethod | |
33 | def verify(cls, path): |
|
33 | def verify(cls, path): | |
34 | """Ensure this is a valid script |
|
34 | """Ensure this is a valid script |
@@ -25,7 +25,7 b' class PythonScript(base.BaseScript):' | |||||
25 | @classmethod |
|
25 | @classmethod | |
26 | def create(cls, path, **opts): |
|
26 | def create(cls, path, **opts): | |
27 | """Create an empty migration script at specified path |
|
27 | """Create an empty migration script at specified path | |
28 |
|
28 | |||
29 | :returns: :class:`PythonScript instance <migrate.versioning.script.py.PythonScript>`""" |
|
29 | :returns: :class:`PythonScript instance <migrate.versioning.script.py.PythonScript>`""" | |
30 | cls.require_notfound(path) |
|
30 | cls.require_notfound(path) | |
31 |
|
31 | |||
@@ -38,7 +38,7 b' class PythonScript(base.BaseScript):' | |||||
38 | def make_update_script_for_model(cls, engine, oldmodel, |
|
38 | def make_update_script_for_model(cls, engine, oldmodel, | |
39 | model, repository, **opts): |
|
39 | model, repository, **opts): | |
40 | """Create a migration script based on difference between two SA models. |
|
40 | """Create a migration script based on difference between two SA models. | |
41 |
|
41 | |||
42 | :param repository: path to migrate repository |
|
42 | :param repository: path to migrate repository | |
43 | :param oldmodel: dotted.module.name:SAClass or SAClass object |
|
43 | :param oldmodel: dotted.module.name:SAClass or SAClass object | |
44 | :param model: dotted.module.name:SAClass or SAClass object |
|
44 | :param model: dotted.module.name:SAClass or SAClass object | |
@@ -50,7 +50,7 b' class PythonScript(base.BaseScript):' | |||||
50 | :returns: Upgrade / Downgrade script |
|
50 | :returns: Upgrade / Downgrade script | |
51 | :rtype: string |
|
51 | :rtype: string | |
52 | """ |
|
52 | """ | |
53 |
|
53 | |||
54 | if isinstance(repository, basestring): |
|
54 | if isinstance(repository, basestring): | |
55 | # oh dear, an import cycle! |
|
55 | # oh dear, an import cycle! | |
56 | from rhodecode.lib.dbmigrate.migrate.versioning.repository import Repository |
|
56 | from rhodecode.lib.dbmigrate.migrate.versioning.repository import Repository | |
@@ -86,7 +86,7 b' class PythonScript(base.BaseScript):' | |||||
86 | @classmethod |
|
86 | @classmethod | |
87 | def verify_module(cls, path): |
|
87 | def verify_module(cls, path): | |
88 | """Ensure path is a valid script |
|
88 | """Ensure path is a valid script | |
89 |
|
89 | |||
90 | :param path: Script location |
|
90 | :param path: Script location | |
91 | :type path: string |
|
91 | :type path: string | |
92 | :raises: :exc:`InvalidScriptError <migrate.exceptions.InvalidScriptError>` |
|
92 | :raises: :exc:`InvalidScriptError <migrate.exceptions.InvalidScriptError>` | |
@@ -101,7 +101,7 b' class PythonScript(base.BaseScript):' | |||||
101 | return module |
|
101 | return module | |
102 |
|
102 | |||
103 | def preview_sql(self, url, step, **args): |
|
103 | def preview_sql(self, url, step, **args): | |
104 |
"""Mocks SQLAlchemy Engine to store all executed calls in a string |
|
104 | """Mocks SQLAlchemy Engine to store all executed calls in a string | |
105 | and runs :meth:`PythonScript.run <migrate.versioning.script.py.PythonScript.run>` |
|
105 | and runs :meth:`PythonScript.run <migrate.versioning.script.py.PythonScript.run>` | |
106 |
|
106 | |||
107 | :returns: SQL file |
|
107 | :returns: SQL file | |
@@ -119,7 +119,7 b' class PythonScript(base.BaseScript):' | |||||
119 | return go(url, step, **args) |
|
119 | return go(url, step, **args) | |
120 |
|
120 | |||
121 | def run(self, engine, step): |
|
121 | def run(self, engine, step): | |
122 |
"""Core method of Script file. |
|
122 | """Core method of Script file. | |
123 | Exectues :func:`update` or :func:`downgrade` functions |
|
123 | Exectues :func:`update` or :func:`downgrade` functions | |
124 |
|
124 | |||
125 | :param engine: SQLAlchemy Engine |
|
125 | :param engine: SQLAlchemy Engine |
@@ -15,7 +15,7 b' class SqlScript(base.BaseScript):' | |||||
15 | @classmethod |
|
15 | @classmethod | |
16 | def create(cls, path, **opts): |
|
16 | def create(cls, path, **opts): | |
17 | """Create an empty migration script at specified path |
|
17 | """Create an empty migration script at specified path | |
18 |
|
18 | |||
19 | :returns: :class:`SqlScript instance <migrate.versioning.script.sql.SqlScript>`""" |
|
19 | :returns: :class:`SqlScript instance <migrate.versioning.script.sql.SqlScript>`""" | |
20 | cls.require_notfound(path) |
|
20 | cls.require_notfound(path) | |
21 |
|
21 |
@@ -33,7 +33,7 b' class SQLScriptCollection(Collection):' | |||||
33 |
|
33 | |||
34 | class Template(pathed.Pathed): |
|
34 | class Template(pathed.Pathed): | |
35 | """Finds the paths/packages of various Migrate templates. |
|
35 | """Finds the paths/packages of various Migrate templates. | |
36 |
|
36 | |||
37 | :param path: Templates are loaded from rhodecode.lib.dbmigrate.migrate package |
|
37 | :param path: Templates are loaded from rhodecode.lib.dbmigrate.migrate package | |
38 | if `path` is not provided. |
|
38 | if `path` is not provided. | |
39 | """ |
|
39 | """ | |
@@ -66,7 +66,7 b' class Template(pathed.Pathed):' | |||||
66 |
|
66 | |||
67 | def _get_item(self, collection, theme=None): |
|
67 | def _get_item(self, collection, theme=None): | |
68 | """Locates and returns collection. |
|
68 | """Locates and returns collection. | |
69 |
|
69 | |||
70 | :param collection: name of collection to locate |
|
70 | :param collection: name of collection to locate | |
71 | :param type_: type of subfolder in collection (defaults to "_default") |
|
71 | :param type_: type of subfolder in collection (defaults to "_default") | |
72 | :returns: (package, source) |
|
72 | :returns: (package, source) | |
@@ -80,7 +80,7 b' class Template(pathed.Pathed):' | |||||
80 | def get_repository(self, *a, **kw): |
|
80 | def get_repository(self, *a, **kw): | |
81 | """Calls self._get_item('repository', *a, **kw)""" |
|
81 | """Calls self._get_item('repository', *a, **kw)""" | |
82 | return self._get_item('repository', *a, **kw) |
|
82 | return self._get_item('repository', *a, **kw) | |
83 |
|
83 | |||
84 | def get_script(self, *a, **kw): |
|
84 | def get_script(self, *a, **kw): | |
85 | """Calls self._get_item('script', *a, **kw)""" |
|
85 | """Calls self._get_item('script', *a, **kw)""" | |
86 | return self._get_item('script', *a, **kw) |
|
86 | return self._get_item('script', *a, **kw) |
@@ -22,7 +22,7 b' def load_model(dotted_name):' | |||||
22 | """Import module and use module-level variable". |
|
22 | """Import module and use module-level variable". | |
23 |
|
23 | |||
24 | :param dotted_name: path to model in form of string: ``some.python.module:Class`` |
|
24 | :param dotted_name: path to model in form of string: ``some.python.module:Class`` | |
25 |
|
25 | |||
26 | .. versionchanged:: 0.5.4 |
|
26 | .. versionchanged:: 0.5.4 | |
27 |
|
27 | |||
28 | """ |
|
28 | """ | |
@@ -54,9 +54,9 b' def asbool(obj):' | |||||
54 |
|
54 | |||
55 | def guess_obj_type(obj): |
|
55 | def guess_obj_type(obj): | |
56 | """Do everything to guess object type from string |
|
56 | """Do everything to guess object type from string | |
57 |
|
57 | |||
58 | Tries to convert to `int`, `bool` and finally returns if not succeded. |
|
58 | Tries to convert to `int`, `bool` and finally returns if not succeded. | |
59 |
|
59 | |||
60 | .. versionadded: 0.5.4 |
|
60 | .. versionadded: 0.5.4 | |
61 | """ |
|
61 | """ | |
62 |
|
62 | |||
@@ -81,7 +81,7 b' def guess_obj_type(obj):' | |||||
81 | @decorator |
|
81 | @decorator | |
82 | def catch_known_errors(f, *a, **kw): |
|
82 | def catch_known_errors(f, *a, **kw): | |
83 | """Decorator that catches known api errors |
|
83 | """Decorator that catches known api errors | |
84 |
|
84 | |||
85 | .. versionadded: 0.5.4 |
|
85 | .. versionadded: 0.5.4 | |
86 | """ |
|
86 | """ | |
87 |
|
87 |
@@ -3,7 +3,7 b' import sys' | |||||
3 |
|
3 | |||
4 | def import_path(fullpath): |
|
4 | def import_path(fullpath): | |
5 | """ Import a file with full path specification. Allows one to |
|
5 | """ Import a file with full path specification. Allows one to | |
6 |
import from anywhere, something __import__ does not do. |
|
6 | import from anywhere, something __import__ does not do. | |
7 | """ |
|
7 | """ | |
8 | # http://zephyrfalcon.org/weblog/arch_d7_2002_08_31.html |
|
8 | # http://zephyrfalcon.org/weblog/arch_d7_2002_08_31.html | |
9 | path, filename = os.path.split(fullpath) |
|
9 | path, filename = os.path.split(fullpath) | |
@@ -13,4 +13,3 b' def import_path(fullpath):' | |||||
13 | reload(module) # Might be out of date during tests |
|
13 | reload(module) # Might be out of date during tests | |
14 | del sys.path[-1] |
|
14 | del sys.path[-1] | |
15 | return module |
|
15 | return module | |
16 |
|
@@ -4,7 +4,7 b'' | |||||
4 | class KeyedInstance(object): |
|
4 | class KeyedInstance(object): | |
5 | """A class whose instances have a unique identifier of some sort |
|
5 | """A class whose instances have a unique identifier of some sort | |
6 | No two instances with the same unique ID should exist - if we try to create |
|
6 | No two instances with the same unique ID should exist - if we try to create | |
7 |
a second instance, the first should be returned. |
|
7 | a second instance, the first should be returned. | |
8 | """ |
|
8 | """ | |
9 |
|
9 | |||
10 | _instances = dict() |
|
10 | _instances = dict() | |
@@ -24,7 +24,7 b' class KeyedInstance(object):' | |||||
24 | @classmethod |
|
24 | @classmethod | |
25 | def _key(cls, *p, **k): |
|
25 | def _key(cls, *p, **k): | |
26 | """Given a unique identifier, return a dictionary key |
|
26 | """Given a unique identifier, return a dictionary key | |
27 |
This should be overridden by child classes, to specify which parameters |
|
27 | This should be overridden by child classes, to specify which parameters | |
28 | should determine an object's uniqueness |
|
28 | should determine an object's uniqueness | |
29 | """ |
|
29 | """ | |
30 | raise NotImplementedError() |
|
30 | raise NotImplementedError() |
@@ -59,7 +59,7 b' class Collection(pathed.Pathed):' | |||||
59 | and store them in self.versions |
|
59 | and store them in self.versions | |
60 | """ |
|
60 | """ | |
61 | super(Collection, self).__init__(path) |
|
61 | super(Collection, self).__init__(path) | |
62 |
|
62 | |||
63 | # Create temporary list of files, allowing skipped version numbers. |
|
63 | # Create temporary list of files, allowing skipped version numbers. | |
64 | files = os.listdir(path) |
|
64 | files = os.listdir(path) | |
65 | if '1' in files: |
|
65 | if '1' in files: | |
@@ -104,7 +104,7 b' class Collection(pathed.Pathed):' | |||||
104 |
|
104 | |||
105 | script.PythonScript.create(filepath, **k) |
|
105 | script.PythonScript.create(filepath, **k) | |
106 | self.versions[ver] = Version(ver, self.path, [filename]) |
|
106 | self.versions[ver] = Version(ver, self.path, [filename]) | |
107 |
|
107 | |||
108 | def create_new_sql_version(self, database, **k): |
|
108 | def create_new_sql_version(self, database, **k): | |
109 | """Create SQL files for new version""" |
|
109 | """Create SQL files for new version""" | |
110 | ver = self.latest + 1 |
|
110 | ver = self.latest + 1 | |
@@ -116,7 +116,7 b' class Collection(pathed.Pathed):' | |||||
116 | filepath = self._version_path(filename) |
|
116 | filepath = self._version_path(filename) | |
117 | script.SqlScript.create(filepath, **k) |
|
117 | script.SqlScript.create(filepath, **k) | |
118 | self.versions[ver].add_script(filepath) |
|
118 | self.versions[ver].add_script(filepath) | |
119 |
|
119 | |||
120 | def version(self, vernum=None): |
|
120 | def version(self, vernum=None): | |
121 | """Returns latest Version if vernum is not given. |
|
121 | """Returns latest Version if vernum is not given. | |
122 | Otherwise, returns wanted version""" |
|
122 | Otherwise, returns wanted version""" | |
@@ -135,7 +135,7 b' class Collection(pathed.Pathed):' | |||||
135 |
|
135 | |||
136 | class Version(object): |
|
136 | class Version(object): | |
137 | """A single version in a collection |
|
137 | """A single version in a collection | |
138 |
:param vernum: Version Number |
|
138 | :param vernum: Version Number | |
139 | :param path: Path to script files |
|
139 | :param path: Path to script files | |
140 | :param filelist: List of scripts |
|
140 | :param filelist: List of scripts | |
141 | :type vernum: int, VerNum |
|
141 | :type vernum: int, VerNum | |
@@ -152,7 +152,7 b' class Version(object):' | |||||
152 |
|
152 | |||
153 | for script in filelist: |
|
153 | for script in filelist: | |
154 | self.add_script(os.path.join(path, script)) |
|
154 | self.add_script(os.path.join(path, script)) | |
155 |
|
155 | |||
156 | def script(self, database=None, operation=None): |
|
156 | def script(self, database=None, operation=None): | |
157 | """Returns SQL or Python Script""" |
|
157 | """Returns SQL or Python Script""" | |
158 | for db in (database, 'default'): |
|
158 | for db in (database, 'default'): |
@@ -13,7 +13,7 b' from rhodecode.lib.dbmigrate.migrate.cha' | |||||
13 | log = logging.getLogger(__name__) |
|
13 | log = logging.getLogger(__name__) | |
14 |
|
14 | |||
15 | def upgrade(migrate_engine): |
|
15 | def upgrade(migrate_engine): | |
16 |
""" Upgrade operations go here. |
|
16 | """ Upgrade operations go here. | |
17 | Don't create your own engine; bind migrate_engine to your metadata |
|
17 | Don't create your own engine; bind migrate_engine to your metadata | |
18 | """ |
|
18 | """ | |
19 |
|
19 | |||
@@ -32,7 +32,7 b' def upgrade(migrate_engine):' | |||||
32 |
|
32 | |||
33 | #========================================================================== |
|
33 | #========================================================================== | |
34 | # Upgrade of `user_logs` table |
|
34 | # Upgrade of `user_logs` table | |
35 |
#========================================================================== |
|
35 | #========================================================================== | |
36 |
|
36 | |||
37 | tblname = 'users' |
|
37 | tblname = 'users' | |
38 | tbl = Table(tblname, MetaData(bind=migrate_engine), autoload=True, |
|
38 | tbl = Table(tblname, MetaData(bind=migrate_engine), autoload=True, | |
@@ -48,7 +48,7 b' def upgrade(migrate_engine):' | |||||
48 |
|
48 | |||
49 | #========================================================================== |
|
49 | #========================================================================== | |
50 | # Upgrade of `repositories` table |
|
50 | # Upgrade of `repositories` table | |
51 |
#========================================================================== |
|
51 | #========================================================================== | |
52 | tblname = 'repositories' |
|
52 | tblname = 'repositories' | |
53 | tbl = Table(tblname, MetaData(bind=migrate_engine), autoload=True, |
|
53 | tbl = Table(tblname, MetaData(bind=migrate_engine), autoload=True, | |
54 | autoload_with=migrate_engine) |
|
54 | autoload_with=migrate_engine) | |
@@ -84,7 +84,7 b' def upgrade(migrate_engine):' | |||||
84 |
|
84 | |||
85 | follows_user = relation('User', primaryjoin='User.user_id==UserFollowing.follows_user_id') |
|
85 | follows_user = relation('User', primaryjoin='User.user_id==UserFollowing.follows_user_id') | |
86 | follows_repository = relation('Repository') |
|
86 | follows_repository = relation('Repository') | |
87 |
|
87 | |||
88 | UserFollowing().__table__.create() |
|
88 | UserFollowing().__table__.create() | |
89 |
|
89 | |||
90 | #========================================================================== |
|
90 | #========================================================================== | |
@@ -113,5 +113,3 b' def upgrade(migrate_engine):' | |||||
113 | def downgrade(migrate_engine): |
|
113 | def downgrade(migrate_engine): | |
114 | meta = MetaData() |
|
114 | meta = MetaData() | |
115 | meta.bind = migrate_engine |
|
115 | meta.bind = migrate_engine | |
116 |
|
||||
117 |
|
@@ -15,7 +15,7 b' from rhodecode.model.db import BaseModel' | |||||
15 | log = logging.getLogger(__name__) |
|
15 | log = logging.getLogger(__name__) | |
16 |
|
16 | |||
17 | def upgrade(migrate_engine): |
|
17 | def upgrade(migrate_engine): | |
18 |
""" Upgrade operations go here. |
|
18 | """ Upgrade operations go here. | |
19 | Don't create your own engine; bind migrate_engine to your metadata |
|
19 | Don't create your own engine; bind migrate_engine to your metadata | |
20 | """ |
|
20 | """ | |
21 |
|
21 | |||
@@ -69,7 +69,7 b' def upgrade(migrate_engine):' | |||||
69 |
|
69 | |||
70 | #========================================================================== |
|
70 | #========================================================================== | |
71 | # Upgrade of `repositories` table |
|
71 | # Upgrade of `repositories` table | |
72 |
#========================================================================== |
|
72 | #========================================================================== | |
73 | from rhodecode.model.db import Repository |
|
73 | from rhodecode.model.db import Repository | |
74 |
|
74 | |||
75 | #ADD downloads column# |
|
75 | #ADD downloads column# | |
@@ -96,5 +96,3 b' def upgrade(migrate_engine):' | |||||
96 | def downgrade(migrate_engine): |
|
96 | def downgrade(migrate_engine): | |
97 | meta = MetaData() |
|
97 | meta = MetaData() | |
98 | meta.bind = migrate_engine |
|
98 | meta.bind = migrate_engine | |
99 |
|
||||
100 |
|
@@ -4,22 +4,22 b'' | |||||
4 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|
4 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
5 |
|
5 | |||
6 | Package containing new versions of database models |
|
6 | Package containing new versions of database models | |
7 |
|
7 | |||
8 | :created_on: Dec 11, 2010 |
|
8 | :created_on: Dec 11, 2010 | |
9 | :author: marcink |
|
9 | :author: marcink | |
10 |
:copyright: (C) 2009-2011 Marcin Kuzminski <marcin@python-works.com> |
|
10 | :copyright: (C) 2009-2011 Marcin Kuzminski <marcin@python-works.com> | |
11 | :license: GPLv3, see COPYING for more details. |
|
11 | :license: GPLv3, see COPYING for more details. | |
12 | """ |
|
12 | """ | |
13 | # This program is free software; you can redistribute it and/or |
|
13 | # This program is free software; you can redistribute it and/or | |
14 | # modify it under the terms of the GNU General Public License |
|
14 | # modify it under the terms of the GNU General Public License | |
15 | # as published by the Free Software Foundation; version 2 |
|
15 | # as published by the Free Software Foundation; version 2 | |
16 | # of the License or (at your opinion) any later version of the license. |
|
16 | # of the License or (at your opinion) any later version of the license. | |
17 |
# |
|
17 | # | |
18 | # This program is distributed in the hope that it will be useful, |
|
18 | # This program is distributed in the hope that it will be useful, | |
19 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
19 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
20 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
20 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
21 | # GNU General Public License for more details. |
|
21 | # GNU General Public License for more details. | |
22 |
# |
|
22 | # | |
23 | # You should have received a copy of the GNU General Public License |
|
23 | # You should have received a copy of the GNU General Public License | |
24 | # along with this program; if not, write to the Free Software |
|
24 | # along with this program; if not, write to the Free Software | |
25 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
25 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
@@ -7,12 +7,12 b'' | |||||
7 | # modify it under the terms of the GNU General Public License |
|
7 | # modify it under the terms of the GNU General Public License | |
8 | # as published by the Free Software Foundation; version 2 |
|
8 | # as published by the Free Software Foundation; version 2 | |
9 | # of the License or (at your opinion) any later version of the license. |
|
9 | # of the License or (at your opinion) any later version of the license. | |
10 |
# |
|
10 | # | |
11 | # This program is distributed in the hope that it will be useful, |
|
11 | # This program is distributed in the hope that it will be useful, | |
12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 | # GNU General Public License for more details. |
|
14 | # GNU General Public License for more details. | |
15 |
# |
|
15 | # | |
16 | # You should have received a copy of the GNU General Public License |
|
16 | # You should have received a copy of the GNU General Public License | |
17 | # along with this program; if not, write to the Free Software |
|
17 | # along with this program; if not, write to the Free Software | |
18 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
18 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
@@ -69,7 +69,7 b' def get_token():' | |||||
69 | class _GetError(object): |
|
69 | class _GetError(object): | |
70 | """Get error from form_errors, and represent it as span wrapped error |
|
70 | """Get error from form_errors, and represent it as span wrapped error | |
71 | message |
|
71 | message | |
72 |
|
72 | |||
73 | :param field_name: field to fetch errors for |
|
73 | :param field_name: field to fetch errors for | |
74 | :param form_errors: form errors dict |
|
74 | :param form_errors: form errors dict | |
75 | """ |
|
75 | """ | |
@@ -84,9 +84,9 b' get_error = _GetError()' | |||||
84 | class _ToolTip(object): |
|
84 | class _ToolTip(object): | |
85 |
|
85 | |||
86 | def __call__(self, tooltip_title, trim_at=50): |
|
86 | def __call__(self, tooltip_title, trim_at=50): | |
87 |
"""Special function just to wrap our text into nice formatted |
|
87 | """Special function just to wrap our text into nice formatted | |
88 | autowrapped text |
|
88 | autowrapped text | |
89 |
|
89 | |||
90 | :param tooltip_title: |
|
90 | :param tooltip_title: | |
91 | """ |
|
91 | """ | |
92 |
|
92 | |||
@@ -94,7 +94,7 b' class _ToolTip(object):' | |||||
94 | .replace('\n', '<br/>') |
|
94 | .replace('\n', '<br/>') | |
95 |
|
95 | |||
96 | def activate(self): |
|
96 | def activate(self): | |
97 |
"""Adds tooltip mechanism to the given Html all tooltips have to have |
|
97 | """Adds tooltip mechanism to the given Html all tooltips have to have | |
98 | set class `tooltip` and set attribute `tooltip_title`. |
|
98 | set class `tooltip` and set attribute `tooltip_title`. | |
99 | Then a tooltip will be generated based on that. All with yui js tooltip |
|
99 | Then a tooltip will be generated based on that. All with yui js tooltip | |
100 | """ |
|
100 | """ | |
@@ -104,18 +104,18 b' class _ToolTip(object):' | |||||
104 | function toolTipsId(){ |
|
104 | function toolTipsId(){ | |
105 | var ids = []; |
|
105 | var ids = []; | |
106 | var tts = YAHOO.util.Dom.getElementsByClassName('tooltip'); |
|
106 | var tts = YAHOO.util.Dom.getElementsByClassName('tooltip'); | |
107 |
|
107 | |||
108 | for (var i = 0; i < tts.length; i++) { |
|
108 | for (var i = 0; i < tts.length; i++) { | |
109 | //if element doesn't not have and id autogenerate one for tooltip |
|
109 | //if element doesn't not have and id autogenerate one for tooltip | |
110 |
|
110 | |||
111 | if (!tts[i].id){ |
|
111 | if (!tts[i].id){ | |
112 | tts[i].id='tt'+i*100; |
|
112 | tts[i].id='tt'+i*100; | |
113 | } |
|
113 | } | |
114 | ids.push(tts[i].id); |
|
114 | ids.push(tts[i].id); | |
115 | } |
|
115 | } | |
116 |
return ids |
|
116 | return ids | |
117 | }; |
|
117 | }; | |
118 |
var myToolTips = new YAHOO.widget.Tooltip("tooltip", { |
|
118 | var myToolTips = new YAHOO.widget.Tooltip("tooltip", { | |
119 | context: [[toolTipsId()],"tl","bl",null,[0,5]], |
|
119 | context: [[toolTipsId()],"tl","bl",null,[0,5]], | |
120 | monitorresize:false, |
|
120 | monitorresize:false, | |
121 | xyoffset :[0,0], |
|
121 | xyoffset :[0,0], | |
@@ -123,7 +123,7 b' class _ToolTip(object):' | |||||
123 | hidedelay:5, |
|
123 | hidedelay:5, | |
124 | showdelay:20, |
|
124 | showdelay:20, | |
125 | }); |
|
125 | }); | |
126 |
|
126 | |||
127 | }); |
|
127 | }); | |
128 | ''' |
|
128 | ''' | |
129 | return literal(js) |
|
129 | return literal(js) | |
@@ -228,7 +228,7 b' class CodeHtmlFormatter(HtmlFormatter):' | |||||
228 |
|
228 | |||
229 | def pygmentize(filenode, **kwargs): |
|
229 | def pygmentize(filenode, **kwargs): | |
230 | """pygmentize function using pygments |
|
230 | """pygmentize function using pygments | |
231 |
|
231 | |||
232 | :param filenode: |
|
232 | :param filenode: | |
233 | """ |
|
233 | """ | |
234 |
|
234 | |||
@@ -237,15 +237,15 b' def pygmentize(filenode, **kwargs):' | |||||
237 |
|
237 | |||
238 | def pygmentize_annotation(repo_name, filenode, **kwargs): |
|
238 | def pygmentize_annotation(repo_name, filenode, **kwargs): | |
239 | """pygmentize function for annotation |
|
239 | """pygmentize function for annotation | |
240 |
|
240 | |||
241 | :param filenode: |
|
241 | :param filenode: | |
242 | """ |
|
242 | """ | |
243 |
|
243 | |||
244 | color_dict = {} |
|
244 | color_dict = {} | |
245 | def gen_color(n=10000): |
|
245 | def gen_color(n=10000): | |
246 |
"""generator for getting n of evenly distributed colors using |
|
246 | """generator for getting n of evenly distributed colors using | |
247 | hsv color and golden ratio. It always return same order of colors |
|
247 | hsv color and golden ratio. It always return same order of colors | |
248 |
|
248 | |||
249 | :returns: RGB tuple |
|
249 | :returns: RGB tuple | |
250 | """ |
|
250 | """ | |
251 | import colorsys |
|
251 | import colorsys | |
@@ -356,7 +356,7 b' short_id = lambda x: x[:12]' | |||||
356 | def bool2icon(value): |
|
356 | def bool2icon(value): | |
357 | """Returns True/False values represented as small html image of true/false |
|
357 | """Returns True/False values represented as small html image of true/false | |
358 | icons |
|
358 | icons | |
359 |
|
359 | |||
360 | :param value: bool value |
|
360 | :param value: bool value | |
361 | """ |
|
361 | """ | |
362 |
|
362 | |||
@@ -374,7 +374,7 b' def bool2icon(value):' | |||||
374 | def action_parser(user_log, feed=False): |
|
374 | def action_parser(user_log, feed=False): | |
375 | """This helper will action_map the specified string action into translated |
|
375 | """This helper will action_map the specified string action into translated | |
376 | fancy names with icons and links |
|
376 | fancy names with icons and links | |
377 |
|
377 | |||
378 | :param user_log: user log instance |
|
378 | :param user_log: user log instance | |
379 | :param feed: use output for feeds (no html and fancy icons) |
|
379 | :param feed: use output for feeds (no html and fancy icons) | |
380 | """ |
|
380 | """ | |
@@ -638,5 +638,3 b' def repo_link(groups_and_repos):' | |||||
638 | return link_to(group.group_name, url('repos_group', id=group.group_id)) |
|
638 | return link_to(group.group_name, url('repos_group', id=group.group_id)) | |
639 | return literal(' » '.join(map(make_link, groups)) + \ |
|
639 | return literal(' » '.join(map(make_link, groups)) + \ | |
640 | " » " + repo_name) |
|
640 | " » " + repo_name) | |
641 |
|
||||
642 |
|
@@ -4,22 +4,22 b'' | |||||
4 | ~~~~~~~~~~~~~~~~~~~ |
|
4 | ~~~~~~~~~~~~~~~~~~~ | |
5 |
|
5 | |||
6 | Hooks runned by rhodecode |
|
6 | Hooks runned by rhodecode | |
7 |
|
7 | |||
8 | :created_on: Aug 6, 2010 |
|
8 | :created_on: Aug 6, 2010 | |
9 | :author: marcink |
|
9 | :author: marcink | |
10 |
:copyright: (C) 2009-2011 Marcin Kuzminski <marcin@python-works.com> |
|
10 | :copyright: (C) 2009-2011 Marcin Kuzminski <marcin@python-works.com> | |
11 | :license: GPLv3, see COPYING for more details. |
|
11 | :license: GPLv3, see COPYING for more details. | |
12 | """ |
|
12 | """ | |
13 | # This program is free software; you can redistribute it and/or |
|
13 | # This program is free software; you can redistribute it and/or | |
14 | # modify it under the terms of the GNU General Public License |
|
14 | # modify it under the terms of the GNU General Public License | |
15 | # as published by the Free Software Foundation; version 2 |
|
15 | # as published by the Free Software Foundation; version 2 | |
16 | # of the License or (at your opinion) any later version of the license. |
|
16 | # of the License or (at your opinion) any later version of the license. | |
17 |
# |
|
17 | # | |
18 | # This program is distributed in the hope that it will be useful, |
|
18 | # This program is distributed in the hope that it will be useful, | |
19 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
19 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
20 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
20 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
21 | # GNU General Public License for more details. |
|
21 | # GNU General Public License for more details. | |
22 |
# |
|
22 | # | |
23 | # You should have received a copy of the GNU General Public License |
|
23 | # You should have received a copy of the GNU General Public License | |
24 | # along with this program; if not, write to the Free Software |
|
24 | # along with this program; if not, write to the Free Software | |
25 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
25 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, | |
@@ -36,7 +36,7 b' from rhodecode.lib.utils import action_l' | |||||
36 |
|
36 | |||
37 | def repo_size(ui, repo, hooktype=None, **kwargs): |
|
37 | def repo_size(ui, repo, hooktype=None, **kwargs): | |
38 | """Presents size of repository after push |
|
38 | """Presents size of repository after push | |
39 |
|
39 | |||
40 | :param ui: |
|
40 | :param ui: | |
41 | :param repo: |
|
41 | :param repo: | |
42 | :param hooktype: |
|
42 | :param hooktype: | |
@@ -67,7 +67,7 b' def repo_size(ui, repo, hooktype=None, *' | |||||
67 |
|
67 | |||
68 | def log_pull_action(ui, repo, **kwargs): |
|
68 | def log_pull_action(ui, repo, **kwargs): | |
69 | """Logs user last pull action |
|
69 | """Logs user last pull action | |
70 |
|
70 | |||
71 | :param ui: |
|
71 | :param ui: | |
72 | :param repo: |
|
72 | :param repo: | |
73 | """ |
|
73 | """ | |
@@ -83,7 +83,7 b' def log_pull_action(ui, repo, **kwargs):' | |||||
83 |
|
83 | |||
84 | def log_push_action(ui, repo, **kwargs): |
|
84 | def log_push_action(ui, repo, **kwargs): | |
85 | """Maps user last push action to new changeset id, from mercurial |
|
85 | """Maps user last push action to new changeset id, from mercurial | |
86 |
|
86 | |||
87 | :param ui: |
|
87 | :param ui: | |
88 | :param repo: |
|
88 | :param repo: | |
89 | """ |
|
89 | """ | |
@@ -113,4 +113,3 b' def log_push_action(ui, repo, **kwargs):' | |||||
113 | action_logger(username, action, repository, extra_params['ip']) |
|
113 | action_logger(username, action, repository, extra_params['ip']) | |
114 |
|
114 | |||
115 | return 0 |
|
115 | return 0 | |
116 |
|
@@ -4,22 +4,22 b'' | |||||
4 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|
4 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
5 |
|
5 | |||
6 | Whoosh indexing module for RhodeCode |
|
6 | Whoosh indexing module for RhodeCode | |
7 |
|
7 | |||
8 | :created_on: Aug 17, 2010 |
|
8 | :created_on: Aug 17, 2010 | |
9 | :author: marcink |
|
9 | :author: marcink | |
10 |
:copyright: (C) 2009-2010 Marcin Kuzminski <marcin@python-works.com> |
|
10 | :copyright: (C) 2009-2010 Marcin Kuzminski <marcin@python-works.com> | |
11 | :license: GPLv3, see COPYING for more details. |
|
11 | :license: GPLv3, see COPYING for more details. | |
12 | """ |
|
12 | """ | |
13 | # This program is free software; you can redistribute it and/or |
|
13 | # This program is free software; you can redistribute it and/or | |
14 | # modify it under the terms of the GNU General Public License |
|
14 | # modify it under the terms of the GNU General Public License | |
15 | # as published by the Free Software Foundation; version 2 |
|
15 | # as published by the Free Software Foundation; version 2 | |
16 | # of the License or (at your opinion) any later version of the license. |
|
16 | # of the License or (at your opinion) any later version of the license. | |
17 |
# |
|
17 | # | |
18 | # This program is distributed in the hope that it will be useful, |
|
18 | # This program is distributed in the hope that it will be useful, | |
19 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
19 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
20 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
20 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
21 | # GNU General Public License for more details. |
|
21 | # GNU General Public License for more details. | |
22 |
# |
|
22 | # | |
23 | # You should have received a copy of the GNU General Public License |
|
23 | # You should have received a copy of the GNU General Public License | |
24 | # along with this program; if not, write to the Free Software |
|
24 | # along with this program; if not, write to the Free Software | |
25 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
25 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
@@ -4,22 +4,22 b'' | |||||
4 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|
4 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
5 |
|
5 | |||
6 | middleware to handle https correctly |
|
6 | middleware to handle https correctly | |
7 |
|
7 | |||
8 | :created_on: May 23, 2010 |
|
8 | :created_on: May 23, 2010 | |
9 | :author: marcink |
|
9 | :author: marcink | |
10 |
:copyright: (C) 2009-2011 Marcin Kuzminski <marcin@python-works.com> |
|
10 | :copyright: (C) 2009-2011 Marcin Kuzminski <marcin@python-works.com> | |
11 | :license: GPLv3, see COPYING for more details. |
|
11 | :license: GPLv3, see COPYING for more details. | |
12 | """ |
|
12 | """ | |
13 | # This program is free software; you can redistribute it and/or |
|
13 | # This program is free software; you can redistribute it and/or | |
14 | # modify it under the terms of the GNU General Public License |
|
14 | # modify it under the terms of the GNU General Public License | |
15 | # as published by the Free Software Foundation; version 2 |
|
15 | # as published by the Free Software Foundation; version 2 | |
16 | # of the License or (at your opinion) any later version of the license. |
|
16 | # of the License or (at your opinion) any later version of the license. | |
17 |
# |
|
17 | # | |
18 | # This program is distributed in the hope that it will be useful, |
|
18 | # This program is distributed in the hope that it will be useful, | |
19 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
19 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
20 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
20 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
21 | # GNU General Public License for more details. |
|
21 | # GNU General Public License for more details. | |
22 |
# |
|
22 | # | |
23 | # You should have received a copy of the GNU General Public License |
|
23 | # You should have received a copy of the GNU General Public License | |
24 | # along with this program; if not, write to the Free Software |
|
24 | # along with this program; if not, write to the Free Software | |
25 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
25 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, | |
@@ -39,7 +39,7 b' class HttpsFixup(object):' | |||||
39 |
|
39 | |||
40 | def __fixup(self, environ): |
|
40 | def __fixup(self, environ): | |
41 | """Function to fixup the environ as needed. In order to use this |
|
41 | """Function to fixup the environ as needed. In order to use this | |
42 |
middleware you should set this header inside your |
|
42 | middleware you should set this header inside your | |
43 | proxy ie. nginx, apache etc. |
|
43 | proxy ie. nginx, apache etc. | |
44 | """ |
|
44 | """ | |
45 | proto = environ.get('HTTP_X_URL_SCHEME') |
|
45 | proto = environ.get('HTTP_X_URL_SCHEME') |
@@ -4,23 +4,23 b'' | |||||
4 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|
4 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
5 |
|
5 | |||
6 | SimpleGit middleware for handling git protocol request (push/clone etc.) |
|
6 | SimpleGit middleware for handling git protocol request (push/clone etc.) | |
7 |
It's implemented with basic auth function |
|
7 | It's implemented with basic auth function | |
8 |
|
8 | |||
9 | :created_on: Apr 28, 2010 |
|
9 | :created_on: Apr 28, 2010 | |
10 | :author: marcink |
|
10 | :author: marcink | |
11 |
:copyright: (C) 2009-2010 Marcin Kuzminski <marcin@python-works.com> |
|
11 | :copyright: (C) 2009-2010 Marcin Kuzminski <marcin@python-works.com> | |
12 | :license: GPLv3, see COPYING for more details. |
|
12 | :license: GPLv3, see COPYING for more details. | |
13 | """ |
|
13 | """ | |
14 | # This program is free software; you can redistribute it and/or |
|
14 | # This program is free software; you can redistribute it and/or | |
15 | # modify it under the terms of the GNU General Public License |
|
15 | # modify it under the terms of the GNU General Public License | |
16 | # as published by the Free Software Foundation; version 2 |
|
16 | # as published by the Free Software Foundation; version 2 | |
17 | # of the License or (at your opinion) any later version of the license. |
|
17 | # of the License or (at your opinion) any later version of the license. | |
18 |
# |
|
18 | # | |
19 | # This program is distributed in the hope that it will be useful, |
|
19 | # This program is distributed in the hope that it will be useful, | |
20 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
20 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
21 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
21 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
22 | # GNU General Public License for more details. |
|
22 | # GNU General Public License for more details. | |
23 |
# |
|
23 | # | |
24 | # You should have received a copy of the GNU General Public License |
|
24 | # You should have received a copy of the GNU General Public License | |
25 | # along with this program; if not, write to the Free Software |
|
25 | # along with this program; if not, write to the Free Software | |
26 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
26 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, | |
@@ -78,9 +78,9 b' from webob.exc import HTTPNotFound, HTTP' | |||||
78 | log = logging.getLogger(__name__) |
|
78 | log = logging.getLogger(__name__) | |
79 |
|
79 | |||
80 | def is_git(environ): |
|
80 | def is_git(environ): | |
81 |
"""Returns True if request's target is git server. |
|
81 | """Returns True if request's target is git server. | |
82 | ``HTTP_USER_AGENT`` would then have git client version given. |
|
82 | ``HTTP_USER_AGENT`` would then have git client version given. | |
83 |
|
83 | |||
84 | :param environ: |
|
84 | :param environ: | |
85 | """ |
|
85 | """ | |
86 | http_user_agent = environ.get('HTTP_USER_AGENT') |
|
86 | http_user_agent = environ.get('HTTP_USER_AGENT') | |
@@ -93,7 +93,7 b' class SimpleGit(object):' | |||||
93 | def __init__(self, application, config): |
|
93 | def __init__(self, application, config): | |
94 | self.application = application |
|
94 | self.application = application | |
95 | self.config = config |
|
95 | self.config = config | |
96 |
#authenticate this git request using |
|
96 | #authenticate this git request using | |
97 | self.authenticate = AuthBasicAuthenticator('', authfunc) |
|
97 | self.authenticate = AuthBasicAuthenticator('', authfunc) | |
98 | self.ipaddr = '0.0.0.0' |
|
98 | self.ipaddr = '0.0.0.0' | |
99 | self.repository = None |
|
99 | self.repository = None | |
@@ -117,7 +117,7 b' class SimpleGit(object):' | |||||
117 | try: |
|
117 | try: | |
118 | #================================================================== |
|
118 | #================================================================== | |
119 | # GET REPOSITORY NAME |
|
119 | # GET REPOSITORY NAME | |
120 |
#================================================================== |
|
120 | #================================================================== | |
121 | self.repo_name = self.__get_repository(environ) |
|
121 | self.repo_name = self.__get_repository(environ) | |
122 | except: |
|
122 | except: | |
123 | return HTTPInternalServerError()(environ, start_response) |
|
123 | return HTTPInternalServerError()(environ, start_response) | |
@@ -139,7 +139,7 b' class SimpleGit(object):' | |||||
139 | log.debug('Anonymous access is disabled, running ' |
|
139 | log.debug('Anonymous access is disabled, running ' | |
140 | 'authentication') |
|
140 | 'authentication') | |
141 | #============================================================== |
|
141 | #============================================================== | |
142 |
# DEFAULT PERM FAILED OR ANONYMOUS ACCESS IS DISABLED SO WE |
|
142 | # DEFAULT PERM FAILED OR ANONYMOUS ACCESS IS DISABLED SO WE | |
143 | # NEED TO AUTHENTICATE AND ASK FOR AUTH USER PERMISSIONS |
|
143 | # NEED TO AUTHENTICATE AND ASK FOR AUTH USER PERMISSIONS | |
144 | #============================================================== |
|
144 | #============================================================== | |
145 |
|
145 | |||
@@ -211,7 +211,7 b' class SimpleGit(object):' | |||||
211 | def __check_permission(self, action, user, repo_name): |
|
211 | def __check_permission(self, action, user, repo_name): | |
212 | """Checks permissions using action (push/pull) user and repository |
|
212 | """Checks permissions using action (push/pull) user and repository | |
213 | name |
|
213 | name | |
214 |
|
214 | |||
215 | :param action: push or pull action |
|
215 | :param action: push or pull action | |
216 | :param user: user instance |
|
216 | :param user: user instance | |
217 | :param repo_name: repository name |
|
217 | :param repo_name: repository name | |
@@ -235,7 +235,7 b' class SimpleGit(object):' | |||||
235 |
|
235 | |||
236 | def __get_repository(self, environ): |
|
236 | def __get_repository(self, environ): | |
237 | """Get's repository name out of PATH_INFO header |
|
237 | """Get's repository name out of PATH_INFO header | |
238 |
|
238 | |||
239 | :param environ: environ where PATH_INFO is stored |
|
239 | :param environ: environ where PATH_INFO is stored | |
240 | """ |
|
240 | """ | |
241 | try: |
|
241 | try: | |
@@ -254,7 +254,7 b' class SimpleGit(object):' | |||||
254 |
|
254 | |||
255 | def __get_action(self, environ): |
|
255 | def __get_action(self, environ): | |
256 | """Maps git request commands into a pull or push command. |
|
256 | """Maps git request commands into a pull or push command. | |
257 |
|
257 | |||
258 | :param environ: |
|
258 | :param environ: | |
259 | """ |
|
259 | """ | |
260 | service = environ['QUERY_STRING'].split('=') |
|
260 | service = environ['QUERY_STRING'].split('=') |
@@ -3,24 +3,24 b'' | |||||
3 | rhodecode.lib.middleware.simplehg |
|
3 | rhodecode.lib.middleware.simplehg | |
4 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|
4 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
5 |
|
5 | |||
6 |
SimpleHG middleware for handling mercurial protocol request |
|
6 | SimpleHG middleware for handling mercurial protocol request | |
7 | (push/clone etc.). It's implemented with basic auth function |
|
7 | (push/clone etc.). It's implemented with basic auth function | |
8 |
|
8 | |||
9 | :created_on: Apr 28, 2010 |
|
9 | :created_on: Apr 28, 2010 | |
10 | :author: marcink |
|
10 | :author: marcink | |
11 |
:copyright: (C) 2009-2010 Marcin Kuzminski <marcin@python-works.com> |
|
11 | :copyright: (C) 2009-2010 Marcin Kuzminski <marcin@python-works.com> | |
12 | :license: GPLv3, see COPYING for more details. |
|
12 | :license: GPLv3, see COPYING for more details. | |
13 | """ |
|
13 | """ | |
14 | # This program is free software; you can redistribute it and/or |
|
14 | # This program is free software; you can redistribute it and/or | |
15 | # modify it under the terms of the GNU General Public License |
|
15 | # modify it under the terms of the GNU General Public License | |
16 | # as published by the Free Software Foundation; version 2 |
|
16 | # as published by the Free Software Foundation; version 2 | |
17 | # of the License or (at your opinion) any later version of the license. |
|
17 | # of the License or (at your opinion) any later version of the license. | |
18 |
# |
|
18 | # | |
19 | # This program is distributed in the hope that it will be useful, |
|
19 | # This program is distributed in the hope that it will be useful, | |
20 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
20 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
21 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
21 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
22 | # GNU General Public License for more details. |
|
22 | # GNU General Public License for more details. | |
23 |
# |
|
23 | # | |
24 | # You should have received a copy of the GNU General Public License |
|
24 | # You should have received a copy of the GNU General Public License | |
25 | # along with this program; if not, write to the Free Software |
|
25 | # along with this program; if not, write to the Free Software | |
26 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
26 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, | |
@@ -84,7 +84,7 b' class SimpleHg(object):' | |||||
84 | try: |
|
84 | try: | |
85 | #================================================================== |
|
85 | #================================================================== | |
86 | # GET REPOSITORY NAME |
|
86 | # GET REPOSITORY NAME | |
87 |
#================================================================== |
|
87 | #================================================================== | |
88 | self.repo_name = self.__get_repository(environ) |
|
88 | self.repo_name = self.__get_repository(environ) | |
89 | except: |
|
89 | except: | |
90 | return HTTPInternalServerError()(environ, start_response) |
|
90 | return HTTPInternalServerError()(environ, start_response) | |
@@ -106,7 +106,7 b' class SimpleHg(object):' | |||||
106 | log.debug('Anonymous access is disabled, running ' |
|
106 | log.debug('Anonymous access is disabled, running ' | |
107 | 'authentication') |
|
107 | 'authentication') | |
108 | #============================================================== |
|
108 | #============================================================== | |
109 |
# DEFAULT PERM FAILED OR ANONYMOUS ACCESS IS DISABLED SO WE |
|
109 | # DEFAULT PERM FAILED OR ANONYMOUS ACCESS IS DISABLED SO WE | |
110 | # NEED TO AUTHENTICATE AND ASK FOR AUTH USER PERMISSIONS |
|
110 | # NEED TO AUTHENTICATE AND ASK FOR AUTH USER PERMISSIONS | |
111 | #============================================================== |
|
111 | #============================================================== | |
112 |
|
112 | |||
@@ -183,7 +183,7 b' class SimpleHg(object):' | |||||
183 | def __check_permission(self, action, user, repo_name): |
|
183 | def __check_permission(self, action, user, repo_name): | |
184 | """Checks permissions using action (push/pull) user and repository |
|
184 | """Checks permissions using action (push/pull) user and repository | |
185 | name |
|
185 | name | |
186 |
|
186 | |||
187 | :param action: push or pull action |
|
187 | :param action: push or pull action | |
188 | :param user: user instance |
|
188 | :param user: user instance | |
189 | :param repo_name: repository name |
|
189 | :param repo_name: repository name | |
@@ -207,7 +207,7 b' class SimpleHg(object):' | |||||
207 |
|
207 | |||
208 | def __get_repository(self, environ): |
|
208 | def __get_repository(self, environ): | |
209 | """Get's repository name out of PATH_INFO header |
|
209 | """Get's repository name out of PATH_INFO header | |
210 |
|
210 | |||
211 | :param environ: environ where PATH_INFO is stored |
|
211 | :param environ: environ where PATH_INFO is stored | |
212 | """ |
|
212 | """ | |
213 | try: |
|
213 | try: | |
@@ -226,7 +226,7 b' class SimpleHg(object):' | |||||
226 | def __get_action(self, environ): |
|
226 | def __get_action(self, environ): | |
227 | """Maps mercurial request commands into a clone,pull or push command. |
|
227 | """Maps mercurial request commands into a clone,pull or push command. | |
228 | This should always return a valid command string |
|
228 | This should always return a valid command string | |
229 |
|
229 | |||
230 | :param environ: |
|
230 | :param environ: | |
231 | """ |
|
231 | """ | |
232 | mapping = {'changegroup': 'pull', |
|
232 | mapping = {'changegroup': 'pull', |
@@ -12,8 +12,8 b' class ProfilingMiddleware(object):' | |||||
12 | def __init__(self, app): |
|
12 | def __init__(self, app): | |
13 | self.lock = threading.Lock() |
|
13 | self.lock = threading.Lock() | |
14 | self.app = app |
|
14 | self.app = app | |
15 |
|
15 | |||
16 |
|
16 | |||
17 | def __call__(self, environ, start_response): |
|
17 | def __call__(self, environ, start_response): | |
18 | with self.lock: |
|
18 | with self.lock: | |
19 | profiler = cProfile.Profile() |
|
19 | profiler = cProfile.Profile() | |
@@ -41,13 +41,11 b' class ProfilingMiddleware(object):' | |||||
41 | ## Browsers don't mind this. |
|
41 | ## Browsers don't mind this. | |
42 | resp += '<pre style="text-align:left; border-top: 4px dashed red; padding: 1em;">' |
|
42 | resp += '<pre style="text-align:left; border-top: 4px dashed red; padding: 1em;">' | |
43 | resp += cgi.escape(out.getvalue(), True) |
|
43 | resp += cgi.escape(out.getvalue(), True) | |
44 |
|
44 | |||
45 | output = StringIO() |
|
45 | output = StringIO() | |
46 | pprint.pprint(environ, output, depth=3) |
|
46 | pprint.pprint(environ, output, depth=3) | |
47 |
|
47 | |||
48 | resp += cgi.escape(output.getvalue(), True) |
|
48 | resp += cgi.escape(output.getvalue(), True) | |
49 | resp += '</pre>' |
|
49 | resp += '</pre>' | |
50 |
|
50 | |||
51 | return resp |
|
51 | return resp | |
52 |
|
||||
53 |
|
@@ -2,9 +2,9 b'' | |||||
2 | """ |
|
2 | """ | |
3 | rhodecode.lib.smtp_mailer |
|
3 | rhodecode.lib.smtp_mailer | |
4 | ~~~~~~~~~~~~~~~~~~~~~~~~~ |
|
4 | ~~~~~~~~~~~~~~~~~~~~~~~~~ | |
5 |
|
5 | |||
6 | Simple smtp mailer used in RhodeCode |
|
6 | Simple smtp mailer used in RhodeCode | |
7 |
|
7 | |||
8 | :created_on: Sep 13, 2010 |
|
8 | :created_on: Sep 13, 2010 | |
9 | :copyright: (c) 2011 by marcink. |
|
9 | :copyright: (c) 2011 by marcink. | |
10 | :license: LICENSE_NAME, see LICENSE_FILE for more details. |
|
10 | :license: LICENSE_NAME, see LICENSE_FILE for more details. | |
@@ -25,14 +25,14 b' from email import encoders' | |||||
25 |
|
25 | |||
26 | class SmtpMailer(object): |
|
26 | class SmtpMailer(object): | |
27 | """SMTP mailer class |
|
27 | """SMTP mailer class | |
28 |
|
28 | |||
29 | mailer = SmtpMailer(mail_from, user, passwd, mail_server, mail_port, ssl, tls) |
|
29 | mailer = SmtpMailer(mail_from, user, passwd, mail_server, mail_port, ssl, tls) | |
30 |
mailer.send(recipients, subject, body, attachment_files) |
|
30 | mailer.send(recipients, subject, body, attachment_files) | |
31 |
|
31 | |||
32 | :param recipients might be a list of string or single string |
|
32 | :param recipients might be a list of string or single string | |
33 |
:param attachment_files is a dict of {filename:location} |
|
33 | :param attachment_files is a dict of {filename:location} | |
34 |
it tries to guess the mimetype and attach the file |
|
34 | it tries to guess the mimetype and attach the file | |
35 |
|
35 | |||
36 | """ |
|
36 | """ | |
37 |
|
37 | |||
38 | def __init__(self, mail_from, user, passwd, mail_server, |
|
38 | def __init__(self, mail_from, user, passwd, mail_server, | |
@@ -132,7 +132,7 b' class SmtpMailer(object):' | |||||
132 | def get_content(self, msg_file): |
|
132 | def get_content(self, msg_file): | |
133 | """Get content based on type, if content is a string do open first |
|
133 | """Get content based on type, if content is a string do open first | |
134 | else just read because it's a probably open file object |
|
134 | else just read because it's a probably open file object | |
135 |
|
135 | |||
136 | :param msg_file: |
|
136 | :param msg_file: | |
137 | """ |
|
137 | """ | |
138 | if isinstance(msg_file, str): |
|
138 | if isinstance(msg_file, str): |
@@ -4,22 +4,22 b'' | |||||
4 | ~~~~~~~~~~~~~~~~~~~ |
|
4 | ~~~~~~~~~~~~~~~~~~~ | |
5 |
|
5 | |||
6 | Utilities library for RhodeCode |
|
6 | Utilities library for RhodeCode | |
7 |
|
7 | |||
8 | :created_on: Apr 18, 2010 |
|
8 | :created_on: Apr 18, 2010 | |
9 | :author: marcink |
|
9 | :author: marcink | |
10 |
:copyright: (C) 2009-2011 Marcin Kuzminski <marcin@python-works.com> |
|
10 | :copyright: (C) 2009-2011 Marcin Kuzminski <marcin@python-works.com> | |
11 | :license: GPLv3, see COPYING for more details. |
|
11 | :license: GPLv3, see COPYING for more details. | |
12 | """ |
|
12 | """ | |
13 | # This program is free software; you can redistribute it and/or |
|
13 | # This program is free software; you can redistribute it and/or | |
14 | # modify it under the terms of the GNU General Public License |
|
14 | # modify it under the terms of the GNU General Public License | |
15 | # as published by the Free Software Foundation; version 2 |
|
15 | # as published by the Free Software Foundation; version 2 | |
16 | # of the License or (at your opinion) any later version of the license. |
|
16 | # of the License or (at your opinion) any later version of the license. | |
17 |
# |
|
17 | # | |
18 | # This program is distributed in the hope that it will be useful, |
|
18 | # This program is distributed in the hope that it will be useful, | |
19 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
19 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
20 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
20 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
21 | # GNU General Public License for more details. |
|
21 | # GNU General Public License for more details. | |
22 |
# |
|
22 | # | |
23 | # You should have received a copy of the GNU General Public License |
|
23 | # You should have received a copy of the GNU General Public License | |
24 | # along with this program; if not, write to the Free Software |
|
24 | # along with this program; if not, write to the Free Software | |
25 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
25 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, | |
@@ -55,10 +55,10 b' log = logging.getLogger(__name__)' | |||||
55 |
|
55 | |||
56 | def recursive_replace(str, replace=' '): |
|
56 | def recursive_replace(str, replace=' '): | |
57 | """Recursive replace of given sign to just one instance |
|
57 | """Recursive replace of given sign to just one instance | |
58 |
|
58 | |||
59 | :param str: given string |
|
59 | :param str: given string | |
60 | :param replace: char to find and replace multiple instances |
|
60 | :param replace: char to find and replace multiple instances | |
61 |
|
61 | |||
62 | Examples:: |
|
62 | Examples:: | |
63 | >>> recursive_replace("Mighty---Mighty-Bo--sstones",'-') |
|
63 | >>> recursive_replace("Mighty---Mighty-Bo--sstones",'-') | |
64 | 'Mighty-Mighty-Bo-sstones' |
|
64 | 'Mighty-Mighty-Bo-sstones' | |
@@ -91,7 +91,7 b' def get_repo_slug(request):' | |||||
91 | def action_logger(user, action, repo, ipaddr='', sa=None): |
|
91 | def action_logger(user, action, repo, ipaddr='', sa=None): | |
92 | """ |
|
92 | """ | |
93 | Action logger for various actions made by users |
|
93 | Action logger for various actions made by users | |
94 |
|
94 | |||
95 | :param user: user that made this action, can be a unique username string or |
|
95 | :param user: user that made this action, can be a unique username string or | |
96 | object containing user_id attribute |
|
96 | object containing user_id attribute | |
97 | :param action: action to log, should be on of predefined unique actions for |
|
97 | :param action: action to log, should be on of predefined unique actions for | |
@@ -100,7 +100,7 b' def action_logger(user, action, repo, ip' | |||||
100 | that action was made on |
|
100 | that action was made on | |
101 | :param ipaddr: optional ip address from what the action was made |
|
101 | :param ipaddr: optional ip address from what the action was made | |
102 | :param sa: optional sqlalchemy session |
|
102 | :param sa: optional sqlalchemy session | |
103 |
|
103 | |||
104 | """ |
|
104 | """ | |
105 |
|
105 | |||
106 | if not sa: |
|
106 | if not sa: | |
@@ -146,10 +146,10 b' def action_logger(user, action, repo, ip' | |||||
146 |
|
146 | |||
147 | def get_repos(path, recursive=False): |
|
147 | def get_repos(path, recursive=False): | |
148 | """ |
|
148 | """ | |
149 |
Scans given path for repos and return (name,(type,path)) tuple |
|
149 | Scans given path for repos and return (name,(type,path)) tuple | |
150 |
|
150 | |||
151 | :param path: path to scann for repositories |
|
151 | :param path: path to scann for repositories | |
152 |
:param recursive: recursive search and return names with subdirs in front |
|
152 | :param recursive: recursive search and return names with subdirs in front | |
153 | """ |
|
153 | """ | |
154 | from vcs.utils.helpers import get_scm |
|
154 | from vcs.utils.helpers import get_scm | |
155 | from vcs.exceptions import VCSError |
|
155 | from vcs.exceptions import VCSError | |
@@ -182,7 +182,7 b' def check_repo_fast(repo_name, base_path' | |||||
182 | Check given path for existence of directory |
|
182 | Check given path for existence of directory | |
183 | :param repo_name: |
|
183 | :param repo_name: | |
184 | :param base_path: |
|
184 | :param base_path: | |
185 |
|
185 | |||
186 | :return False: if this directory is present |
|
186 | :return False: if this directory is present | |
187 | """ |
|
187 | """ | |
188 | if os.path.isdir(os.path.join(base_path, repo_name)):return False |
|
188 | if os.path.isdir(os.path.join(base_path, repo_name)):return False | |
@@ -230,7 +230,7 b" ui_sections = ['alias', 'auth'," | |||||
230 | def make_ui(read_from='file', path=None, checkpaths=True): |
|
230 | def make_ui(read_from='file', path=None, checkpaths=True): | |
231 | """A function that will read python rc files or database |
|
231 | """A function that will read python rc files or database | |
232 | and make an mercurial ui object from read options |
|
232 | and make an mercurial ui object from read options | |
233 |
|
233 | |||
234 | :param path: path to mercurial config file |
|
234 | :param path: path to mercurial config file | |
235 | :param checkpaths: check the path |
|
235 | :param checkpaths: check the path | |
236 | :param read_from: read from 'file' or 'db' |
|
236 | :param read_from: read from 'file' or 'db' | |
@@ -275,7 +275,7 b" def make_ui(read_from='file', path=None," | |||||
275 |
|
275 | |||
276 | def set_rhodecode_config(config): |
|
276 | def set_rhodecode_config(config): | |
277 | """Updates pylons config with new settings from database |
|
277 | """Updates pylons config with new settings from database | |
278 |
|
278 | |||
279 | :param config: |
|
279 | :param config: | |
280 | """ |
|
280 | """ | |
281 | from rhodecode.model.settings import SettingsModel |
|
281 | from rhodecode.model.settings import SettingsModel | |
@@ -285,7 +285,7 b' def set_rhodecode_config(config):' | |||||
285 | config[k] = v |
|
285 | config[k] = v | |
286 |
|
286 | |||
287 | def invalidate_cache(cache_key, *args): |
|
287 | def invalidate_cache(cache_key, *args): | |
288 |
"""Puts cache invalidation task into db for |
|
288 | """Puts cache invalidation task into db for | |
289 | further global cache invalidation |
|
289 | further global cache invalidation | |
290 | """ |
|
290 | """ | |
291 |
|
291 | |||
@@ -332,7 +332,7 b' class EmptyChangeset(BaseChangeset):' | |||||
332 | def map_groups(groups): |
|
332 | def map_groups(groups): | |
333 | """Checks for groups existence, and creates groups structures. |
|
333 | """Checks for groups existence, and creates groups structures. | |
334 | It returns last group in structure |
|
334 | It returns last group in structure | |
335 |
|
335 | |||
336 | :param groups: list of groups structure |
|
336 | :param groups: list of groups structure | |
337 | """ |
|
337 | """ | |
338 | sa = meta.Session() |
|
338 | sa = meta.Session() | |
@@ -355,7 +355,7 b' def repo2db_mapper(initial_repo_list, re' | |||||
355 | """maps all repos given in initial_repo_list, non existing repositories |
|
355 | """maps all repos given in initial_repo_list, non existing repositories | |
356 | are created, if remove_obsolete is True it also check for db entries |
|
356 | are created, if remove_obsolete is True it also check for db entries | |
357 | that are not in initial_repo_list and removes them. |
|
357 | that are not in initial_repo_list and removes them. | |
358 |
|
358 | |||
359 | :param initial_repo_list: list of repositories found by scanning methods |
|
359 | :param initial_repo_list: list of repositories found by scanning methods | |
360 | :param remove_obsolete: check for obsolete entries in database |
|
360 | :param remove_obsolete: check for obsolete entries in database | |
361 | """ |
|
361 | """ | |
@@ -562,7 +562,7 b' def create_test_index(repo_location, ful' | |||||
562 | pass |
|
562 | pass | |
563 |
|
563 | |||
564 | def create_test_env(repos_test_path, config): |
|
564 | def create_test_env(repos_test_path, config): | |
565 |
"""Makes a fresh database and |
|
565 | """Makes a fresh database and | |
566 | install test repository into tmp dir |
|
566 | install test repository into tmp dir | |
567 | """ |
|
567 | """ | |
568 | from rhodecode.lib.db_manage import DbManage |
|
568 | from rhodecode.lib.db_manage import DbManage | |
@@ -641,10 +641,10 b' class BasePasterCommand(Command):' | |||||
641 | def notify_msg(self, msg, log=False): |
|
641 | def notify_msg(self, msg, log=False): | |
642 | """Make a notification to user, additionally if logger is passed |
|
642 | """Make a notification to user, additionally if logger is passed | |
643 | it logs this action using given logger |
|
643 | it logs this action using given logger | |
644 |
|
644 | |||
645 | :param msg: message that will be printed to user |
|
645 | :param msg: message that will be printed to user | |
646 | :param log: logging instance, to use to additionally log this message |
|
646 | :param log: logging instance, to use to additionally log this message | |
647 |
|
647 | |||
648 | """ |
|
648 | """ | |
649 | if log and isinstance(log, logging): |
|
649 | if log and isinstance(log, logging): | |
650 | log(msg) |
|
650 | log(msg) | |
@@ -653,7 +653,7 b' class BasePasterCommand(Command):' | |||||
653 | def run(self, args): |
|
653 | def run(self, args): | |
654 | """ |
|
654 | """ | |
655 | Overrides Command.run |
|
655 | Overrides Command.run | |
656 |
|
656 | |||
657 | Checks for a config file argument and loads it. |
|
657 | Checks for a config file argument and loads it. | |
658 | """ |
|
658 | """ | |
659 | if len(args) < self.min_args: |
|
659 | if len(args) < self.min_args: |
@@ -2,42 +2,42 b'' | |||||
2 | """ |
|
2 | """ | |
3 | rhodecode.model.__init__ |
|
3 | rhodecode.model.__init__ | |
4 | ~~~~~~~~~~~~~~~~~~~~~~~~ |
|
4 | ~~~~~~~~~~~~~~~~~~~~~~~~ | |
5 |
|
5 | |||
6 | The application's model objects |
|
6 | The application's model objects | |
7 |
|
7 | |||
8 | :created_on: Nov 25, 2010 |
|
8 | :created_on: Nov 25, 2010 | |
9 | :author: marcink |
|
9 | :author: marcink | |
10 |
:copyright: (C) 2009-2011 Marcin Kuzminski <marcin@python-works.com> |
|
10 | :copyright: (C) 2009-2011 Marcin Kuzminski <marcin@python-works.com> | |
11 | :license: GPLv3, see COPYING for more details. |
|
11 | :license: GPLv3, see COPYING for more details. | |
12 |
|
12 | |||
13 |
|
13 | |||
14 | :example: |
|
14 | :example: | |
15 |
|
15 | |||
16 | .. code-block:: python |
|
16 | .. code-block:: python | |
17 |
|
17 | |||
18 | from paste.deploy import appconfig |
|
18 | from paste.deploy import appconfig | |
19 | from pylons import config |
|
19 | from pylons import config | |
20 | from sqlalchemy import engine_from_config |
|
20 | from sqlalchemy import engine_from_config | |
21 | from rhodecode.config.environment import load_environment |
|
21 | from rhodecode.config.environment import load_environment | |
22 |
|
22 | |||
23 | conf = appconfig('config:development.ini', relative_to = './../../') |
|
23 | conf = appconfig('config:development.ini', relative_to = './../../') | |
24 | load_environment(conf.global_conf, conf.local_conf) |
|
24 | load_environment(conf.global_conf, conf.local_conf) | |
25 |
|
25 | |||
26 | engine = engine_from_config(config, 'sqlalchemy.') |
|
26 | engine = engine_from_config(config, 'sqlalchemy.') | |
27 | init_model(engine) |
|
27 | init_model(engine) | |
28 | # RUN YOUR CODE HERE |
|
28 | # RUN YOUR CODE HERE | |
29 |
|
29 | |||
30 | """ |
|
30 | """ | |
31 | # This program is free software; you can redistribute it and/or |
|
31 | # This program is free software; you can redistribute it and/or | |
32 | # modify it under the terms of the GNU General Public License |
|
32 | # modify it under the terms of the GNU General Public License | |
33 | # as published by the Free Software Foundation; version 2 |
|
33 | # as published by the Free Software Foundation; version 2 | |
34 | # of the License or (at your opinion) any later version of the license. |
|
34 | # of the License or (at your opinion) any later version of the license. | |
35 |
# |
|
35 | # | |
36 | # This program is distributed in the hope that it will be useful, |
|
36 | # This program is distributed in the hope that it will be useful, | |
37 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
37 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
38 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
38 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
39 | # GNU General Public License for more details. |
|
39 | # GNU General Public License for more details. | |
40 |
# |
|
40 | # | |
41 | # You should have received a copy of the GNU General Public License |
|
41 | # You should have received a copy of the GNU General Public License | |
42 | # along with this program; if not, write to the Free Software |
|
42 | # along with this program; if not, write to the Free Software | |
43 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
43 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, | |
@@ -53,7 +53,7 b' def init_model(engine):' | |||||
53 | """Initializes db session, bind the engine with the metadata, |
|
53 | """Initializes db session, bind the engine with the metadata, | |
54 | Call this before using any of the tables or classes in the model, preferably |
|
54 | Call this before using any of the tables or classes in the model, preferably | |
55 | once in application start |
|
55 | once in application start | |
56 |
|
56 | |||
57 | :param engine: engine to bind to |
|
57 | :param engine: engine to bind to | |
58 | """ |
|
58 | """ | |
59 | log.info("initializing db for %s", engine) |
|
59 | log.info("initializing db for %s", engine) | |
@@ -62,7 +62,7 b' def init_model(engine):' | |||||
62 | class BaseModel(object): |
|
62 | class BaseModel(object): | |
63 | """Base Model for all RhodeCode models, it adds sql alchemy session |
|
63 | """Base Model for all RhodeCode models, it adds sql alchemy session | |
64 | into instance of model |
|
64 | into instance of model | |
65 |
|
65 | |||
66 | :param sa: If passed it reuses this session instead of creating a new one |
|
66 | :param sa: If passed it reuses this session instead of creating a new one | |
67 | """ |
|
67 | """ | |
68 |
|
68 |
@@ -11,12 +11,12 b' The three new concepts introduced here a' | |||||
11 | parameters on a Query |
|
11 | parameters on a Query | |
12 | * RelationshipCache - a variant of FromCache which is specific |
|
12 | * RelationshipCache - a variant of FromCache which is specific | |
13 | to a query invoked during a lazy load. |
|
13 | to a query invoked during a lazy load. | |
14 |
* _params_from_query - extracts value parameters from |
|
14 | * _params_from_query - extracts value parameters from | |
15 | a Query. |
|
15 | a Query. | |
16 |
|
16 | |||
17 | The rest of what's here are standard SQLAlchemy and |
|
17 | The rest of what's here are standard SQLAlchemy and | |
18 | Beaker constructs. |
|
18 | Beaker constructs. | |
19 |
|
19 | |||
20 | """ |
|
20 | """ | |
21 | from beaker.exceptions import BeakerException |
|
21 | from beaker.exceptions import BeakerException | |
22 | from sqlalchemy.orm.interfaces import MapperOption |
|
22 | from sqlalchemy.orm.interfaces import MapperOption | |
@@ -25,30 +25,30 b' from sqlalchemy.sql import visitors' | |||||
25 | import beaker |
|
25 | import beaker | |
26 |
|
26 | |||
27 | class CachingQuery(Query): |
|
27 | class CachingQuery(Query): | |
28 |
"""A Query subclass which optionally loads full results from a Beaker |
|
28 | """A Query subclass which optionally loads full results from a Beaker | |
29 | cache region. |
|
29 | cache region. | |
30 |
|
30 | |||
31 | The CachingQuery stores additional state that allows it to consult |
|
31 | The CachingQuery stores additional state that allows it to consult | |
32 | a Beaker cache before accessing the database: |
|
32 | a Beaker cache before accessing the database: | |
33 |
|
33 | |||
34 |
* A "region", which is a cache region argument passed to a |
|
34 | * A "region", which is a cache region argument passed to a | |
35 | Beaker CacheManager, specifies a particular cache configuration |
|
35 | Beaker CacheManager, specifies a particular cache configuration | |
36 | (including backend implementation, expiration times, etc.) |
|
36 | (including backend implementation, expiration times, etc.) | |
37 | * A "namespace", which is a qualifying name that identifies a |
|
37 | * A "namespace", which is a qualifying name that identifies a | |
38 |
group of keys within the cache. A query that filters on a name |
|
38 | group of keys within the cache. A query that filters on a name | |
39 |
might use the name "by_name", a query that filters on a date range |
|
39 | might use the name "by_name", a query that filters on a date range | |
40 | to a joined table might use the name "related_date_range". |
|
40 | to a joined table might use the name "related_date_range". | |
41 |
|
41 | |||
42 | When the above state is present, a Beaker cache is retrieved. |
|
42 | When the above state is present, a Beaker cache is retrieved. | |
43 |
|
43 | |||
44 |
The "namespace" name is first concatenated with |
|
44 | The "namespace" name is first concatenated with | |
45 |
a string composed of the individual entities and columns the Query |
|
45 | a string composed of the individual entities and columns the Query | |
46 | requests, i.e. such as ``Query(User.id, User.name)``. |
|
46 | requests, i.e. such as ``Query(User.id, User.name)``. | |
47 |
|
47 | |||
48 | The Beaker cache is then loaded from the cache manager based |
|
48 | The Beaker cache is then loaded from the cache manager based | |
49 | on the region and composed namespace. The key within the cache |
|
49 | on the region and composed namespace. The key within the cache | |
50 | itself is then constructed against the bind parameters specified |
|
50 | itself is then constructed against the bind parameters specified | |
51 |
by this query, which are usually literals defined in the |
|
51 | by this query, which are usually literals defined in the | |
52 | WHERE clause. |
|
52 | WHERE clause. | |
53 |
|
53 | |||
54 | The FromCache and RelationshipCache mapper options below represent |
|
54 | The FromCache and RelationshipCache mapper options below represent | |
@@ -63,7 +63,7 b' class CachingQuery(Query):' | |||||
63 | def __iter__(self): |
|
63 | def __iter__(self): | |
64 | """override __iter__ to pull results from Beaker |
|
64 | """override __iter__ to pull results from Beaker | |
65 | if particular attributes have been configured. |
|
65 | if particular attributes have been configured. | |
66 |
|
66 | |||
67 | Note that this approach does *not* detach the loaded objects from |
|
67 | Note that this approach does *not* detach the loaded objects from | |
68 | the current session. If the cache backend is an in-process cache |
|
68 | the current session. If the cache backend is an in-process cache | |
69 | (like "memory") and lives beyond the scope of the current session's |
|
69 | (like "memory") and lives beyond the scope of the current session's | |
@@ -71,7 +71,7 b' class CachingQuery(Query):' | |||||
71 | modified to first expunge() each loaded item from the current |
|
71 | modified to first expunge() each loaded item from the current | |
72 | session before returning the list of items, so that the items |
|
72 | session before returning the list of items, so that the items | |
73 | in the cache are not the same ones in the current Session. |
|
73 | in the cache are not the same ones in the current Session. | |
74 |
|
74 | |||
75 | """ |
|
75 | """ | |
76 | if hasattr(self, '_cache_parameters'): |
|
76 | if hasattr(self, '_cache_parameters'): | |
77 | return self.get_value(createfunc=lambda: list(Query.__iter__(self))) |
|
77 | return self.get_value(createfunc=lambda: list(Query.__iter__(self))) | |
@@ -143,7 +143,7 b' def _get_cache_parameters(query):' | |||||
143 | return cache, cache_key |
|
143 | return cache, cache_key | |
144 |
|
144 | |||
145 | def _namespace_from_query(namespace, query): |
|
145 | def _namespace_from_query(namespace, query): | |
146 |
# cache namespace - the token handed in by the |
|
146 | # cache namespace - the token handed in by the | |
147 | # option + class we're querying against |
|
147 | # option + class we're querying against | |
148 | namespace = " ".join([namespace] + [str(x) for x in query._entities]) |
|
148 | namespace = " ".join([namespace] + [str(x) for x in query._entities]) | |
149 |
|
149 | |||
@@ -169,18 +169,18 b' class FromCache(MapperOption):' | |||||
169 |
|
169 | |||
170 | def __init__(self, region, namespace, cache_key=None): |
|
170 | def __init__(self, region, namespace, cache_key=None): | |
171 | """Construct a new FromCache. |
|
171 | """Construct a new FromCache. | |
172 |
|
172 | |||
173 | :param region: the cache region. Should be a |
|
173 | :param region: the cache region. Should be a | |
174 | region configured in the Beaker CacheManager. |
|
174 | region configured in the Beaker CacheManager. | |
175 |
|
175 | |||
176 | :param namespace: the cache namespace. Should |
|
176 | :param namespace: the cache namespace. Should | |
177 | be a name uniquely describing the target Query's |
|
177 | be a name uniquely describing the target Query's | |
178 | lexical structure. |
|
178 | lexical structure. | |
179 |
|
179 | |||
180 |
:param cache_key: optional. A string cache key |
|
180 | :param cache_key: optional. A string cache key | |
181 | that will serve as the key to the query. Use this |
|
181 | that will serve as the key to the query. Use this | |
182 | if your query has a huge amount of parameters (such |
|
182 | if your query has a huge amount of parameters (such | |
183 |
as when using in_()) which correspond more simply to |
|
183 | as when using in_()) which correspond more simply to | |
184 | some other identifier. |
|
184 | some other identifier. | |
185 |
|
185 | |||
186 | """ |
|
186 | """ | |
@@ -194,25 +194,25 b' class FromCache(MapperOption):' | |||||
194 | _set_cache_parameters(query, self.region, self.namespace, self.cache_key) |
|
194 | _set_cache_parameters(query, self.region, self.namespace, self.cache_key) | |
195 |
|
195 | |||
196 | class RelationshipCache(MapperOption): |
|
196 | class RelationshipCache(MapperOption): | |
197 |
"""Specifies that a Query as called within a "lazy load" |
|
197 | """Specifies that a Query as called within a "lazy load" | |
198 | should load results from a cache.""" |
|
198 | should load results from a cache.""" | |
199 |
|
199 | |||
200 | propagate_to_loaders = True |
|
200 | propagate_to_loaders = True | |
201 |
|
201 | |||
202 | def __init__(self, region, namespace, attribute): |
|
202 | def __init__(self, region, namespace, attribute): | |
203 | """Construct a new RelationshipCache. |
|
203 | """Construct a new RelationshipCache. | |
204 |
|
204 | |||
205 | :param region: the cache region. Should be a |
|
205 | :param region: the cache region. Should be a | |
206 | region configured in the Beaker CacheManager. |
|
206 | region configured in the Beaker CacheManager. | |
207 |
|
207 | |||
208 | :param namespace: the cache namespace. Should |
|
208 | :param namespace: the cache namespace. Should | |
209 | be a name uniquely describing the target Query's |
|
209 | be a name uniquely describing the target Query's | |
210 | lexical structure. |
|
210 | lexical structure. | |
211 |
|
211 | |||
212 | :param attribute: A Class.attribute which |
|
212 | :param attribute: A Class.attribute which | |
213 | indicates a particular class relationship() whose |
|
213 | indicates a particular class relationship() whose | |
214 | lazy loader should be pulled from the cache. |
|
214 | lazy loader should be pulled from the cache. | |
215 |
|
215 | |||
216 | """ |
|
216 | """ | |
217 | self.region = region |
|
217 | self.region = region | |
218 | self.namespace = namespace |
|
218 | self.namespace = namespace | |
@@ -241,11 +241,11 b' class RelationshipCache(MapperOption):' | |||||
241 |
|
241 | |||
242 | def and_(self, option): |
|
242 | def and_(self, option): | |
243 | """Chain another RelationshipCache option to this one. |
|
243 | """Chain another RelationshipCache option to this one. | |
244 |
|
244 | |||
245 | While many RelationshipCache objects can be specified on a single |
|
245 | While many RelationshipCache objects can be specified on a single | |
246 | Query separately, chaining them together allows for a more efficient |
|
246 | Query separately, chaining them together allows for a more efficient | |
247 | lookup during load. |
|
247 | lookup during load. | |
248 |
|
248 | |||
249 | """ |
|
249 | """ | |
250 | self._relationship_options.update(option._relationship_options) |
|
250 | self._relationship_options.update(option._relationship_options) | |
251 | return self |
|
251 | return self | |
@@ -253,12 +253,12 b' class RelationshipCache(MapperOption):' | |||||
253 |
|
253 | |||
254 | def _params_from_query(query): |
|
254 | def _params_from_query(query): | |
255 | """Pull the bind parameter values from a query. |
|
255 | """Pull the bind parameter values from a query. | |
256 |
|
256 | |||
257 | This takes into account any scalar attribute bindparam set up. |
|
257 | This takes into account any scalar attribute bindparam set up. | |
258 |
|
258 | |||
259 | E.g. params_from_query(query.filter(Cls.foo==5).filter(Cls.bar==7))) |
|
259 | E.g. params_from_query(query.filter(Cls.foo==5).filter(Cls.bar==7))) | |
260 | would return [5, 7]. |
|
260 | would return [5, 7]. | |
261 |
|
261 | |||
262 | """ |
|
262 | """ | |
263 | v = [] |
|
263 | v = [] | |
264 | def visit_bindparam(bind): |
|
264 | def visit_bindparam(bind): |
@@ -2,24 +2,24 b'' | |||||
2 | """ |
|
2 | """ | |
3 | rhodecode.model.db |
|
3 | rhodecode.model.db | |
4 | ~~~~~~~~~~~~~~~~~~ |
|
4 | ~~~~~~~~~~~~~~~~~~ | |
5 |
|
5 | |||
6 | Database Models for RhodeCode |
|
6 | Database Models for RhodeCode | |
7 |
|
7 | |||
8 | :created_on: Apr 08, 2010 |
|
8 | :created_on: Apr 08, 2010 | |
9 | :author: marcink |
|
9 | :author: marcink | |
10 |
:copyright: (C) 2009-2011 Marcin Kuzminski <marcin@python-works.com> |
|
10 | :copyright: (C) 2009-2011 Marcin Kuzminski <marcin@python-works.com> | |
11 | :license: GPLv3, see COPYING for more details. |
|
11 | :license: GPLv3, see COPYING for more details. | |
12 | """ |
|
12 | """ | |
13 | # This program is free software; you can redistribute it and/or |
|
13 | # This program is free software; you can redistribute it and/or | |
14 | # modify it under the terms of the GNU General Public License |
|
14 | # modify it under the terms of the GNU General Public License | |
15 | # as published by the Free Software Foundation; version 2 |
|
15 | # as published by the Free Software Foundation; version 2 | |
16 | # of the License or (at your opinion) any later version of the license. |
|
16 | # of the License or (at your opinion) any later version of the license. | |
17 |
# |
|
17 | # | |
18 | # This program is distributed in the hope that it will be useful, |
|
18 | # This program is distributed in the hope that it will be useful, | |
19 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
19 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
20 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
20 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
21 | # GNU General Public License for more details. |
|
21 | # GNU General Public License for more details. | |
22 |
# |
|
22 | # | |
23 | # You should have received a copy of the GNU General Public License |
|
23 | # You should have received a copy of the GNU General Public License | |
24 | # along with this program; if not, write to the Free Software |
|
24 | # along with this program; if not, write to the Free Software | |
25 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
25 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, | |
@@ -387,4 +387,3 b' class DbMigrateVersion(Base):' | |||||
387 | repository_id = Column('repository_id', String(250), primary_key=True) |
|
387 | repository_id = Column('repository_id', String(250), primary_key=True) | |
388 | repository_path = Column('repository_path', Text) |
|
388 | repository_path = Column('repository_path', Text) | |
389 | version = Column('version', Integer) |
|
389 | version = Column('version', Integer) | |
390 |
|
@@ -10,14 +10,14 b' chained_validators [] These val' | |||||
10 | allow_extra_fields False If True, then it is not an error when keys that aren't associated with a validator are present |
|
10 | allow_extra_fields False If True, then it is not an error when keys that aren't associated with a validator are present | |
11 | filter_extra_fields False If True, then keys that aren't associated with a validator are removed |
|
11 | filter_extra_fields False If True, then keys that aren't associated with a validator are removed | |
12 | if_key_missing NoDefault If this is given, then any keys that aren't available but are expected will be replaced with this value (and then validated). This does not override a present .if_missing attribute on validators. NoDefault is a special FormEncode class to mean that no default values has been specified and therefore missing keys shouldn't take a default value. |
|
12 | if_key_missing NoDefault If this is given, then any keys that aren't available but are expected will be replaced with this value (and then validated). This does not override a present .if_missing attribute on validators. NoDefault is a special FormEncode class to mean that no default values has been specified and therefore missing keys shouldn't take a default value. | |
13 |
ignore_key_missing False If True, then missing keys will be missing in the result, if the validator doesn't have .if_missing on it already |
|
13 | ignore_key_missing False If True, then missing keys will be missing in the result, if the validator doesn't have .if_missing on it already | |
14 |
|
14 | |||
15 |
|
15 | |||
16 | <name> = formencode.validators.<name of validator> |
|
16 | <name> = formencode.validators.<name of validator> | |
17 | <name> must equal form name |
|
17 | <name> must equal form name | |
18 | list=[1,2,3,4,5] |
|
18 | list=[1,2,3,4,5] | |
19 | for SELECT use formencode.All(OneOf(list), Int()) |
|
19 | for SELECT use formencode.All(OneOf(list), Int()) | |
20 |
|
20 | |||
21 | """ |
|
21 | """ | |
22 | import os |
|
22 | import os | |
23 | import re |
|
23 | import re | |
@@ -361,7 +361,7 b' class AttrLoginValidator(formencode.vali' | |||||
361 | return value |
|
361 | return value | |
362 |
|
362 | |||
363 | #=============================================================================== |
|
363 | #=============================================================================== | |
364 |
# FORMS |
|
364 | # FORMS | |
365 | #=============================================================================== |
|
365 | #=============================================================================== | |
366 | class LoginForm(formencode.Schema): |
|
366 | class LoginForm(formencode.Schema): | |
367 | allow_extra_fields = True |
|
367 | allow_extra_fields = True |
@@ -21,7 +21,7 b' Session = scoped_session(' | |||||
21 |
|
21 | |||
22 | class BaseModel(object): |
|
22 | class BaseModel(object): | |
23 | """Base Model for all classess |
|
23 | """Base Model for all classess | |
24 |
|
24 | |||
25 | """ |
|
25 | """ | |
26 |
|
26 | |||
27 | @classmethod |
|
27 | @classmethod | |
@@ -30,7 +30,7 b' class BaseModel(object):' | |||||
30 | return class_mapper(cls).c.keys() |
|
30 | return class_mapper(cls).c.keys() | |
31 |
|
31 | |||
32 | def get_dict(self): |
|
32 | def get_dict(self): | |
33 |
"""return dict with keys and values corresponding |
|
33 | """return dict with keys and values corresponding | |
34 | to this model data """ |
|
34 | to this model data """ | |
35 |
|
35 | |||
36 | d = {} |
|
36 | d = {} | |
@@ -39,7 +39,7 b' class BaseModel(object):' | |||||
39 | return d |
|
39 | return d | |
40 |
|
40 | |||
41 | def get_appstruct(self): |
|
41 | def get_appstruct(self): | |
42 |
"""return list with keys and values tupples corresponding |
|
42 | """return list with keys and values tupples corresponding | |
43 | to this model data """ |
|
43 | to this model data """ | |
44 |
|
44 | |||
45 | l = [] |
|
45 | l = [] |
@@ -4,22 +4,22 b'' | |||||
4 | ~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|
4 | ~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
5 |
|
5 | |||
6 | permissions model for RhodeCode |
|
6 | permissions model for RhodeCode | |
7 |
|
7 | |||
8 | :created_on: Aug 20, 2010 |
|
8 | :created_on: Aug 20, 2010 | |
9 | :author: marcink |
|
9 | :author: marcink | |
10 |
:copyright: (C) 2009-2011 Marcin Kuzminski <marcin@python-works.com> |
|
10 | :copyright: (C) 2009-2011 Marcin Kuzminski <marcin@python-works.com> | |
11 | :license: GPLv3, see COPYING for more details. |
|
11 | :license: GPLv3, see COPYING for more details. | |
12 | """ |
|
12 | """ | |
13 | # This program is free software; you can redistribute it and/or |
|
13 | # This program is free software; you can redistribute it and/or | |
14 | # modify it under the terms of the GNU General Public License |
|
14 | # modify it under the terms of the GNU General Public License | |
15 | # as published by the Free Software Foundation; version 2 |
|
15 | # as published by the Free Software Foundation; version 2 | |
16 | # of the License or (at your opinion) any later version of the license. |
|
16 | # of the License or (at your opinion) any later version of the license. | |
17 |
# |
|
17 | # | |
18 | # This program is distributed in the hope that it will be useful, |
|
18 | # This program is distributed in the hope that it will be useful, | |
19 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
19 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
20 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
20 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
21 | # GNU General Public License for more details. |
|
21 | # GNU General Public License for more details. | |
22 |
# |
|
22 | # | |
23 | # You should have received a copy of the GNU General Public License |
|
23 | # You should have received a copy of the GNU General Public License | |
24 | # along with this program; if not, write to the Free Software |
|
24 | # along with this program; if not, write to the Free Software | |
25 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
25 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, | |
@@ -43,7 +43,7 b' class PermissionModel(BaseModel):' | |||||
43 |
|
43 | |||
44 | def get_permission(self, permission_id, cache=False): |
|
44 | def get_permission(self, permission_id, cache=False): | |
45 | """Get's permissions by id |
|
45 | """Get's permissions by id | |
46 |
|
46 | |||
47 | :param permission_id: id of permission to get from database |
|
47 | :param permission_id: id of permission to get from database | |
48 | :param cache: use Cache for this query |
|
48 | :param cache: use Cache for this query | |
49 | """ |
|
49 | """ | |
@@ -55,7 +55,7 b' class PermissionModel(BaseModel):' | |||||
55 |
|
55 | |||
56 | def get_permission_by_name(self, name, cache=False): |
|
56 | def get_permission_by_name(self, name, cache=False): | |
57 | """Get's permissions by given name |
|
57 | """Get's permissions by given name | |
58 |
|
58 | |||
59 | :param name: name to fetch |
|
59 | :param name: name to fetch | |
60 | :param cache: Use cache for this query |
|
60 | :param cache: Use cache for this query | |
61 | """ |
|
61 | """ | |
@@ -76,7 +76,7 b' class PermissionModel(BaseModel):' | |||||
76 | ' your database' % len(u2p)) |
|
76 | ' your database' % len(u2p)) | |
77 |
|
77 | |||
78 | try: |
|
78 | try: | |
79 |
#stage 1 change defaults |
|
79 | #stage 1 change defaults | |
80 | for p in u2p: |
|
80 | for p in u2p: | |
81 | if p.permission.permission_name.startswith('repository.'): |
|
81 | if p.permission.permission_name.startswith('repository.'): | |
82 | p.permission = self.get_permission_by_name( |
|
82 | p.permission = self.get_permission_by_name( |
@@ -4,22 +4,22 b'' | |||||
4 | ~~~~~~~~~~~~~~~~~~~~ |
|
4 | ~~~~~~~~~~~~~~~~~~~~ | |
5 |
|
5 | |||
6 | Repository model for rhodecode |
|
6 | Repository model for rhodecode | |
7 |
|
7 | |||
8 | :created_on: Jun 5, 2010 |
|
8 | :created_on: Jun 5, 2010 | |
9 | :author: marcink |
|
9 | :author: marcink | |
10 |
:copyright: (C) 2009-2011 Marcin Kuzminski <marcin@python-works.com> |
|
10 | :copyright: (C) 2009-2011 Marcin Kuzminski <marcin@python-works.com> | |
11 | :license: GPLv3, see COPYING for more details. |
|
11 | :license: GPLv3, see COPYING for more details. | |
12 | """ |
|
12 | """ | |
13 | # This program is free software; you can redistribute it and/or |
|
13 | # This program is free software; you can redistribute it and/or | |
14 | # modify it under the terms of the GNU General Public License |
|
14 | # modify it under the terms of the GNU General Public License | |
15 | # as published by the Free Software Foundation; version 2 |
|
15 | # as published by the Free Software Foundation; version 2 | |
16 | # of the License or (at your opinion) any later version of the license. |
|
16 | # of the License or (at your opinion) any later version of the license. | |
17 |
# |
|
17 | # | |
18 | # This program is distributed in the hope that it will be useful, |
|
18 | # This program is distributed in the hope that it will be useful, | |
19 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
19 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
20 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
20 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
21 | # GNU General Public License for more details. |
|
21 | # GNU General Public License for more details. | |
22 |
# |
|
22 | # | |
23 | # You should have received a copy of the GNU General Public License |
|
23 | # You should have received a copy of the GNU General Public License | |
24 | # along with this program; if not, write to the Free Software |
|
24 | # along with this program; if not, write to the Free Software | |
25 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
25 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, | |
@@ -304,7 +304,7 b' class RepoModel(BaseModel):' | |||||
304 | def __create_repo(self, repo_name, alias, clone_uri=False): |
|
304 | def __create_repo(self, repo_name, alias, clone_uri=False): | |
305 | """ |
|
305 | """ | |
306 | makes repository on filesystem |
|
306 | makes repository on filesystem | |
307 |
|
307 | |||
308 | :param repo_name: |
|
308 | :param repo_name: | |
309 | :param alias: |
|
309 | :param alias: | |
310 | """ |
|
310 | """ | |
@@ -319,7 +319,7 b' class RepoModel(BaseModel):' | |||||
319 | def __rename_repo(self, old, new): |
|
319 | def __rename_repo(self, old, new): | |
320 | """ |
|
320 | """ | |
321 | renames repository on filesystem |
|
321 | renames repository on filesystem | |
322 |
|
322 | |||
323 | :param old: old name |
|
323 | :param old: old name | |
324 | :param new: new name |
|
324 | :param new: new name | |
325 | """ |
|
325 | """ | |
@@ -338,7 +338,7 b' class RepoModel(BaseModel):' | |||||
338 | added rm__ prefix into dir, and rename internat .hg/.git dirs so this |
|
338 | added rm__ prefix into dir, and rename internat .hg/.git dirs so this | |
339 | repository is no longer valid for rhodecode, can be undeleted later on |
|
339 | repository is no longer valid for rhodecode, can be undeleted later on | |
340 | by reverting the renames on this repository |
|
340 | by reverting the renames on this repository | |
341 |
|
341 | |||
342 | :param repo: repo object |
|
342 | :param repo: repo object | |
343 | """ |
|
343 | """ | |
344 | rm_path = os.path.join(self.repos_path, repo.repo_name) |
|
344 | rm_path = os.path.join(self.repos_path, repo.repo_name) |
@@ -7,19 +7,19 b'' | |||||
7 |
|
7 | |||
8 | :created_on: Apr 9, 2010 |
|
8 | :created_on: Apr 9, 2010 | |
9 | :author: marcink |
|
9 | :author: marcink | |
10 |
:copyright: (C) 2009-2011 Marcin Kuzminski <marcin@python-works.com> |
|
10 | :copyright: (C) 2009-2011 Marcin Kuzminski <marcin@python-works.com> | |
11 | :license: GPLv3, see COPYING for more details. |
|
11 | :license: GPLv3, see COPYING for more details. | |
12 | """ |
|
12 | """ | |
13 | # This program is free software; you can redistribute it and/or |
|
13 | # This program is free software; you can redistribute it and/or | |
14 | # modify it under the terms of the GNU General Public License |
|
14 | # modify it under the terms of the GNU General Public License | |
15 | # as published by the Free Software Foundation; version 2 |
|
15 | # as published by the Free Software Foundation; version 2 | |
16 | # of the License or (at your opinion) any later version of the license. |
|
16 | # of the License or (at your opinion) any later version of the license. | |
17 |
# |
|
17 | # | |
18 | # This program is distributed in the hope that it will be useful, |
|
18 | # This program is distributed in the hope that it will be useful, | |
19 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
19 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
20 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
20 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
21 | # GNU General Public License for more details. |
|
21 | # GNU General Public License for more details. | |
22 |
# |
|
22 | # | |
23 | # You should have received a copy of the GNU General Public License |
|
23 | # You should have received a copy of the GNU General Public License | |
24 | # along with this program; if not, write to the Free Software |
|
24 | # along with this program; if not, write to the Free Software | |
25 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
25 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, | |
@@ -84,9 +84,9 b' class ScmModel(BaseModel):' | |||||
84 | return q.ui_value |
|
84 | return q.ui_value | |
85 |
|
85 | |||
86 | def repo_scan(self, repos_path=None): |
|
86 | def repo_scan(self, repos_path=None): | |
87 |
"""Listing of repositories in given path. This path should not be a |
|
87 | """Listing of repositories in given path. This path should not be a | |
88 | repository itself. Return a dictionary of repository objects |
|
88 | repository itself. Return a dictionary of repository objects | |
89 |
|
89 | |||
90 | :param repos_path: path to directory containing repositories |
|
90 | :param repos_path: path to directory containing repositories | |
91 | """ |
|
91 | """ | |
92 |
|
92 | |||
@@ -120,7 +120,7 b' class ScmModel(BaseModel):' | |||||
120 | def get_repos(self, all_repos=None): |
|
120 | def get_repos(self, all_repos=None): | |
121 | """Get all repos from db and for each repo create it's backend instance. |
|
121 | """Get all repos from db and for each repo create it's backend instance. | |
122 | and fill that backed with information from database |
|
122 | and fill that backed with information from database | |
123 |
|
123 | |||
124 | :param all_repos: give specific repositories list, good for filtering |
|
124 | :param all_repos: give specific repositories list, good for filtering | |
125 | this have to be a list of just the repository names |
|
125 | this have to be a list of just the repository names | |
126 | """ |
|
126 | """ | |
@@ -166,10 +166,10 b' class ScmModel(BaseModel):' | |||||
166 | """Returns a tuple of Repository,DbRepository, |
|
166 | """Returns a tuple of Repository,DbRepository, | |
167 | Get's repository from given name, creates BackendInstance and |
|
167 | Get's repository from given name, creates BackendInstance and | |
168 | propagates it's data from database with all additional information |
|
168 | propagates it's data from database with all additional information | |
169 |
|
169 | |||
170 | :param repo_name: |
|
170 | :param repo_name: | |
171 | :param invalidation_list: if a invalidation list is given the get |
|
171 | :param invalidation_list: if a invalidation list is given the get | |
172 |
method should not manually check if this repository needs |
|
172 | method should not manually check if this repository needs | |
173 | invalidation and just invalidate the repositories in list |
|
173 | invalidation and just invalidate the repositories in list | |
174 | :param retval: string specifing what to return one of 'repo','dbrepo', |
|
174 | :param retval: string specifing what to return one of 'repo','dbrepo', | |
175 | 'all'if repo or dbrepo is given it'll just lazy load chosen type |
|
175 | 'all'if repo or dbrepo is given it'll just lazy load chosen type | |
@@ -234,9 +234,9 b' class ScmModel(BaseModel):' | |||||
234 | return r, dbr |
|
234 | return r, dbr | |
235 |
|
235 | |||
236 | def mark_for_invalidation(self, repo_name): |
|
236 | def mark_for_invalidation(self, repo_name): | |
237 |
"""Puts cache invalidation task into db for |
|
237 | """Puts cache invalidation task into db for | |
238 | further global cache invalidation |
|
238 | further global cache invalidation | |
239 |
|
239 | |||
240 | :param repo_name: this repo that should invalidation take place |
|
240 | :param repo_name: this repo that should invalidation take place | |
241 | """ |
|
241 | """ | |
242 |
|
242 | |||
@@ -367,7 +367,7 b' class ScmModel(BaseModel):' | |||||
367 | 'action':'push_remote', |
|
367 | 'action':'push_remote', | |
368 | 'repository':repo_name} |
|
368 | 'repository':repo_name} | |
369 |
|
369 | |||
370 |
#inject ui extra param to log this action via push logger |
|
370 | #inject ui extra param to log this action via push logger | |
371 | for k, v in extras.items(): |
|
371 | for k, v in extras.items(): | |
372 | repo._repo.ui.setconfig('rhodecode_extras', k, v) |
|
372 | repo._repo.ui.setconfig('rhodecode_extras', k, v) | |
373 |
|
373 | |||
@@ -383,7 +383,7 b' class ScmModel(BaseModel):' | |||||
383 |
|
383 | |||
384 | def _should_invalidate(self, repo_name): |
|
384 | def _should_invalidate(self, repo_name): | |
385 | """Looks up database for invalidation signals for this repo_name |
|
385 | """Looks up database for invalidation signals for this repo_name | |
386 |
|
386 | |||
387 | :param repo_name: |
|
387 | :param repo_name: | |
388 | """ |
|
388 | """ | |
389 |
|
389 | |||
@@ -395,9 +395,9 b' class ScmModel(BaseModel):' | |||||
395 | return ret |
|
395 | return ret | |
396 |
|
396 | |||
397 | def _mark_invalidated(self, cache_key): |
|
397 | def _mark_invalidated(self, cache_key): | |
398 |
""" Marks all occurrences of cache to invalidation as already |
|
398 | """ Marks all occurrences of cache to invalidation as already | |
399 | invalidated |
|
399 | invalidated | |
400 |
|
400 | |||
401 | :param cache_key: |
|
401 | :param cache_key: | |
402 | """ |
|
402 | """ | |
403 |
|
403 | |||
@@ -410,4 +410,3 b' class ScmModel(BaseModel):' | |||||
410 | except (DatabaseError,): |
|
410 | except (DatabaseError,): | |
411 | log.error(traceback.format_exc()) |
|
411 | log.error(traceback.format_exc()) | |
412 | self.sa.rollback() |
|
412 | self.sa.rollback() | |
413 |
|
@@ -7,19 +7,19 b'' | |||||
7 |
|
7 | |||
8 | :created on Nov 17, 2010 |
|
8 | :created on Nov 17, 2010 | |
9 | :author: marcink |
|
9 | :author: marcink | |
10 |
:copyright: (C) 2009-2011 Marcin Kuzminski <marcin@python-works.com> |
|
10 | :copyright: (C) 2009-2011 Marcin Kuzminski <marcin@python-works.com> | |
11 | :license: GPLv3, see COPYING for more details. |
|
11 | :license: GPLv3, see COPYING for more details. | |
12 | """ |
|
12 | """ | |
13 | # This program is free software; you can redistribute it and/or |
|
13 | # This program is free software; you can redistribute it and/or | |
14 | # modify it under the terms of the GNU General Public License |
|
14 | # modify it under the terms of the GNU General Public License | |
15 | # as published by the Free Software Foundation; version 2 |
|
15 | # as published by the Free Software Foundation; version 2 | |
16 | # of the License or (at your opinion) any later version of the license. |
|
16 | # of the License or (at your opinion) any later version of the license. | |
17 |
# |
|
17 | # | |
18 | # This program is distributed in the hope that it will be useful, |
|
18 | # This program is distributed in the hope that it will be useful, | |
19 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
19 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
20 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
20 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
21 | # GNU General Public License for more details. |
|
21 | # GNU General Public License for more details. | |
22 |
# |
|
22 | # | |
23 | # You should have received a copy of the GNU General Public License |
|
23 | # You should have received a copy of the GNU General Public License | |
24 | # along with this program; if not, write to the Free Software |
|
24 | # along with this program; if not, write to the Free Software | |
25 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
25 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, | |
@@ -47,8 +47,8 b' class SettingsModel(BaseModel):' | |||||
47 | return r |
|
47 | return r | |
48 |
|
48 | |||
49 | def get_app_settings(self, cache=False): |
|
49 | def get_app_settings(self, cache=False): | |
50 |
"""Get's config from database, each config key is prefixed with |
|
50 | """Get's config from database, each config key is prefixed with | |
51 |
'rhodecode_' prefix, than global pylons config is updated with such |
|
51 | 'rhodecode_' prefix, than global pylons config is updated with such | |
52 | keys |
|
52 | keys | |
53 | """ |
|
53 | """ | |
54 |
|
54 | |||
@@ -71,11 +71,11 b' class SettingsModel(BaseModel):' | |||||
71 | :returns: |
|
71 | :returns: | |
72 | ldap_active |
|
72 | ldap_active | |
73 | ldap_host |
|
73 | ldap_host | |
74 |
ldap_port |
|
74 | ldap_port | |
75 | ldap_ldaps |
|
75 | ldap_ldaps | |
76 | ldap_tls_reqcert |
|
76 | ldap_tls_reqcert | |
77 |
ldap_dn_user |
|
77 | ldap_dn_user | |
78 |
ldap_dn_pass |
|
78 | ldap_dn_pass | |
79 | ldap_base_dn |
|
79 | ldap_base_dn | |
80 | ldap_filter |
|
80 | ldap_filter | |
81 | ldap_search_scope |
|
81 | ldap_search_scope |
@@ -4,22 +4,22 b'' | |||||
4 | ~~~~~~~~~~~~~~~~~~~~ |
|
4 | ~~~~~~~~~~~~~~~~~~~~ | |
5 |
|
5 | |||
6 | users model for RhodeCode |
|
6 | users model for RhodeCode | |
7 |
|
7 | |||
8 | :created_on: Apr 9, 2010 |
|
8 | :created_on: Apr 9, 2010 | |
9 | :author: marcink |
|
9 | :author: marcink | |
10 |
:copyright: (C) 2009-2011 Marcin Kuzminski <marcin@python-works.com> |
|
10 | :copyright: (C) 2009-2011 Marcin Kuzminski <marcin@python-works.com> | |
11 | :license: GPLv3, see COPYING for more details. |
|
11 | :license: GPLv3, see COPYING for more details. | |
12 | """ |
|
12 | """ | |
13 | # This program is free software; you can redistribute it and/or |
|
13 | # This program is free software; you can redistribute it and/or | |
14 | # modify it under the terms of the GNU General Public License |
|
14 | # modify it under the terms of the GNU General Public License | |
15 | # as published by the Free Software Foundation; version 2 |
|
15 | # as published by the Free Software Foundation; version 2 | |
16 | # of the License or (at your opinion) any later version of the license. |
|
16 | # of the License or (at your opinion) any later version of the license. | |
17 |
# |
|
17 | # | |
18 | # This program is distributed in the hope that it will be useful, |
|
18 | # This program is distributed in the hope that it will be useful, | |
19 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
19 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
20 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
20 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
21 | # GNU General Public License for more details. |
|
21 | # GNU General Public License for more details. | |
22 |
# |
|
22 | # | |
23 | # You should have received a copy of the GNU General Public License |
|
23 | # You should have received a copy of the GNU General Public License | |
24 | # along with this program; if not, write to the Free Software |
|
24 | # along with this program; if not, write to the Free Software | |
25 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
25 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, | |
@@ -223,9 +223,9 b' class UserModel(BaseModel):' | |||||
223 | """ |
|
223 | """ | |
224 | Fetches auth_user by user_id,or api_key if present. |
|
224 | Fetches auth_user by user_id,or api_key if present. | |
225 | Fills auth_user attributes with those taken from database. |
|
225 | Fills auth_user attributes with those taken from database. | |
226 |
Additionally set's is_authenitated if lookup fails |
|
226 | Additionally set's is_authenitated if lookup fails | |
227 | present in database |
|
227 | present in database | |
228 |
|
228 | |||
229 | :param auth_user: instance of user to set attributes |
|
229 | :param auth_user: instance of user to set attributes | |
230 | :param user_id: user id to fetch by |
|
230 | :param user_id: user id to fetch by | |
231 | :param api_key: api key to fetch by |
|
231 | :param api_key: api key to fetch by | |
@@ -255,7 +255,7 b' class UserModel(BaseModel):' | |||||
255 | """Fills user permission attribute with permissions taken from database |
|
255 | """Fills user permission attribute with permissions taken from database | |
256 | works for permissions given for repositories, and for permissions that |
|
256 | works for permissions given for repositories, and for permissions that | |
257 | as part of beeing group member |
|
257 | as part of beeing group member | |
258 |
|
258 | |||
259 | :param user: user instance to fill his perms |
|
259 | :param user: user instance to fill his perms | |
260 | """ |
|
260 | """ | |
261 |
|
261 | |||
@@ -274,7 +274,7 b' class UserModel(BaseModel):' | |||||
274 |
|
274 | |||
275 | if user.is_admin: |
|
275 | if user.is_admin: | |
276 | #======================================================================= |
|
276 | #======================================================================= | |
277 |
# #admin have all default rights set to admin |
|
277 | # #admin have all default rights set to admin | |
278 | #======================================================================= |
|
278 | #======================================================================= | |
279 | user.permissions['global'].add('hg.admin') |
|
279 | user.permissions['global'].add('hg.admin') | |
280 |
|
280 | |||
@@ -325,7 +325,7 b' class UserModel(BaseModel):' | |||||
325 |
|
325 | |||
326 |
|
326 | |||
327 | #======================================================================= |
|
327 | #======================================================================= | |
328 |
# check if user is part of groups for this repository and fill in |
|
328 | # check if user is part of groups for this repository and fill in | |
329 | # (or replace with higher) permissions |
|
329 | # (or replace with higher) permissions | |
330 | #======================================================================= |
|
330 | #======================================================================= | |
331 | user_perms_from_users_groups = self.sa.query(UsersGroupToPerm, Permission, Repository,)\ |
|
331 | user_perms_from_users_groups = self.sa.query(UsersGroupToPerm, Permission, Repository,)\ |
@@ -4,22 +4,22 b'' | |||||
4 | ~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|
4 | ~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
5 |
|
5 | |||
6 | users groups model for RhodeCode |
|
6 | users groups model for RhodeCode | |
7 |
|
7 | |||
8 | :created_on: Jan 25, 2011 |
|
8 | :created_on: Jan 25, 2011 | |
9 | :author: marcink |
|
9 | :author: marcink | |
10 |
:copyright: (C) 2009-2011 Marcin Kuzminski <marcin@python-works.com> |
|
10 | :copyright: (C) 2009-2011 Marcin Kuzminski <marcin@python-works.com> | |
11 | :license: GPLv3, see COPYING for more details. |
|
11 | :license: GPLv3, see COPYING for more details. | |
12 | """ |
|
12 | """ | |
13 | # This program is free software; you can redistribute it and/or |
|
13 | # This program is free software; you can redistribute it and/or | |
14 | # modify it under the terms of the GNU General Public License |
|
14 | # modify it under the terms of the GNU General Public License | |
15 | # as published by the Free Software Foundation; version 2 |
|
15 | # as published by the Free Software Foundation; version 2 | |
16 | # of the License or (at your opinion) any later version of the license. |
|
16 | # of the License or (at your opinion) any later version of the license. | |
17 |
# |
|
17 | # | |
18 | # This program is distributed in the hope that it will be useful, |
|
18 | # This program is distributed in the hope that it will be useful, | |
19 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
19 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
20 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
20 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
21 | # GNU General Public License for more details. |
|
21 | # GNU General Public License for more details. | |
22 |
# |
|
22 | # | |
23 | # You should have received a copy of the GNU General Public License |
|
23 | # You should have received a copy of the GNU General Public License | |
24 | # along with this program; if not, write to the Free Software |
|
24 | # along with this program; if not, write to the Free Software | |
25 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
25 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
@@ -311,4 +311,3 b' removed extra unicode conversion in diff' | |||||
311 | f_path=f_path)) |
|
311 | f_path=f_path)) | |
312 |
|
312 | |||
313 | assert "There is no file nor directory at the given path: %r at revision %r" % (f_path, rev[:12]) in response.session['flash'][0][1], 'No flash message' |
|
313 | assert "There is no file nor directory at the given path: %r at revision %r" % (f_path, rev[:12]) in response.session['flash'][0][1], 'No flash message' | |
314 |
|
@@ -228,6 +228,3 b' class TestLoginController(TestController' | |||||
228 | print response.session['flash'] |
|
228 | print response.session['flash'] | |
229 | assert 'You have successfully registered into rhodecode' in response.session['flash'][0], 'No flash message about user registration' |
|
229 | assert 'You have successfully registered into rhodecode' in response.session['flash'][0], 'No flash message about user registration' | |
230 | assert 'Your new password was sent' in response.session['flash'][1], 'No flash message about password reset' |
|
230 | assert 'Your new password was sent' in response.session['flash'][1], 'No flash message about password reset' | |
231 |
|
||||
232 |
|
||||
233 |
|
@@ -33,4 +33,3 b' class TestSearchController(TestControlle' | |||||
33 | print response.body |
|
33 | print response.body | |
34 | assert '4 results' in response.body, 'no message about proper search results' |
|
34 | assert '4 results' in response.body, 'no message about proper search results' | |
35 | assert 'Permission denied' not in response.body, 'Wrong permissions settings for that repo and user' |
|
35 | assert 'Permission denied' not in response.body, 'Wrong permissions settings for that repo and user' | |
36 |
|
@@ -47,4 +47,3 b' class TestSettingsController(TestControl' | |||||
47 | repo_name=fork_name)) |
|
47 | repo_name=fork_name)) | |
48 |
|
48 | |||
49 | assert 'Fork of %s' % repo_name in response.body, 'no message about that this repo is a fork' |
|
49 | assert 'Fork of %s' % repo_name in response.body, 'no message about that this repo is a fork' | |
50 |
|
@@ -29,4 +29,3 b' class TestSummaryController(TestControll' | |||||
29 | r.enable_statistics = True |
|
29 | r.enable_statistics = True | |
30 | self.sa.add(r) |
|
30 | self.sa.add(r) | |
31 | self.sa.commit() |
|
31 | self.sa.commit() | |
32 |
|
@@ -4,7 +4,7 b'' | |||||
4 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|
4 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
5 |
|
5 | |||
6 | Test suite for making push/pull operations |
|
6 | Test suite for making push/pull operations | |
7 |
|
7 | |||
8 | :created_on: Dec 30, 2010 |
|
8 | :created_on: Dec 30, 2010 | |
9 | :copyright: (c) 2010 by marcink. |
|
9 | :copyright: (c) 2010 by marcink. | |
10 | :license: LICENSE_NAME, see LICENSE_FILE for more details. |
|
10 | :license: LICENSE_NAME, see LICENSE_FILE for more details. | |
@@ -328,5 +328,3 b" if __name__ == '__main__':" | |||||
328 | test_push_new_file(commits=15) |
|
328 | test_push_new_file(commits=15) | |
329 | #test_push_wrong_path() |
|
329 | #test_push_wrong_path() | |
330 | #test_push_wrong_credentials() |
|
330 | #test_push_wrong_credentials() | |
331 |
|
||||
332 |
|
@@ -4,22 +4,22 b'' | |||||
4 | ~~~~~~~~~~~~~~~~~~ |
|
4 | ~~~~~~~~~~~~~~~~~~ | |
5 |
|
5 | |||
6 | Weboperations and setup for rhodecode |
|
6 | Weboperations and setup for rhodecode | |
7 |
|
7 | |||
8 | :created_on: Dec 11, 2010 |
|
8 | :created_on: Dec 11, 2010 | |
9 | :author: marcink |
|
9 | :author: marcink | |
10 |
:copyright: (C) 2009-2011 Marcin Kuzminski <marcin@python-works.com> |
|
10 | :copyright: (C) 2009-2011 Marcin Kuzminski <marcin@python-works.com> | |
11 | :license: GPLv3, see COPYING for more details. |
|
11 | :license: GPLv3, see COPYING for more details. | |
12 | """ |
|
12 | """ | |
13 | # This program is free software; you can redistribute it and/or |
|
13 | # This program is free software; you can redistribute it and/or | |
14 | # modify it under the terms of the GNU General Public License |
|
14 | # modify it under the terms of the GNU General Public License | |
15 | # as published by the Free Software Foundation; version 2 |
|
15 | # as published by the Free Software Foundation; version 2 | |
16 | # of the License or (at your opinion) any later version of the license. |
|
16 | # of the License or (at your opinion) any later version of the license. | |
17 |
# |
|
17 | # | |
18 | # This program is distributed in the hope that it will be useful, |
|
18 | # This program is distributed in the hope that it will be useful, | |
19 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
19 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
20 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
20 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
21 | # GNU General Public License for more details. |
|
21 | # GNU General Public License for more details. | |
22 |
# |
|
22 | # | |
23 | # You should have received a copy of the GNU General Public License |
|
23 | # You should have received a copy of the GNU General Public License | |
24 | # along with this program; if not, write to the Free Software |
|
24 | # along with this program; if not, write to the Free Software | |
25 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
25 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, | |
@@ -47,8 +47,3 b' def setup_app(command, conf, vars):' | |||||
47 | dbmanage.populate_default_permissions() |
|
47 | dbmanage.populate_default_permissions() | |
48 |
|
48 | |||
49 | load_environment(conf.global_conf, conf.local_conf, initial=True) |
|
49 | load_environment(conf.global_conf, conf.local_conf, initial=True) | |
50 |
|
||||
51 |
|
||||
52 |
|
||||
53 |
|
||||
54 |
|
@@ -115,6 +115,6 b' setup(' | |||||
115 | celerybeat=rhodecode.lib.celerypylons.commands:CeleryBeatCommand |
|
115 | celerybeat=rhodecode.lib.celerypylons.commands:CeleryBeatCommand | |
116 | camqadm=rhodecode.lib.celerypylons.commands:CAMQPAdminCommand |
|
116 | camqadm=rhodecode.lib.celerypylons.commands:CAMQPAdminCommand | |
117 | celeryev=rhodecode.lib.celerypylons.commands:CeleryEventCommand |
|
117 | celeryev=rhodecode.lib.celerypylons.commands:CeleryEventCommand | |
118 |
|
118 | |||
119 | """, |
|
119 | """, | |
120 | ) |
|
120 | ) |
General Comments 0
You need to be logged in to leave comments.
Login now