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