Mercurial > kallithea
comparison rhodecode/lib/__init__.py @ 1152:008bdfdd95c8 rhodecode-0.0.1.1.5
fixed str2bool typo
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Fri, 18 Mar 2011 19:02:11 +0100 |
parents | 93b980ebee55 |
children | 3d9da7893fdb |
comparison
equal
deleted
inserted
replaced
1147:56a4d67651cc | 1152:008bdfdd95c8 |
---|---|
2 """ | 2 """ |
3 rhodecode.lib.__init__ | 3 rhodecode.lib.__init__ |
4 ~~~~~~~~~~~~~~~~~~~~~~~ | 4 ~~~~~~~~~~~~~~~~~~~~~~~ |
5 | 5 |
6 Some simple helper functions | 6 Some simple helper functions |
7 | 7 |
8 :created_on: Jan 5, 2011 | 8 :created_on: Jan 5, 2011 |
9 :author: marcink | 9 :author: marcink |
10 :copyright: (C) 2009-2010 Marcin Kuzminski <marcin@python-works.com> | 10 :copyright: (C) 2009-2010 Marcin Kuzminski <marcin@python-works.com> |
11 :license: GPLv3, see COPYING for more details. | 11 :license: GPLv3, see COPYING for more details. |
12 """ | 12 """ |
13 # This program is free software; you can redistribute it and/or | 13 # This program is free software; you can redistribute it and/or |
14 # modify it under the terms of the GNU General Public License | 14 # modify it under the terms of the GNU General Public License |
15 # as published by the Free Software Foundation; version 2 | 15 # as published by the Free Software Foundation; version 2 |
16 # of the License or (at your opinion) any later version of the license. | 16 # of the License or (at your opinion) any later version of the license. |
17 # | 17 # |
18 # This program is distributed in the hope that it will be useful, | 18 # This program is distributed in the hope that it will be useful, |
19 # but WITHOUT ANY WARRANTY; without even the implied warranty of | 19 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
20 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 20 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
21 # GNU General Public License for more details. | 21 # GNU General Public License for more details. |
22 # | 22 # |
23 # You should have received a copy of the GNU General Public License | 23 # You should have received a copy of the GNU General Public License |
24 # along with this program; if not, write to the Free Software | 24 # along with this program; if not, write to the Free Software |
25 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, | 25 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
26 # MA 02110-1301, USA. | 26 # MA 02110-1301, USA. |
27 | 27 |
32 return True | 32 return True |
33 elif obj in ['false', 'no', 'off', 'n', 'f', '0']: | 33 elif obj in ['false', 'no', 'off', 'n', 'f', '0']: |
34 return False | 34 return False |
35 else: | 35 else: |
36 raise ValueError("String is not true/false: %r" % obj) | 36 raise ValueError("String is not true/false: %r" % obj) |
37 return bool(obj) | 37 return bool(v) |
38 | 38 |
39 def generate_api_key(username, salt=None): | 39 def generate_api_key(username, salt=None): |
40 from tempfile import _RandomNameSequence | 40 from tempfile import _RandomNameSequence |
41 import hashlib | 41 import hashlib |
42 | 42 |