Mercurial > kallithea
comparison rhodecode/lib/dbmigrate/migrate/versioning/util/__init__.py @ 1203:6832ef664673 beta
source code cleanup: remove trailing white space, normalize file endings
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Sun, 03 Apr 2011 18:23:15 +0200 |
parents | 08d2dcd71666 |
children | a76e9bacbedc |
comparison
equal
deleted
inserted
replaced
1202:eef9e273347a | 1203:6832ef664673 |
---|---|
20 | 20 |
21 def load_model(dotted_name): | 21 def load_model(dotted_name): |
22 """Import module and use module-level variable". | 22 """Import module and use module-level variable". |
23 | 23 |
24 :param dotted_name: path to model in form of string: ``some.python.module:Class`` | 24 :param dotted_name: path to model in form of string: ``some.python.module:Class`` |
25 | 25 |
26 .. versionchanged:: 0.5.4 | 26 .. versionchanged:: 0.5.4 |
27 | 27 |
28 """ | 28 """ |
29 if isinstance(dotted_name, basestring): | 29 if isinstance(dotted_name, basestring): |
30 if ':' not in dotted_name: | 30 if ':' not in dotted_name: |
52 else: | 52 else: |
53 raise ValueError("String is not true/false: %r" % obj) | 53 raise ValueError("String is not true/false: %r" % obj) |
54 | 54 |
55 def guess_obj_type(obj): | 55 def guess_obj_type(obj): |
56 """Do everything to guess object type from string | 56 """Do everything to guess object type from string |
57 | 57 |
58 Tries to convert to `int`, `bool` and finally returns if not succeded. | 58 Tries to convert to `int`, `bool` and finally returns if not succeded. |
59 | 59 |
60 .. versionadded: 0.5.4 | 60 .. versionadded: 0.5.4 |
61 """ | 61 """ |
62 | 62 |
63 result = None | 63 result = None |
64 | 64 |
79 return obj | 79 return obj |
80 | 80 |
81 @decorator | 81 @decorator |
82 def catch_known_errors(f, *a, **kw): | 82 def catch_known_errors(f, *a, **kw): |
83 """Decorator that catches known api errors | 83 """Decorator that catches known api errors |
84 | 84 |
85 .. versionadded: 0.5.4 | 85 .. versionadded: 0.5.4 |
86 """ | 86 """ |
87 | 87 |
88 try: | 88 try: |
89 return f(*a, **kw) | 89 return f(*a, **kw) |